@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,76 @@
|
|
|
1
|
+
import { BaseInputElement, OptionElement } from "./index";
|
|
2
|
+
|
|
3
|
+
import { ElementType } from "../../../constants/UIKitConstants";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Represents a radio button input element.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export class RadioButtonElement extends BaseInputElement<string> {
|
|
10
|
+
/** The label of the input element. */
|
|
11
|
+
private label: string;
|
|
12
|
+
/** The default value of the input element. */
|
|
13
|
+
private defaultValue?: string;
|
|
14
|
+
/** The options available for the radio input element. */
|
|
15
|
+
private options: OptionElement[];
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Creates a new instance of the RadioButtonElement class.
|
|
19
|
+
* @param elementId The ID of the radio button element.
|
|
20
|
+
* @param label The label of the radio button element.
|
|
21
|
+
* @param options The options available for the radio button element.
|
|
22
|
+
*/
|
|
23
|
+
constructor(elementId: string, label: string, options: OptionElement[] = []) {
|
|
24
|
+
super(elementId, ElementType.radio);
|
|
25
|
+
this.label = label || "";
|
|
26
|
+
this.options = options.map((option) => {
|
|
27
|
+
if (option instanceof OptionElement) {
|
|
28
|
+
return option;
|
|
29
|
+
} else {
|
|
30
|
+
return OptionElement.fromJSON(option);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Gets the label of the input element.
|
|
37
|
+
* @returns The label of the input element.
|
|
38
|
+
*/
|
|
39
|
+
getLabel(): string {
|
|
40
|
+
return this.label;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Gets the default value of the input element.
|
|
45
|
+
* @returns The default value of the input element.
|
|
46
|
+
*/
|
|
47
|
+
getDefaultValue(): string | undefined {
|
|
48
|
+
return this.defaultValue;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Sets the default value of the input element.
|
|
53
|
+
* @param defaultValue The default value of the input element.
|
|
54
|
+
*/
|
|
55
|
+
setDefaultValue(defaultValue: string): void {
|
|
56
|
+
this.defaultValue = defaultValue;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Gets the options available for the radio input element.
|
|
61
|
+
* @returns The options available for the radio input element.
|
|
62
|
+
*/
|
|
63
|
+
getOptions(): OptionElement[] {
|
|
64
|
+
return this.options;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
static fromJSON(json: any): RadioButtonElement {
|
|
68
|
+
const options = (json?.options as [] || []).map((option: any) => {
|
|
69
|
+
return OptionElement.fromJSON(option);
|
|
70
|
+
});
|
|
71
|
+
const radioButtonElement = new RadioButtonElement(json.elementId, json.label, options);
|
|
72
|
+
if (json.defaultValue)
|
|
73
|
+
radioButtonElement.setDefaultValue(json.defaultValue);
|
|
74
|
+
return radioButtonElement;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { BaseInputElement, OptionElement } from "./index";
|
|
2
|
+
|
|
3
|
+
import { ElementType } from "../../../constants/UIKitConstants";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Represents a singleSelect button input element.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export class SingleSelectElement extends BaseInputElement<string> {
|
|
10
|
+
/** The label of the input element. */
|
|
11
|
+
private label: string;
|
|
12
|
+
/** The default value of the input element. */
|
|
13
|
+
private defaultValue?: string;
|
|
14
|
+
/** The options available for the singleSelect input element. */
|
|
15
|
+
private options: OptionElement[];
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Creates a new instance of the SingleSelectElement class.
|
|
19
|
+
* @param elementId The ID of the singleSelect button element.
|
|
20
|
+
* @param label The label of the singleSelect button element.
|
|
21
|
+
* @param options The options available for the singleSelect button element.
|
|
22
|
+
*/
|
|
23
|
+
constructor(elementId: string, label: string, options: OptionElement[] = []) {
|
|
24
|
+
super(elementId, ElementType.singleSelect);
|
|
25
|
+
this.label = label || "";
|
|
26
|
+
this.options = options.map((option) => {
|
|
27
|
+
if (option instanceof OptionElement) {
|
|
28
|
+
return option;
|
|
29
|
+
} else {
|
|
30
|
+
return OptionElement.fromJSON(option);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Gets the label of the input element.
|
|
37
|
+
* @returns The label of the input element.
|
|
38
|
+
*/
|
|
39
|
+
getLabel(): string {
|
|
40
|
+
return this.label;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Gets the default value of the input element.
|
|
45
|
+
* @returns The default value of the input element.
|
|
46
|
+
*/
|
|
47
|
+
getDefaultValue(): string | undefined {
|
|
48
|
+
return this.defaultValue;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Sets the default value of the input element.
|
|
53
|
+
* @param defaultValue The default value of the input element.
|
|
54
|
+
*/
|
|
55
|
+
setDefaultValue(defaultValue: string): void {
|
|
56
|
+
this.defaultValue = defaultValue;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Gets the options available for the singleSelect input element.
|
|
61
|
+
* @returns The options available for the singleSelect input element.
|
|
62
|
+
*/
|
|
63
|
+
getOptions(): OptionElement[] {
|
|
64
|
+
return this.options;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
static fromJSON(json: any): SingleSelectElement {
|
|
68
|
+
const options = (json?.options as [] || []).map((option: any) => {
|
|
69
|
+
return OptionElement.fromJSON(option);
|
|
70
|
+
});
|
|
71
|
+
const singleSelectElement = new SingleSelectElement(json.elementId, json.label, options);
|
|
72
|
+
if (json.defaultValue)
|
|
73
|
+
singleSelectElement.setDefaultValue(json.defaultValue);
|
|
74
|
+
return singleSelectElement;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { BaseInputElement } from "./index";
|
|
2
|
+
import { ElementType } from "../../../constants/UIKitConstants";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Represents a text input element.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export class TextInputElement extends BaseInputElement<string> {
|
|
9
|
+
/** The label of the input element. */
|
|
10
|
+
private label: string;
|
|
11
|
+
/** The maximum number of lines for a multi-line text input element. */
|
|
12
|
+
private maxLines?: number = 1;
|
|
13
|
+
/** The placeholder text to display in the input element. */
|
|
14
|
+
private placeholder?= {
|
|
15
|
+
text: "Enter text here..."
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* The default value in text input.
|
|
19
|
+
*/
|
|
20
|
+
private defaultValue?: string;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Creates a new instance of the TextInputElement class.
|
|
24
|
+
* @param {string} elementId - The unique identifier of the form element.
|
|
25
|
+
* @param {string} label - The label of the input element.
|
|
26
|
+
*/
|
|
27
|
+
constructor(elementId: string, label: string) {
|
|
28
|
+
super(elementId, ElementType.text);
|
|
29
|
+
this.label = label || "";
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Returns the label of the input element.
|
|
34
|
+
* @returns {string} The label of the input element.
|
|
35
|
+
*/
|
|
36
|
+
getLabel(): string {
|
|
37
|
+
return this.label;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Returns the maximum number of lines for a multi-line text input element.
|
|
42
|
+
* @returns {number} The maximum number of lines for a multi-line text input element.
|
|
43
|
+
*/
|
|
44
|
+
getMaxLines(): number | undefined {
|
|
45
|
+
return this.maxLines;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Sets the maximum number of lines for a multi-line text input element.
|
|
50
|
+
* @param {number} maxLines - The maximum number of lines for a multi-line text input element.
|
|
51
|
+
*/
|
|
52
|
+
setMaxLines(maxLines: number): void {
|
|
53
|
+
this.maxLines = maxLines;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Returns the placeholder text to display in the input element.
|
|
58
|
+
* @returns {string} The placeholder text to display in the input element.
|
|
59
|
+
*/
|
|
60
|
+
getPlaceholder(): string | undefined {
|
|
61
|
+
return this?.placeholder?.text;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Sets the placeholder text to display in the input element.
|
|
66
|
+
* @param {string} placeholder - The placeholder text to display in the input element.
|
|
67
|
+
*/
|
|
68
|
+
setPlaceholder(placeholder: string): void {
|
|
69
|
+
this.placeholder = {
|
|
70
|
+
text: placeholder
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Returns the default value in text input.
|
|
76
|
+
* @returns {string} The default value in text input.
|
|
77
|
+
*/
|
|
78
|
+
getDefaultValue(): string | undefined {
|
|
79
|
+
return this.defaultValue;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Sets the default value in text input.
|
|
84
|
+
* @param {string} defaultValue - The default value in text input.
|
|
85
|
+
* @returns {string} The default value in text input.
|
|
86
|
+
*/
|
|
87
|
+
setDefaultValue(defaultValue: string): void {
|
|
88
|
+
this.defaultValue = defaultValue;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
static fromJSON(json: any): TextInputElement {
|
|
92
|
+
const textInput = new TextInputElement(json.elementId, json.label);
|
|
93
|
+
if (json.maxLines)
|
|
94
|
+
textInput.setMaxLines(json.maxLines);
|
|
95
|
+
if (json.placeholder && json.placeholder.text)
|
|
96
|
+
textInput.setPlaceholder(json.placeholder?.text);
|
|
97
|
+
if (json.defaultValue)
|
|
98
|
+
textInput.setDefaultValue(json.defaultValue);
|
|
99
|
+
return textInput;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { BaseInputElement } from "./BaseInputElement";
|
|
2
|
+
export { BaseInteractiveElement } from "./BaseInteractiveElement";
|
|
3
|
+
export { ButtonElement } from "./ButtonElement";
|
|
4
|
+
export { CheckboxElement } from "./CheckboxElement";
|
|
5
|
+
export { DropdownElement } from "./DropdownElement";
|
|
6
|
+
export { LabelElement } from "./LabelElement";
|
|
7
|
+
export { OptionElement } from "./OptionElement";
|
|
8
|
+
export { RadioButtonElement } from "./RadioButtonElement";
|
|
9
|
+
export { SingleSelectElement } from "./SingleSelectElement";
|
|
10
|
+
export { TextInputElement } from "./TextInputElement";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { APIAction, CustomAction, URLNavigationAction } from "../InteractiveActions";
|
|
2
|
+
|
|
3
|
+
import { ButtonAction } from "../../../constants/UIKitConstants";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Represents an action that can be performed on a UI element, such as a button.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export class ActionEntity {
|
|
10
|
+
/**
|
|
11
|
+
* The type of action to perform when the UI element is interacted with.
|
|
12
|
+
*/
|
|
13
|
+
private actionType: ButtonAction;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Creates an instance of the ActionEntity class.
|
|
17
|
+
* @param {ButtonAction} actionType - The type of action that the button performs.
|
|
18
|
+
*/
|
|
19
|
+
constructor(actionType: ButtonAction) {
|
|
20
|
+
this.actionType = actionType;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Returns the type of action to perform when the UI element is interacted with.
|
|
25
|
+
* @returns {ButtonAction} The type of action to perform when the UI element is interacted with.
|
|
26
|
+
*/
|
|
27
|
+
getActionType(): ButtonAction {
|
|
28
|
+
return this.actionType;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
static fromJSON(json: any): APIAction | URLNavigationAction | CustomAction {
|
|
32
|
+
switch (json.actionType) {
|
|
33
|
+
case ButtonAction.apiAction:
|
|
34
|
+
return APIAction.fromJSON(json);
|
|
35
|
+
case ButtonAction.urlNavigation:
|
|
36
|
+
return URLNavigationAction.fromJSON(json);
|
|
37
|
+
default:
|
|
38
|
+
return CustomAction.fromJSON();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { BaseInputElement, BaseInteractiveElement, LabelElement } from "../InteractiveElements";
|
|
2
|
+
|
|
3
|
+
import { ElementType } from "../../../constants/UIKitConstants";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Represents the base input for a dynamic form element.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export class ElementEntity {
|
|
10
|
+
/**
|
|
11
|
+
* The type of the form element.
|
|
12
|
+
*/
|
|
13
|
+
private elementType: string;
|
|
14
|
+
/**
|
|
15
|
+
* The unique identifier of the form element.
|
|
16
|
+
*/
|
|
17
|
+
private elementId: string;
|
|
18
|
+
|
|
19
|
+
constructor(elementId: string, elementType: string) {
|
|
20
|
+
this.elementId = elementId || "";
|
|
21
|
+
this.elementType = elementType || "";
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Returns the type of the form element.
|
|
26
|
+
* @returns {string} The type of the form element.
|
|
27
|
+
*/
|
|
28
|
+
getElementType(): string {
|
|
29
|
+
return this.elementType;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Returns the unique identifier of the form element.
|
|
34
|
+
* @returns {string} The unique identifier of the form element.
|
|
35
|
+
*/
|
|
36
|
+
getElementId(): string {
|
|
37
|
+
return this.elementId;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static fromJSON(json: any): ElementEntity {
|
|
41
|
+
switch (json.elementType) {
|
|
42
|
+
case ElementType.text:
|
|
43
|
+
return BaseInputElement.fromJSON(json);
|
|
44
|
+
case ElementType.checkbox:
|
|
45
|
+
return BaseInputElement.fromJSON(json);
|
|
46
|
+
case ElementType.dropdown:
|
|
47
|
+
return BaseInputElement.fromJSON(json);
|
|
48
|
+
case ElementType.radio:
|
|
49
|
+
return BaseInputElement.fromJSON(json);
|
|
50
|
+
case ElementType.singleSelect:
|
|
51
|
+
return BaseInputElement.fromJSON(json);
|
|
52
|
+
case ElementType.button:
|
|
53
|
+
return BaseInteractiveElement.fromJSON(json);
|
|
54
|
+
case ElementType.label:
|
|
55
|
+
return LabelElement.fromJSON(json);
|
|
56
|
+
default:
|
|
57
|
+
return LabelElement.fromJSON({
|
|
58
|
+
elementId: "1",
|
|
59
|
+
elementType: ElementType.label,
|
|
60
|
+
text: "unknown element type",
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { MessageTypeConstants } from "../../../constants/UIKitConstants";
|
|
2
|
+
import { ButtonElement } from "../InteractiveElements/index";
|
|
3
|
+
import { CometChat } from "@cometchat/chat-sdk-react-native";
|
|
4
|
+
|
|
5
|
+
interface CardData {
|
|
6
|
+
text: string;
|
|
7
|
+
cardActions: Array<ButtonElement>;
|
|
8
|
+
imageUrl?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Represents a card message for CometChat.
|
|
13
|
+
* @extends CometChat.InteractiveMessage
|
|
14
|
+
*/
|
|
15
|
+
export class CardMessage extends CometChat.InteractiveMessage {
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The URL of the image for the card.
|
|
19
|
+
*/
|
|
20
|
+
private imageUrl?: string;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The text to display on the card.
|
|
24
|
+
*/
|
|
25
|
+
private text: string;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The actions to perform when the card is interacted with.
|
|
29
|
+
*/
|
|
30
|
+
private cardActions: Array<ButtonElement>;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Creates a new instance of CardMessage.
|
|
34
|
+
* @param receiverId - The ID of the receiver.
|
|
35
|
+
* @param receiverType - The type of the receiver.
|
|
36
|
+
* @param text - The text to display on the card.
|
|
37
|
+
* @param cardActions - The actions to perform when the card is interacted with.
|
|
38
|
+
*/
|
|
39
|
+
constructor(
|
|
40
|
+
receiverId: string,
|
|
41
|
+
receiverType: string,
|
|
42
|
+
text: string,
|
|
43
|
+
cardActions: Array<ButtonElement>
|
|
44
|
+
) {
|
|
45
|
+
super(receiverId, receiverType, MessageTypeConstants.card, {});
|
|
46
|
+
this.text = text;
|
|
47
|
+
this.cardActions = cardActions;
|
|
48
|
+
this.setInteractiveData({ text, cardActions });
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Gets the URL of the image for the card.
|
|
53
|
+
* @returns The URL of the image.
|
|
54
|
+
*/
|
|
55
|
+
getImageUrl(): string | undefined {
|
|
56
|
+
return this.imageUrl;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Sets the image URL for the interactive card data.
|
|
61
|
+
* @param imageUrl - The URL of the image to be set.
|
|
62
|
+
*/
|
|
63
|
+
setImageUrl(imageUrl: string) {
|
|
64
|
+
this.imageUrl = imageUrl;
|
|
65
|
+
this.setInteractiveData({ imageUrl });
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Gets the text to display on the card.
|
|
70
|
+
* @returns The text to display.
|
|
71
|
+
*/
|
|
72
|
+
getText(): string {
|
|
73
|
+
return this.text;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Gets the actions to perform when the card is interacted with.
|
|
78
|
+
* @returns The actions to perform.
|
|
79
|
+
*/
|
|
80
|
+
getCardActions(): Array<ButtonElement> {
|
|
81
|
+
return this.cardActions;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Sets the interactive data for the card message.
|
|
86
|
+
* @param json - The partial data to set.
|
|
87
|
+
*/
|
|
88
|
+
setInteractiveData(json: Partial<CardData>): void {
|
|
89
|
+
const text = json.text || this.text;
|
|
90
|
+
const cardActions = json.cardActions || this.cardActions;
|
|
91
|
+
const imageUrl = json.imageUrl || this.imageUrl;
|
|
92
|
+
const data: CardData = {
|
|
93
|
+
text: text,
|
|
94
|
+
cardActions: cardActions,
|
|
95
|
+
}
|
|
96
|
+
if (imageUrl) {
|
|
97
|
+
data.imageUrl = imageUrl;
|
|
98
|
+
}
|
|
99
|
+
super.setInteractiveData(data);
|
|
100
|
+
if (text) this.text = text;
|
|
101
|
+
if (cardActions) this.cardActions = cardActions;
|
|
102
|
+
if (imageUrl) this.imageUrl = imageUrl;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Gets the interactive data for the card message.
|
|
107
|
+
* @returns The interactive data.
|
|
108
|
+
*/
|
|
109
|
+
getInteractiveData(): CardData {
|
|
110
|
+
const data: CardData = {
|
|
111
|
+
text: this.text,
|
|
112
|
+
cardActions: this.cardActions,
|
|
113
|
+
};
|
|
114
|
+
if (this.imageUrl) {
|
|
115
|
+
data.imageUrl = this.imageUrl;
|
|
116
|
+
}
|
|
117
|
+
return data;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Creates a new instance of CardMessage from the provided JSON.
|
|
122
|
+
* @param json - The JSON to create the instance from.
|
|
123
|
+
* @returns The new instance of CardMessage.
|
|
124
|
+
*/
|
|
125
|
+
static fromJSON(json: any): CardMessage {
|
|
126
|
+
const data = json?.data?.interactiveData;
|
|
127
|
+
const cardActions = (data?.cardActions as [] || []).map((action: any) => {
|
|
128
|
+
return ButtonElement.fromJSON(action);
|
|
129
|
+
});
|
|
130
|
+
const imageUrl = data?.imageUrl;
|
|
131
|
+
const cardMessage = new CardMessage(
|
|
132
|
+
json.receiverId,
|
|
133
|
+
json.receiverType,
|
|
134
|
+
data?.text,
|
|
135
|
+
cardActions
|
|
136
|
+
);
|
|
137
|
+
if (imageUrl) cardMessage.setImageUrl(imageUrl);
|
|
138
|
+
Object.assign(cardMessage, json);
|
|
139
|
+
return cardMessage;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { CometChat } from "@cometchat/chat-sdk-react-native";
|
|
2
|
+
import { MessageTypeConstants } from "../../../constants/UIKitConstants";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Represents a custom interactive message that extends CometChat's InteractiveMessage class.
|
|
6
|
+
* @extends CometChat.InteractiveMessage
|
|
7
|
+
*/
|
|
8
|
+
export class CustomInteractiveMessage extends CometChat.InteractiveMessage {
|
|
9
|
+
/**
|
|
10
|
+
* Creates a new instance of CustomInteractiveMessage.
|
|
11
|
+
* @param receiverId - The ID of the receiver of the message.
|
|
12
|
+
* @param receiverType - The type of the receiver of the message.
|
|
13
|
+
* @param json - The JSON object to create the CustomInteractiveMessage object from.
|
|
14
|
+
*/
|
|
15
|
+
constructor(
|
|
16
|
+
receiverId: string,
|
|
17
|
+
receiverType: string,
|
|
18
|
+
json: Object
|
|
19
|
+
) {
|
|
20
|
+
super(receiverId, receiverType, MessageTypeConstants.customInteractive, json);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Static method to create a CustomInteractiveMessage object from a JSON object.
|
|
25
|
+
* @param json - JSON object to create the CustomInteractiveMessage object from.
|
|
26
|
+
* @returns CustomInteractiveMessage object.
|
|
27
|
+
*/
|
|
28
|
+
static fromJSON(json: any): CustomInteractiveMessage {
|
|
29
|
+
const data = json?.data?.interactiveData;
|
|
30
|
+
const customInteractiveMessage = new CustomInteractiveMessage(
|
|
31
|
+
json.receiverId,
|
|
32
|
+
json.receiverType,
|
|
33
|
+
data
|
|
34
|
+
);
|
|
35
|
+
Object.assign(customInteractiveMessage, json);
|
|
36
|
+
return customInteractiveMessage;
|
|
37
|
+
}
|
|
38
|
+
}
|