@ethora/chat-component-rn 26.5.21 → 26.6.11
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/CHANGELOG.md +80 -0
- package/README.md +3 -3
- package/index.js +1 -1
- package/lib/commonjs/components/MainComponents/ChatHeader.js +20 -8
- package/lib/commonjs/components/MainComponents/ChatHeader.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ChatWrapper.js +17 -0
- package/lib/commonjs/components/MainComponents/ChatWrapper.js.map +1 -1
- package/lib/commonjs/components/MainComponents/LanguageSelectorButton.js +62 -0
- package/lib/commonjs/components/MainComponents/LanguageSelectorButton.js.map +1 -0
- package/lib/commonjs/components/MainComponents/LanguageSelectorModal.js +253 -0
- package/lib/commonjs/components/MainComponents/LanguageSelectorModal.js.map +1 -0
- package/lib/commonjs/components/MainComponents/MediaMessage.js +7 -1
- package/lib/commonjs/components/MainComponents/MediaMessage.js.map +1 -1
- package/lib/commonjs/components/MainComponents/RoomList.js +23 -9
- package/lib/commonjs/components/MainComponents/RoomList.js.map +1 -1
- package/lib/commonjs/components/MessageBubble/Message.js +72 -11
- package/lib/commonjs/components/MessageBubble/Message.js.map +1 -1
- package/lib/commonjs/components/MessageBubble/MessageTranslate.js +160 -0
- package/lib/commonjs/components/MessageBubble/MessageTranslate.js.map +1 -0
- package/lib/commonjs/components/MessageBubble/TranslatedMessageBody.js +59 -0
- package/lib/commonjs/components/MessageBubble/TranslatedMessageBody.js.map +1 -0
- package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js +3 -3
- package/lib/commonjs/components/UsersList/UsersList.js +3 -1
- package/lib/commonjs/components/UsersList/UsersList.js.map +1 -1
- package/lib/commonjs/components/VideoCalls/CallButtons.js +159 -0
- package/lib/commonjs/components/VideoCalls/CallButtons.js.map +1 -0
- package/lib/commonjs/components/VideoCalls/CallIcons.js +328 -0
- package/lib/commonjs/components/VideoCalls/CallIcons.js.map +1 -0
- package/lib/commonjs/components/VideoCalls/VideoCallOverlay.js +550 -0
- package/lib/commonjs/components/VideoCalls/VideoCallOverlay.js.map +1 -0
- package/lib/commonjs/components/VideoCalls/VideoCallSession.js +636 -0
- package/lib/commonjs/components/VideoCalls/VideoCallSession.js.map +1 -0
- package/lib/commonjs/components/VideoCalls/livekitRuntime.js +91 -0
- package/lib/commonjs/components/VideoCalls/livekitRuntime.js.map +1 -0
- package/lib/commonjs/components/VideoCalls/useCallKeep.js +215 -0
- package/lib/commonjs/components/VideoCalls/useCallKeep.js.map +1 -0
- package/lib/commonjs/components/styled/AudioMessage.js +91 -33
- package/lib/commonjs/components/styled/AudioMessage.js.map +1 -1
- package/lib/commonjs/components/styled/RoomListComponents/index.js +13 -1
- package/lib/commonjs/components/styled/RoomListComponents/index.js.map +1 -1
- package/lib/commonjs/components/styled/SendInput.js +83 -49
- package/lib/commonjs/components/styled/SendInput.js.map +1 -1
- package/lib/commonjs/components/styled/StyledComponents.js +9 -4
- package/lib/commonjs/components/styled/StyledComponents.js.map +1 -1
- package/lib/commonjs/components/styled/StyledInputComponents/Composing.js +2 -0
- package/lib/commonjs/components/styled/StyledInputComponents/Composing.js.map +1 -1
- package/lib/commonjs/components/styled/VideoMessage.js +110 -26
- package/lib/commonjs/components/styled/VideoMessage.js.map +1 -1
- package/lib/commonjs/context/xmppProvider.js +10 -3
- package/lib/commonjs/context/xmppProvider.js.map +1 -1
- package/lib/commonjs/helpers/callLogMessage.js +162 -0
- package/lib/commonjs/helpers/callLogMessage.js.map +1 -0
- package/lib/commonjs/helpers/callPush.js +61 -0
- package/lib/commonjs/helpers/callPush.js.map +1 -0
- package/lib/commonjs/helpers/constants/LANGUAGE_OPTIONS.js +24 -12
- package/lib/commonjs/helpers/constants/LANGUAGE_OPTIONS.js.map +1 -1
- package/lib/commonjs/helpers/createUserNameFromSetUser.js +51 -2
- package/lib/commonjs/helpers/createUserNameFromSetUser.js.map +1 -1
- package/lib/commonjs/helpers/getDataFromXml.js +19 -1
- package/lib/commonjs/helpers/getDataFromXml.js.map +1 -1
- package/lib/commonjs/helpers/incomingCallFromPush.js +74 -0
- package/lib/commonjs/helpers/incomingCallFromPush.js.map +1 -0
- package/lib/commonjs/helpers/insertMessageWithDelimiter.js +13 -1
- package/lib/commonjs/helpers/insertMessageWithDelimiter.js.map +1 -1
- package/lib/commonjs/helpers/isUnresolvedSenderId.js +32 -0
- package/lib/commonjs/helpers/isUnresolvedSenderId.js.map +1 -0
- package/lib/commonjs/hooks/useChatSettingState.js +2 -0
- package/lib/commonjs/hooks/useChatSettingState.js.map +1 -1
- package/lib/commonjs/hooks/useMessageTranslation.js +51 -0
- package/lib/commonjs/hooks/useMessageTranslation.js.map +1 -0
- package/lib/commonjs/hooks/usePushNotifications.js +13 -3
- package/lib/commonjs/hooks/usePushNotifications.js.map +1 -1
- package/lib/commonjs/hooks/useSendMessage.js +14 -4
- package/lib/commonjs/hooks/useSendMessage.js.map +1 -1
- package/lib/commonjs/i18n/strings.js +1308 -0
- package/lib/commonjs/i18n/strings.js.map +1 -0
- package/lib/commonjs/i18n/useT.js +60 -0
- package/lib/commonjs/i18n/useT.js.map +1 -0
- package/lib/commonjs/main.js +44 -0
- package/lib/commonjs/main.js.map +1 -1
- package/lib/commonjs/networking/api-requests/auth.api.js +81 -52
- package/lib/commonjs/networking/api-requests/auth.api.js.map +1 -1
- package/lib/commonjs/networking/api-requests/push.api.js +34 -5
- package/lib/commonjs/networking/api-requests/push.api.js.map +1 -1
- package/lib/commonjs/networking/api-requests/rooms.api.js +108 -0
- package/lib/commonjs/networking/api-requests/rooms.api.js.map +1 -1
- package/lib/commonjs/networking/callTokenStanza.js +531 -0
- package/lib/commonjs/networking/callTokenStanza.js.map +1 -0
- package/lib/commonjs/networking/outboundQueue.js.map +1 -1
- package/lib/commonjs/networking/stanzaHandlers.js +75 -8
- package/lib/commonjs/networking/stanzaHandlers.js.map +1 -1
- package/lib/commonjs/networking/xmpp/handleStanzas.xmpp.js +47 -11
- package/lib/commonjs/networking/xmpp/handleStanzas.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/sendTextMessage.xmpp.js +2 -1
- package/lib/commonjs/networking/xmpp/sendTextMessage.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js +42 -5
- package/lib/commonjs/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js.map +1 -1
- package/lib/commonjs/networking/xmppClient.js +78 -16
- package/lib/commonjs/networking/xmppClient.js.map +1 -1
- package/lib/commonjs/roomStore/callSlice.js +144 -0
- package/lib/commonjs/roomStore/callSlice.js.map +1 -0
- package/lib/commonjs/roomStore/chatSettingsSlice.js +8 -2
- package/lib/commonjs/roomStore/chatSettingsSlice.js.map +1 -1
- package/lib/commonjs/roomStore/index.js +7 -1
- package/lib/commonjs/roomStore/index.js.map +1 -1
- package/lib/commonjs/roomStore/persistence.js +69 -5
- package/lib/commonjs/roomStore/persistence.js.map +1 -1
- package/lib/commonjs/roomStore/roomsSlice.js +136 -6
- package/lib/commonjs/roomStore/roomsSlice.js.map +1 -1
- package/lib/commonjs/utils/translateModePolicy.js +33 -0
- package/lib/commonjs/utils/translateModePolicy.js.map +1 -0
- package/lib/module/components/MainComponents/ChatHeader.js +20 -8
- package/lib/module/components/MainComponents/ChatHeader.js.map +1 -1
- package/lib/module/components/MainComponents/ChatWrapper.js +17 -0
- package/lib/module/components/MainComponents/ChatWrapper.js.map +1 -1
- package/lib/module/components/MainComponents/LanguageSelectorButton.js +57 -0
- package/lib/module/components/MainComponents/LanguageSelectorButton.js.map +1 -0
- package/lib/module/components/MainComponents/LanguageSelectorModal.js +246 -0
- package/lib/module/components/MainComponents/LanguageSelectorModal.js.map +1 -0
- package/lib/module/components/MainComponents/MediaMessage.js +7 -1
- package/lib/module/components/MainComponents/MediaMessage.js.map +1 -1
- package/lib/module/components/MainComponents/RoomList.js +23 -9
- package/lib/module/components/MainComponents/RoomList.js.map +1 -1
- package/lib/module/components/MessageBubble/Message.js +73 -12
- package/lib/module/components/MessageBubble/Message.js.map +1 -1
- package/lib/module/components/MessageBubble/MessageTranslate.js +155 -0
- package/lib/module/components/MessageBubble/MessageTranslate.js.map +1 -0
- package/lib/module/components/MessageBubble/TranslatedMessageBody.js +53 -0
- package/lib/module/components/MessageBubble/TranslatedMessageBody.js.map +1 -0
- package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js +3 -3
- package/lib/module/components/UsersList/UsersList.js +3 -1
- package/lib/module/components/UsersList/UsersList.js.map +1 -1
- package/lib/module/components/VideoCalls/CallButtons.js +154 -0
- package/lib/module/components/VideoCalls/CallButtons.js.map +1 -0
- package/lib/module/components/VideoCalls/CallIcons.js +309 -0
- package/lib/module/components/VideoCalls/CallIcons.js.map +1 -0
- package/lib/module/components/VideoCalls/VideoCallOverlay.js +544 -0
- package/lib/module/components/VideoCalls/VideoCallOverlay.js.map +1 -0
- package/lib/module/components/VideoCalls/VideoCallSession.js +630 -0
- package/lib/module/components/VideoCalls/VideoCallSession.js.map +1 -0
- package/lib/module/components/VideoCalls/livekitRuntime.js +83 -0
- package/lib/module/components/VideoCalls/livekitRuntime.js.map +1 -0
- package/lib/module/components/VideoCalls/useCallKeep.js +210 -0
- package/lib/module/components/VideoCalls/useCallKeep.js.map +1 -0
- package/lib/module/components/styled/AudioMessage.js +91 -33
- package/lib/module/components/styled/AudioMessage.js.map +1 -1
- package/lib/module/components/styled/RoomListComponents/index.js +13 -1
- package/lib/module/components/styled/RoomListComponents/index.js.map +1 -1
- package/lib/module/components/styled/SendInput.js +83 -49
- package/lib/module/components/styled/SendInput.js.map +1 -1
- package/lib/module/components/styled/StyledComponents.js +9 -4
- package/lib/module/components/styled/StyledComponents.js.map +1 -1
- package/lib/module/components/styled/StyledInputComponents/Composing.js +2 -0
- package/lib/module/components/styled/StyledInputComponents/Composing.js.map +1 -1
- package/lib/module/components/styled/VideoMessage.js +111 -27
- package/lib/module/components/styled/VideoMessage.js.map +1 -1
- package/lib/module/context/xmppProvider.js +11 -4
- package/lib/module/context/xmppProvider.js.map +1 -1
- package/lib/module/helpers/callLogMessage.js +152 -0
- package/lib/module/helpers/callLogMessage.js.map +1 -0
- package/lib/module/helpers/callPush.js +55 -0
- package/lib/module/helpers/callPush.js.map +1 -0
- package/lib/module/helpers/constants/LANGUAGE_OPTIONS.js +24 -12
- package/lib/module/helpers/constants/LANGUAGE_OPTIONS.js.map +1 -1
- package/lib/module/helpers/createUserNameFromSetUser.js +49 -1
- package/lib/module/helpers/createUserNameFromSetUser.js.map +1 -1
- package/lib/module/helpers/getDataFromXml.js +20 -1
- package/lib/module/helpers/getDataFromXml.js.map +1 -1
- package/lib/module/helpers/incomingCallFromPush.js +70 -0
- package/lib/module/helpers/incomingCallFromPush.js.map +1 -0
- package/lib/module/helpers/insertMessageWithDelimiter.js +13 -1
- package/lib/module/helpers/insertMessageWithDelimiter.js.map +1 -1
- package/lib/module/helpers/isUnresolvedSenderId.js +27 -0
- package/lib/module/helpers/isUnresolvedSenderId.js.map +1 -0
- package/lib/module/hooks/useChatSettingState.js +2 -0
- package/lib/module/hooks/useChatSettingState.js.map +1 -1
- package/lib/module/hooks/useMessageTranslation.js +46 -0
- package/lib/module/hooks/useMessageTranslation.js.map +1 -0
- package/lib/module/hooks/usePushNotifications.js +13 -3
- package/lib/module/hooks/usePushNotifications.js.map +1 -1
- package/lib/module/hooks/useSendMessage.js +15 -5
- package/lib/module/hooks/useSendMessage.js.map +1 -1
- package/lib/module/i18n/strings.js +1300 -0
- package/lib/module/i18n/strings.js.map +1 -0
- package/lib/module/i18n/useT.js +55 -0
- package/lib/module/i18n/useT.js.map +1 -0
- package/lib/module/main.js +7 -1
- package/lib/module/main.js.map +1 -1
- package/lib/module/networking/api-requests/auth.api.js +80 -51
- package/lib/module/networking/api-requests/auth.api.js.map +1 -1
- package/lib/module/networking/api-requests/push.api.js +35 -5
- package/lib/module/networking/api-requests/push.api.js.map +1 -1
- package/lib/module/networking/api-requests/rooms.api.js +109 -1
- package/lib/module/networking/api-requests/rooms.api.js.map +1 -1
- package/lib/module/networking/callTokenStanza.js +526 -0
- package/lib/module/networking/callTokenStanza.js.map +1 -0
- package/lib/module/networking/outboundQueue.js.map +1 -1
- package/lib/module/networking/stanzaHandlers.js +76 -9
- package/lib/module/networking/stanzaHandlers.js.map +1 -1
- package/lib/module/networking/xmpp/handleStanzas.xmpp.js +48 -11
- package/lib/module/networking/xmpp/handleStanzas.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/sendTextMessage.xmpp.js +1 -1
- package/lib/module/networking/xmpp/sendTextMessage.xmpp.js.map +1 -1
- package/lib/module/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js +43 -5
- package/lib/module/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.js.map +1 -1
- package/lib/module/networking/xmppClient.js +78 -16
- package/lib/module/networking/xmppClient.js.map +1 -1
- package/lib/module/roomStore/callSlice.js +130 -0
- package/lib/module/roomStore/callSlice.js.map +1 -0
- package/lib/module/roomStore/chatSettingsSlice.js +6 -1
- package/lib/module/roomStore/chatSettingsSlice.js.map +1 -1
- package/lib/module/roomStore/index.js +6 -1
- package/lib/module/roomStore/index.js.map +1 -1
- package/lib/module/roomStore/persistence.js +69 -5
- package/lib/module/roomStore/persistence.js.map +1 -1
- package/lib/module/roomStore/roomsSlice.js +134 -5
- package/lib/module/roomStore/roomsSlice.js.map +1 -1
- package/lib/module/utils/translateModePolicy.js +27 -0
- package/lib/module/utils/translateModePolicy.js.map +1 -0
- package/lib/typescript/components/MainComponents/ChatHeader.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/ChatWrapper.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/LanguageSelectorButton.d.ts +12 -0
- package/lib/typescript/components/MainComponents/LanguageSelectorButton.d.ts.map +1 -0
- package/lib/typescript/components/MainComponents/LanguageSelectorModal.d.ts +31 -0
- package/lib/typescript/components/MainComponents/LanguageSelectorModal.d.ts.map +1 -0
- package/lib/typescript/components/MainComponents/MediaMessage.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/RoomList.d.ts.map +1 -1
- package/lib/typescript/components/MessageBubble/Message.d.ts.map +1 -1
- package/lib/typescript/components/MessageBubble/MessageTranslate.d.ts +44 -0
- package/lib/typescript/components/MessageBubble/MessageTranslate.d.ts.map +1 -0
- package/lib/typescript/components/MessageBubble/TranslatedMessageBody.d.ts +24 -0
- package/lib/typescript/components/MessageBubble/TranslatedMessageBody.d.ts.map +1 -0
- package/lib/typescript/components/UsersList/UsersList.d.ts.map +1 -1
- package/lib/typescript/components/VideoCalls/CallButtons.d.ts +16 -0
- package/lib/typescript/components/VideoCalls/CallButtons.d.ts.map +1 -0
- package/lib/typescript/components/VideoCalls/CallIcons.d.ts +30 -0
- package/lib/typescript/components/VideoCalls/CallIcons.d.ts.map +1 -0
- package/lib/typescript/components/VideoCalls/VideoCallOverlay.d.ts +10 -0
- package/lib/typescript/components/VideoCalls/VideoCallOverlay.d.ts.map +1 -0
- package/lib/typescript/components/VideoCalls/VideoCallSession.d.ts +38 -0
- package/lib/typescript/components/VideoCalls/VideoCallSession.d.ts.map +1 -0
- package/lib/typescript/components/VideoCalls/livekitRuntime.d.ts +52 -0
- package/lib/typescript/components/VideoCalls/livekitRuntime.d.ts.map +1 -0
- package/lib/typescript/components/VideoCalls/useCallKeep.d.ts +32 -0
- package/lib/typescript/components/VideoCalls/useCallKeep.d.ts.map +1 -0
- package/lib/typescript/components/styled/AudioMessage.d.ts.map +1 -1
- package/lib/typescript/components/styled/RoomListComponents/index.d.ts.map +1 -1
- package/lib/typescript/components/styled/SendInput.d.ts.map +1 -1
- package/lib/typescript/components/styled/StyledComponents.d.ts.map +1 -1
- package/lib/typescript/components/styled/StyledInputComponents/Composing.d.ts.map +1 -1
- package/lib/typescript/components/styled/VideoMessage.d.ts +2 -0
- package/lib/typescript/components/styled/VideoMessage.d.ts.map +1 -1
- package/lib/typescript/context/xmppProvider.d.ts.map +1 -1
- package/lib/typescript/helpers/callLogMessage.d.ts +34 -0
- package/lib/typescript/helpers/callLogMessage.d.ts.map +1 -0
- package/lib/typescript/helpers/callPush.d.ts +23 -0
- package/lib/typescript/helpers/callPush.d.ts.map +1 -0
- package/lib/typescript/helpers/constants/LANGUAGE_OPTIONS.d.ts +14 -0
- package/lib/typescript/helpers/constants/LANGUAGE_OPTIONS.d.ts.map +1 -1
- package/lib/typescript/helpers/createUserNameFromSetUser.d.ts +33 -1
- package/lib/typescript/helpers/createUserNameFromSetUser.d.ts.map +1 -1
- package/lib/typescript/helpers/getDataFromXml.d.ts.map +1 -1
- package/lib/typescript/helpers/incomingCallFromPush.d.ts +14 -0
- package/lib/typescript/helpers/incomingCallFromPush.d.ts.map +1 -0
- package/lib/typescript/helpers/insertMessageWithDelimiter.d.ts.map +1 -1
- package/lib/typescript/helpers/isUnresolvedSenderId.d.ts +2 -0
- package/lib/typescript/helpers/isUnresolvedSenderId.d.ts.map +1 -0
- package/lib/typescript/hooks/useChatSettingState.d.ts +2 -1
- package/lib/typescript/hooks/useChatSettingState.d.ts.map +1 -1
- package/lib/typescript/hooks/useMessageTranslation.d.ts +25 -0
- package/lib/typescript/hooks/useMessageTranslation.d.ts.map +1 -0
- package/lib/typescript/hooks/usePushNotifications.d.ts.map +1 -1
- package/lib/typescript/hooks/useSendMessage.d.ts.map +1 -1
- package/lib/typescript/i18n/strings.d.ts +16 -0
- package/lib/typescript/i18n/strings.d.ts.map +1 -0
- package/lib/typescript/i18n/useT.d.ts +34 -0
- package/lib/typescript/i18n/useT.d.ts.map +1 -0
- package/lib/typescript/main.d.ts +6 -1
- package/lib/typescript/main.d.ts.map +1 -1
- package/lib/typescript/networking/api-requests/auth.api.d.ts +27 -1
- package/lib/typescript/networking/api-requests/auth.api.d.ts.map +1 -1
- package/lib/typescript/networking/api-requests/push.api.d.ts.map +1 -1
- package/lib/typescript/networking/api-requests/rooms.api.d.ts +3 -0
- package/lib/typescript/networking/api-requests/rooms.api.d.ts.map +1 -1
- package/lib/typescript/networking/callTokenStanza.d.ts +14 -0
- package/lib/typescript/networking/callTokenStanza.d.ts.map +1 -0
- package/lib/typescript/networking/outboundQueue.d.ts +1 -0
- package/lib/typescript/networking/outboundQueue.d.ts.map +1 -1
- package/lib/typescript/networking/stanzaHandlers.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/handleStanzas.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/sendTextMessage.xmpp.d.ts +10 -0
- package/lib/typescript/networking/xmpp/sendTextMessage.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.d.ts +16 -1
- package/lib/typescript/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.d.ts.map +1 -1
- package/lib/typescript/networking/xmppClient.d.ts +1 -1
- package/lib/typescript/networking/xmppClient.d.ts.map +1 -1
- package/lib/typescript/roomStore/callSlice.d.ts +39 -0
- package/lib/typescript/roomStore/callSlice.d.ts.map +1 -0
- package/lib/typescript/roomStore/chatSettingsSlice.d.ts +10 -1
- package/lib/typescript/roomStore/chatSettingsSlice.d.ts.map +1 -1
- package/lib/typescript/roomStore/index.d.ts +4 -0
- package/lib/typescript/roomStore/index.d.ts.map +1 -1
- package/lib/typescript/roomStore/persistence.d.ts.map +1 -1
- package/lib/typescript/roomStore/roomsSlice.d.ts +6 -1
- package/lib/typescript/roomStore/roomsSlice.d.ts.map +1 -1
- package/lib/typescript/types/models/language.model.d.ts +1 -1
- package/lib/typescript/types/models/language.model.d.ts.map +1 -1
- package/lib/typescript/types/models/message.model.d.ts +7 -0
- package/lib/typescript/types/models/message.model.d.ts.map +1 -1
- package/lib/typescript/types/types.d.ts +135 -1
- package/lib/typescript/types/types.d.ts.map +1 -1
- package/lib/typescript/utils/translateModePolicy.d.ts +20 -0
- package/lib/typescript/utils/translateModePolicy.d.ts.map +1 -0
- package/package.json +20 -4
- package/src/components/MainComponents/ChatHeader.tsx +30 -9
- package/src/components/MainComponents/ChatWrapper.tsx +15 -0
- package/src/components/MainComponents/LanguageSelectorButton.tsx +53 -0
- package/src/components/MainComponents/LanguageSelectorModal.tsx +276 -0
- package/src/components/MainComponents/MediaMessage.tsx +5 -0
- package/src/components/MainComponents/RoomList.tsx +27 -9
- package/src/components/MessageBubble/Message.tsx +109 -17
- package/src/components/MessageBubble/MessageTranslate.tsx +182 -0
- package/src/components/MessageBubble/TranslatedMessageBody.tsx +59 -0
- package/src/components/Modals/FilePreviewModal/FilePreviewModal.tsx +3 -3
- package/src/components/UsersList/UsersList.tsx +3 -1
- package/src/components/VideoCalls/CallButtons.tsx +171 -0
- package/src/components/VideoCalls/CallIcons.tsx +246 -0
- package/src/components/VideoCalls/VideoCallOverlay.tsx +627 -0
- package/src/components/VideoCalls/VideoCallSession.tsx +675 -0
- package/src/components/VideoCalls/livekitRuntime.ts +100 -0
- package/src/components/VideoCalls/useCallKeep.ts +252 -0
- package/src/components/styled/AudioMessage.tsx +97 -37
- package/src/components/styled/RoomListComponents/index.tsx +15 -3
- package/src/components/styled/SendInput.tsx +94 -51
- package/src/components/styled/StyledComponents.ts +9 -6
- package/src/components/styled/StyledInputComponents/Composing.tsx +7 -1
- package/src/components/styled/VideoMessage.tsx +114 -20
- package/src/context/xmppProvider.tsx +14 -1
- package/src/helpers/callLogMessage.ts +174 -0
- package/src/helpers/callPush.ts +90 -0
- package/src/helpers/constants/LANGUAGE_OPTIONS.ts +20 -5
- package/src/helpers/createUserNameFromSetUser.ts +68 -2
- package/src/helpers/getDataFromXml.ts +40 -4
- package/src/helpers/incomingCallFromPush.ts +83 -0
- package/src/helpers/insertMessageWithDelimiter.ts +27 -9
- package/src/helpers/isUnresolvedSenderId.ts +25 -0
- package/src/hooks/useChatSettingState.tsx +4 -0
- package/src/hooks/useMessageTranslation.ts +70 -0
- package/src/hooks/usePushNotifications.ts +15 -3
- package/src/hooks/useSendMessage.tsx +18 -5
- package/src/i18n/strings.ts +1322 -0
- package/src/i18n/useT.ts +56 -0
- package/src/main.ts +18 -1
- package/src/networking/api-requests/auth.api.ts +79 -44
- package/src/networking/api-requests/push.api.ts +39 -8
- package/src/networking/api-requests/rooms.api.ts +109 -1
- package/src/networking/callTokenStanza.ts +636 -0
- package/src/networking/outboundQueue.ts +1 -0
- package/src/networking/stanzaHandlers.ts +74 -15
- package/src/networking/xmpp/handleStanzas.xmpp.ts +52 -11
- package/src/networking/xmpp/sendTextMessage.xmpp.ts +1 -1
- package/src/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.ts +41 -5
- package/src/networking/xmppClient.ts +97 -28
- package/src/roomStore/callSlice.ts +190 -0
- package/src/roomStore/chatSettingsSlice.ts +16 -0
- package/src/roomStore/index.ts +5 -0
- package/src/roomStore/persistence.ts +103 -3
- package/src/roomStore/roomsSlice.ts +149 -4
- package/src/types/models/language.model.ts +17 -1
- package/src/types/models/message.model.ts +9 -0
- package/src/types/types.ts +142 -2
- package/src/utils/translateModePolicy.ts +31 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.parseCallPush = exports.isCallPush = void 0;
|
|
7
|
+
// Recognise and parse an *incoming call* push notification.
|
|
8
|
+
//
|
|
9
|
+
// Calls normally ring via a live XMPP `call-token` stanza, which only arrives
|
|
10
|
+
// while the socket is connected. On mobile the socket is dead whenever the OS
|
|
11
|
+
// backgrounds or kills the app, so the backend also delivers the call over
|
|
12
|
+
// push, in the same `data`-payload format as message pushes. This helper lets
|
|
13
|
+
// the push layer tell a call push apart from a chat push and pull the call
|
|
14
|
+
// fields out, tolerating the field-name variations backends tend to use.
|
|
15
|
+
|
|
16
|
+
const pick = (data, keys) => {
|
|
17
|
+
for (const k of keys) {
|
|
18
|
+
const v = data?.[k];
|
|
19
|
+
if (v !== undefined && v !== null && String(v).trim() !== '') {
|
|
20
|
+
return String(v).trim();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return '';
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* True when a push `data` payload represents an incoming call. Matches on an
|
|
28
|
+
* explicit call marker (`type`/`pushType`/`category`/`event` === "call"-ish)
|
|
29
|
+
* or on a callId paired with a call-specific field, so a normal message push
|
|
30
|
+
* is never misread as a call.
|
|
31
|
+
*/
|
|
32
|
+
const isCallPush = data => {
|
|
33
|
+
if (!data) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
const marker = pick(data, ['type', 'pushType', 'category', 'messageType', 'event']).toLowerCase();
|
|
37
|
+
if (marker === 'call' || marker === 'incoming-call' || marker === 'call-token' || marker === 'call-invite') {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
const callId = pick(data, ['callId', 'callid', 'callID']);
|
|
41
|
+
const hasCallField = !!pick(data, ['callToken', 'livekitToken']) || !!pick(data, ['callKind']) || pick(data, ['kind']).toLowerCase() === 'audio' || pick(data, ['kind']).toLowerCase() === 'video';
|
|
42
|
+
return !!callId && hasCallField;
|
|
43
|
+
};
|
|
44
|
+
exports.isCallPush = isCallPush;
|
|
45
|
+
const parseCallPush = data => {
|
|
46
|
+
const d = data || {};
|
|
47
|
+
const roomRef = pick(d, ['callRoom', 'room', 'roomJid', 'jid', 'chatId']) || null;
|
|
48
|
+
const roomBareName = roomRef ? roomRef.split('@')[0] || roomRef : null;
|
|
49
|
+
const kindRaw = pick(d, ['callKind', 'kind']).toLowerCase();
|
|
50
|
+
return {
|
|
51
|
+
callId: pick(d, ['callId', 'callid', 'callID']) || null,
|
|
52
|
+
token: pick(d, ['callToken', 'livekitToken', 'token']) || null,
|
|
53
|
+
kind: kindRaw === 'audio' ? 'audio' : 'video',
|
|
54
|
+
roomBareName,
|
|
55
|
+
roomRef,
|
|
56
|
+
callerName: pick(d, ['callerName', 'callerDisplayName', 'senderName', 'title']) || null,
|
|
57
|
+
callerXmppUsername: pick(d, ['callerXmppUsername', 'callerUsername', 'userJid', 'senderJid']).split('@')[0] || null
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
exports.parseCallPush = parseCallPush;
|
|
61
|
+
//# sourceMappingURL=callPush.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["pick","data","keys","k","v","undefined","String","trim","isCallPush","marker","toLowerCase","callId","hasCallField","exports","parseCallPush","d","roomRef","roomBareName","split","kindRaw","token","kind","callerName","callerXmppUsername"],"sourceRoot":"../../../src","sources":["helpers/callPush.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAiBA,MAAMA,IAAI,GAAGA,CAACC,IAAyB,EAAEC,IAAc,KAAa;EAClE,KAAK,MAAMC,CAAC,IAAID,IAAI,EAAE;IACpB,MAAME,CAAC,GAAGH,IAAI,GAAGE,CAAC,CAAC;IACnB,IAAIC,CAAC,KAAKC,SAAS,IAAID,CAAC,KAAK,IAAI,IAAIE,MAAM,CAACF,CAAC,CAAC,CAACG,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;MAC5D,OAAOD,MAAM,CAACF,CAAC,CAAC,CAACG,IAAI,CAAC,CAAC;IACzB;EACF;EACA,OAAO,EAAE;AACX,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,UAAU,GACrBP,IAA4C,IAChC;EACZ,IAAI,CAACA,IAAI,EAAE;IAAC,OAAO,KAAK;EAAC;EACzB,MAAMQ,MAAM,GAAGT,IAAI,CAACC,IAAI,EAAE,CACxB,MAAM,EACN,UAAU,EACV,UAAU,EACV,aAAa,EACb,OAAO,CACR,CAAC,CAACS,WAAW,CAAC,CAAC;EAChB,IACED,MAAM,KAAK,MAAM,IACjBA,MAAM,KAAK,eAAe,IAC1BA,MAAM,KAAK,YAAY,IACvBA,MAAM,KAAK,aAAa,EACxB;IACA,OAAO,IAAI;EACb;EACA,MAAME,MAAM,GAAGX,IAAI,CAACC,IAAI,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAA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;IACPM,UAAU,EACRtB,IAAI,CAACe,CAAC,EAAE,CAAC,YAAY,EAAE,mBAAmB,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC,IACnE,IAAI;IACNQ,kBAAkB,EAChBvB,IAAI,CAACe,CAAC,EAAE,CAAC,oBAAoB,EAAE,gBAAgB,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,CACtEG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI;EACxB,CAAC;AACH,CAAC;AAACL,OAAA,CAAAC,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -4,20 +4,32 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.LANGUAGE_OPTIONS = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Languages the in-chat globe picker offers.
|
|
9
|
+
*
|
|
10
|
+
* Names are AUTONYMS (each language written in itself), which is what
|
|
11
|
+
* every mainstream language picker does: a reader who only speaks French
|
|
12
|
+
* can find "Français" but not "French". Ids carry the region because the
|
|
13
|
+
* deployment's readers are Canadian and US, and the region is forwarded to
|
|
14
|
+
* the translation service so it can tell fr-CA from fr-FR. Base-language
|
|
15
|
+
* lookups (i18n tables, Translate-button visibility) strip it via
|
|
16
|
+
* toBaseLanguage, so both forms interoperate.
|
|
17
|
+
*
|
|
18
|
+
* Commented-out entries still have full string tables in i18n/strings.ts,
|
|
19
|
+
* they're just not offered to readers in the current deployment.
|
|
20
|
+
*/
|
|
7
21
|
const LANGUAGE_OPTIONS = exports.LANGUAGE_OPTIONS = [{
|
|
8
22
|
name: 'English',
|
|
9
|
-
id: 'en'
|
|
23
|
+
id: 'en-CA'
|
|
10
24
|
}, {
|
|
11
|
-
name: '
|
|
12
|
-
id: 'es'
|
|
25
|
+
name: 'Español',
|
|
26
|
+
id: 'es-US'
|
|
13
27
|
}, {
|
|
14
|
-
name: '
|
|
15
|
-
id: '
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
id: 'zh'
|
|
22
|
-
}];
|
|
28
|
+
name: 'Français',
|
|
29
|
+
id: 'fr-CA'
|
|
30
|
+
}
|
|
31
|
+
// { name: 'Português', id: 'pt' },
|
|
32
|
+
// { name: 'Kreyòl ayisyen', id: 'ht' },
|
|
33
|
+
// { name: '中文', id: 'zh' },
|
|
34
|
+
];
|
|
23
35
|
//# sourceMappingURL=LANGUAGE_OPTIONS.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["LANGUAGE_OPTIONS","exports","name","id"],"sourceRoot":"../../../../src","sources":["helpers/constants/LANGUAGE_OPTIONS.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"names":["LANGUAGE_OPTIONS","exports","name","id"],"sourceRoot":"../../../../src","sources":["helpers/constants/LANGUAGE_OPTIONS.ts"],"mappings":";;;;;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,gBAAkC,GAAAC,OAAA,CAAAD,gBAAA,GAAG,CAChD;EAAEE,IAAI,EAAE,SAAS;EAAEC,EAAE,EAAE;AAAQ,CAAC,EAChC;EAAED,IAAI,EAAE,SAAS;EAAEC,EAAE,EAAE;AAAQ,CAAC,EAChC;EAAED,IAAI,EAAE,UAAU;EAAEC,EAAE,EAAE;AAAQ;AAChC;AACA;AACA;AAAA,CACD","ignoreList":[]}
|
|
@@ -3,7 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.createUserNameFromSetUser = void 0;
|
|
6
|
+
exports.resolveSenderDisplayName = exports.createUserNameFromSetUser = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Cache-only lookup. Returns the literal "Deleted User" as a MISS sentinel
|
|
9
|
+
* when `usersSet` has no entry for `userId` yet, callers that want a
|
|
10
|
+
* better fallback (e.g. resolveSenderDisplayName below) check for that
|
|
11
|
+
* exact string rather than treating it as a real name.
|
|
12
|
+
*/
|
|
7
13
|
const createUserNameFromSetUser = (usersSet, userId) => {
|
|
8
14
|
const user = usersSet[userId];
|
|
9
15
|
if (!user) {
|
|
@@ -11,7 +17,50 @@ const createUserNameFromSetUser = (usersSet, userId) => {
|
|
|
11
17
|
}
|
|
12
18
|
const firstName = user.firstName?.trim() || '';
|
|
13
19
|
const lastName = user.lastName?.trim() || '';
|
|
14
|
-
|
|
20
|
+
// REST-loaded members carry firstName/lastName; XMPP-roster-only
|
|
21
|
+
// members (no REST match yet) carry just the roster `name` attr —
|
|
22
|
+
// fall back to that before giving up and returning the raw id.
|
|
23
|
+
const bareName = user.name?.trim() || '';
|
|
24
|
+
return `${firstName} ${lastName}`.trim() || bareName || userId;
|
|
15
25
|
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The sender's display name, resolved WITHOUT depending on `usersSet`
|
|
29
|
+
* having already been hydrated.
|
|
30
|
+
*
|
|
31
|
+
* `usersSet` is populated by a separate fetch (member list / presence) that
|
|
32
|
+
* can still be in flight when a message arrives, most reliably right after
|
|
33
|
+
* reconnect, when a burst of catch-up messages can land before that fetch
|
|
34
|
+
* resolves. A cache-only lookup shows the literal "Deleted User" for every
|
|
35
|
+
* one of those messages, even though the sender is very much not deleted.
|
|
36
|
+
* On mobile this is the common case, not the rare one: every return from
|
|
37
|
+
* background reconnects.
|
|
38
|
+
*
|
|
39
|
+
* The message itself already carries the sender's name on the wire: every
|
|
40
|
+
* client that sends through this SDK stamps `senderFirstName` /
|
|
41
|
+
* `senderLastName` / `fullName` onto the outgoing stanza's `<data>` element
|
|
42
|
+
* (see sendTextMessage.xmpp.ts / sendTextMessageWithTranslateTag.xmpp.ts),
|
|
43
|
+
* and createMessageFromXml spreads those onto the top-level message object.
|
|
44
|
+
* Preferring that over the cache removes the timing dependency entirely for
|
|
45
|
+
* the common case, and "Deleted User" becomes what it should have always
|
|
46
|
+
* been: a rare last resort, not "usersSet hasn't loaded yet".
|
|
47
|
+
*/
|
|
16
48
|
exports.createUserNameFromSetUser = createUserNameFromSetUser;
|
|
49
|
+
const resolveSenderDisplayName = (message, usersSet) => {
|
|
50
|
+
const rawUserId = String(message?.user?.id || '');
|
|
51
|
+
const localUserId = rawUserId.split('@')[0];
|
|
52
|
+
const currentNameRaw = String(message?.user?.name || '').trim();
|
|
53
|
+
// A previously-resolved "Deleted User" is itself a miss sentinel, not a
|
|
54
|
+
// real name, don't let it short-circuit the fallback chain below.
|
|
55
|
+
const currentName = currentNameRaw === 'Deleted User' ? '' : currentNameRaw;
|
|
56
|
+
const dataFullName = String(message?.fullName || '').trim();
|
|
57
|
+
const dataFirst = String(message?.senderFirstName || '').trim();
|
|
58
|
+
const dataLast = String(message?.senderLastName || '').trim();
|
|
59
|
+
const composedFromData = dataFullName || `${dataFirst} ${dataLast}`.trim();
|
|
60
|
+
const usersSetName = createUserNameFromSetUser(usersSet, localUserId);
|
|
61
|
+
const usersSetNameAlt = createUserNameFromSetUser(usersSet, rawUserId);
|
|
62
|
+
const isUsersSetUseful = name => !!name && name !== 'Deleted User';
|
|
63
|
+
return currentName || isUsersSetUseful(usersSetName) && usersSetName || isUsersSetUseful(usersSetNameAlt) && usersSetNameAlt || composedFromData || localUserId || rawUserId || 'Deleted User';
|
|
64
|
+
};
|
|
65
|
+
exports.resolveSenderDisplayName = resolveSenderDisplayName;
|
|
17
66
|
//# sourceMappingURL=createUserNameFromSetUser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createUserNameFromSetUser","usersSet","userId","user","firstName","trim","lastName","exports"],"sourceRoot":"../../../src","sources":["helpers/createUserNameFromSetUser.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"names":["createUserNameFromSetUser","usersSet","userId","user","firstName","trim","lastName","bareName","name","exports","resolveSenderDisplayName","message","rawUserId","String","id","localUserId","split","currentNameRaw","currentName","dataFullName","fullName","dataFirst","senderFirstName","dataLast","senderLastName","composedFromData","usersSetName","usersSetNameAlt","isUsersSetUseful"],"sourceRoot":"../../../src","sources":["helpers/createUserNameFromSetUser.ts"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,yBAAyB,GAAGA,CACvCC,QAAoC,EACpCC,MAAc,KACH;EACX,MAAMC,IAAI,GAAGF,QAAQ,CAACC,MAAM,CAAC;EAE7B,IAAI,CAACC,IAAI,EAAE;IAAC,OAAO,cAAc;EAAC;EAElC,MAAMC,SAAS,GAAGD,IAAI,CAACC,SAAS,EAAEC,IAAI,CAAC,CAAC,IAAI,EAAE;EAC9C,MAAMC,QAAQ,GAAGH,IAAI,CAACG,QAAQ,EAAED,IAAI,CAAC,CAAC,IAAI,EAAE;EAC5C;EACA;EACA;EACA,MAAME,QAAQ,GAAGJ,IAAI,CAACK,IAAI,EAAEH,IAAI,CAAC,CAAC,IAAI,EAAE;EAExC,OAAO,GAAGD,SAAS,IAAIE,QAAQ,EAAE,CAACD,IAAI,CAAC,CAAC,IAAIE,QAAQ,IAAIL,MAAM;AAChE,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AApBAO,OAAA,CAAAT,yBAAA,GAAAA,yBAAA;AAqBO,MAAMU,wBAAwB,GAAGA,CACtCC,OAIC,EACDV,QAAoC,KACzB;EACX,MAAMW,SAAS,GAAGC,MAAM,CAACF,OAAO,EAAER,IAAI,EAAEW,EAAE,IAAI,EAAE,CAAC;EACjD,MAAMC,WAAW,GAAGH,SAAS,CAACI,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;EAC3C,MAAMC,cAAc,GAAGJ,MAAM,CAACF,OAAO,EAAER,IAAI,EAAEK,IAAI,IAAI,EAAE,CAAC,CAACH,IAAI,CAAC,CAAC;EAC/D;EACA;EACA,MAAMa,WAAW,GAAGD,cAAc,KAAK,cAAc,GAAG,EAAE,GAAGA,cAAc;EAE3E,MAAME,YAAY,GAAGN,MAAM,CAACF,OAAO,EAAES,QAAQ,IAAI,EAAE,CAAC,CAACf,IAAI,CAAC,CAAC;EAC3D,MAAMgB,SAAS,GAAGR,MAAM,CAACF,OAAO,EAAEW,eAAe,IAAI,EAAE,CAAC,CAACjB,IAAI,CAAC,CAAC;EAC/D,MAAMkB,QAAQ,GAAGV,MAAM,CAACF,OAAO,EAAEa,cAAc,IAAI,EAAE,CAAC,CAACnB,IAAI,CAAC,CAAC;EAC7D,MAAMoB,gBAAgB,GAAGN,YAAY,IAAI,GAAGE,SAAS,IAAIE,QAAQ,EAAE,CAAClB,IAAI,CAAC,CAAC;EAE1E,MAAMqB,YAAY,GAAG1B,yBAAyB,CAACC,QAAQ,EAAEc,WAAW,CAAC;EACrE,MAAMY,eAAe,GAAG3B,yBAAyB,CAACC,QAAQ,EAAEW,SAAS,CAAC;EACtE,MAAMgB,gBAAgB,GAAIpB,IAAY,IAAK,CAAC,CAACA,IAAI,IAAIA,IAAI,KAAK,cAAc;EAE5E,OACEU,WAAW,IACVU,gBAAgB,CAACF,YAAY,CAAC,IAAIA,YAAa,IAC/CE,gBAAgB,CAACD,eAAe,CAAC,IAAIA,eAAgB,IACtDF,gBAAgB,IAChBV,WAAW,IACXH,SAAS,IACT,cAAc;AAElB,CAAC;AAACH,OAAA,CAAAC,wBAAA,GAAAA,wBAAA","ignoreList":[]}
|
|
@@ -5,6 +5,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getDataFromXml = void 0;
|
|
7
7
|
var _transformTranslatations = require("./transformTranslatations");
|
|
8
|
+
// Tolerant JSON parse: a malformed `translations` attr must not reject the
|
|
9
|
+
// whole stanza (which would silently drop the message). Mirrors the web
|
|
10
|
+
// SDK's safeJsonParse.
|
|
11
|
+
const safeJsonParse = (value, fallback) => {
|
|
12
|
+
if (typeof value !== 'string' || !value) {
|
|
13
|
+
return fallback;
|
|
14
|
+
}
|
|
15
|
+
try {
|
|
16
|
+
return JSON.parse(value);
|
|
17
|
+
} catch {
|
|
18
|
+
return fallback;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// Keep only well-formed translation entries (drops partial/garbage items),
|
|
23
|
+
// same shape guard the web SDK applies before transformArrayToObject.
|
|
24
|
+
const normalizeTranslations = value => Array.isArray(value) ? value.filter(item => !!item && typeof item === 'object' && typeof item.translatedText === 'string' && typeof item.language === 'string' && typeof item.languageName === 'string') : [];
|
|
8
25
|
const extractTimestamp = (str, stanza) => {
|
|
9
26
|
if (!str) {
|
|
10
27
|
return null;
|
|
@@ -27,7 +44,8 @@ const getDataFromXml = async stanza => {
|
|
|
27
44
|
}
|
|
28
45
|
const body = fullData?.getChild('body')?.getText() || undefined;
|
|
29
46
|
const deleted = !!fullData?.getChild('deleted');
|
|
30
|
-
const
|
|
47
|
+
const translationPayload = safeJsonParse(fullData?.getChild('translations')?.attrs?.value, {});
|
|
48
|
+
const translations = fullData?.getChild('translations')?.attrs?.value ? (0, _transformTranslatations.transformArrayToObject)(normalizeTranslations(translationPayload.translates)) : undefined;
|
|
31
49
|
const langSource = fullData?.getChild('translate')?.attrs?.source;
|
|
32
50
|
const numericPart = /\d{13,}/.exec(id || '')?.[0];
|
|
33
51
|
const date = numericPart ? new Date(+numericPart.slice(0, 13)).toISOString() : new Date().toISOString();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_transformTranslatations","require","extractTimestamp","str","stanza","console","log","toString","timestamp","slice","getDataFromXml","fullData","getChild","xmppId","attrs","id","xmppFrom","from","roomJid","userWallet","split","Date","now","body","getText","undefined","deleted","
|
|
1
|
+
{"version":3,"names":["_transformTranslatations","require","safeJsonParse","value","fallback","JSON","parse","normalizeTranslations","Array","isArray","filter","item","translatedText","language","languageName","extractTimestamp","str","stanza","console","log","toString","timestamp","slice","getDataFromXml","fullData","getChild","xmppId","attrs","id","xmppFrom","from","roomJid","userWallet","split","Date","now","body","getText","undefined","deleted","translationPayload","translations","transformArrayToObject","translates","langSource","source","numericPart","exec","date","toISOString","data","photoURL","photo","user","dataAttrs","exports"],"sourceRoot":"../../../src","sources":["helpers/getDataFromXml.ts"],"mappings":";;;;;;AAEA,IAAAA,wBAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA,MAAMC,aAAa,GAAGA,CAAKC,KAAc,EAAEC,QAAW,KAAQ;EAC5D,IAAI,OAAOD,KAAK,KAAK,QAAQ,IAAI,CAACA,KAAK,EAAE;IAAC,OAAOC,QAAQ;EAAC;EAC1D,IAAI;IACF,OAAOC,IAAI,CAACC,KAAK,CAACH,KAAK,CAAC;EAC1B,CAAC,CAAC,MAAM;IACN,OAAOC,QAAQ;EACjB;AACF,CAAC;;AAED;AACA;AACA,MAAMG,qBAAqB,GAAIJ,KAAc,IAC3CK,KAAK,CAACC,OAAO,CAACN,KAAK,CAAC,GAChBA,KAAK,CAACO,MAAM,CAERC,IAAI,IAMJ,CAAC,CAACA,IAAI,IACN,OAAOA,IAAI,KAAK,QAAQ,IACxB,OAAQA,IAAI,CAASC,cAAc,KAAK,QAAQ,IAChD,OAAQD,IAAI,CAASE,QAAQ,KAAK,QAAQ,IAC1C,OAAQF,IAAI,CAASG,YAAY,KAAK,QAC1C,CAAC,GACD,EAAE;AAER,MAAMC,gBAAgB,GAAGA,CAACC,GAAW,EAAEC,MAAY,KAAoB;EACrE,IAAI,CAACD,GAAG,EAAE;IAAC,OAAO,IAAI;EAAC;EACvB,IAAI,OAAOA,GAAG,KAAK,QAAQ,EAAE;IAC3BE,OAAO,CAACC,GAAG,CAACH,GAAG,EAAEC,MAAM,CAACG,QAAQ,CAAC,CAAC,CAAC;IACnC,OAAO,IAAI;EACb;EACA,MAAMC,SAAS,GAAGL,GAAG,CAACM,KAAK,CAAC,CAAC,EAAE,CAAC;EAChC,OAAOD,SAAS;AAClB,CAAC;AAeM,MAAME,cAAc,GAAG,MAAON,MAAe,IAAmC;EACrF,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,QAAQ,CAAC,WAAW,CAAC,EAAEE,KAAK,EAAEkB,MAE9C;EACb,MAAMC,WAAW,GAAG,SAAS,CAACC,IAAI,CAACnB,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC;EACjD,MAAMoB,IAAI,GAAGF,WAAW,GACpB,IAAIZ,IAAI,CAAC,CAACY,WAAW,CAACxB,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC2B,WAAW,CAAC,CAAC,GACjD,IAAIf,IAAI,CAAC,CAAC,CAACe,WAAW,CAAC,CAAC;EAE5B,MAAMC,IAAI,GAAG1B,QAAQ,EAAEC,QAAQ,CAAC,MAAM,CAAC,IAAIR,MAAM,EAAEQ,QAAQ,CAAC,MAAM,CAAC;EACnE,MAAM0B,QAAQ,GAAGD,IAAI,EAAEvB,KAAK,EAAEyB,KAAK;EAEnC,MAAMC,IAAI,GAAG;IACXzB,EAAE,EAAEI,UAAU;IACdmB;EACF,CAAQ;EAER,MAAMG,SAAS,GAAGJ,IAAI,EAAEvB,KAAK,IAAI,CAAC,CAAC;EAEnC,OAAO;IACLuB,IAAI,EAAEI,SAAS;IACf1B,EAAE;IACFQ,IAAI;IACJL,OAAO;IACPiB,IAAI;IACJK,IAAI;IACJd,OAAO;IACPE,YAAY;IACZG,UAAU;IACVlB,MAAM;IACNG;EACF,CAAC;AACH,CAAC;AAAC0B,OAAA,CAAAhC,cAAA,GAAAA,cAAA","ignoreList":[]}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.handleCallPush = void 0;
|
|
7
|
+
var _roomStore = require("../roomStore");
|
|
8
|
+
var _callSlice = require("../roomStore/callSlice");
|
|
9
|
+
var _callPush = require("./callPush");
|
|
10
|
+
/**
|
|
11
|
+
* Turn an incoming-call push into a ringing call.
|
|
12
|
+
*
|
|
13
|
+
* On mobile the XMPP socket dies whenever the OS backgrounds or kills the
|
|
14
|
+
* app, and the `call-token` stanza that normally opens the ring screen is
|
|
15
|
+
* lost with it. The backend also delivers the call as a data push, so this
|
|
16
|
+
* is the path every call takes when the app was not in the foreground.
|
|
17
|
+
*
|
|
18
|
+
* Returns true when the payload WAS a call push (whether or not it could
|
|
19
|
+
* be rung), so the caller knows to stop and not also show it as a chat
|
|
20
|
+
* notification. A user should never get a "new message: call-state" toast.
|
|
21
|
+
*/
|
|
22
|
+
const handleCallPush = data => {
|
|
23
|
+
if (!(0, _callPush.isCallPush)(data)) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
const parsed = (0, _callPush.parseCallPush)(data);
|
|
27
|
+
const state = _roomStore.store.getState();
|
|
28
|
+
|
|
29
|
+
// Calls off in this deployment: swallow the push rather than ringing a
|
|
30
|
+
// screen the host never opted into.
|
|
31
|
+
if (state.chatSettingStore.config?.videoCalls?.enabled !== true) {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Already ringing or in this exact call (the push raced the stanza, or
|
|
36
|
+
// two pushes arrived). Re-dispatching would reset startedAt and restart
|
|
37
|
+
// the ring, so leave the existing call alone.
|
|
38
|
+
const current = state.call;
|
|
39
|
+
if (current.phase !== 'idle') {
|
|
40
|
+
const sameCall = !!parsed.callId && parsed.callId === current.callId || !!parsed.roomBareName && parsed.roomBareName === current.roomBareName;
|
|
41
|
+
if (sameCall || current.phase === 'in-call') {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Without a LiveKit token there is nothing to accept: the push is only
|
|
47
|
+
// an alert. Ringing anyway would give the user an Accept button that
|
|
48
|
+
// cannot work, so treat it as handled and let the stanza (once the
|
|
49
|
+
// socket is back up) open the real ring screen.
|
|
50
|
+
if (!parsed.token) {
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Resolve the full room JID from the local room map. The push carries
|
|
55
|
+
// the bare name; callSlice and the hangup signal both want the JID.
|
|
56
|
+
const rooms = state.rooms.rooms || {};
|
|
57
|
+
const resolved = Object.values(rooms).find(room => (room?.jid || '').split('@')[0] === parsed.roomBareName || room?.jid === parsed.roomRef);
|
|
58
|
+
const roomJid = resolved?.jid || (parsed.roomRef && parsed.roomRef.includes('@') ? parsed.roomRef : '');
|
|
59
|
+
if (!roomJid) {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
_roomStore.store.dispatch((0, _callSlice.setIncomingCallToken)({
|
|
63
|
+
roomJid,
|
|
64
|
+
roomName: parsed.callerName || resolved?.name || null,
|
|
65
|
+
roomBareName: parsed.roomBareName,
|
|
66
|
+
token: parsed.token,
|
|
67
|
+
kind: parsed.kind,
|
|
68
|
+
callId: parsed.callId,
|
|
69
|
+
peerXmppUsername: parsed.callerXmppUsername
|
|
70
|
+
}));
|
|
71
|
+
return true;
|
|
72
|
+
};
|
|
73
|
+
exports.handleCallPush = handleCallPush;
|
|
74
|
+
//# sourceMappingURL=incomingCallFromPush.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_roomStore","require","_callSlice","_callPush","handleCallPush","data","isCallPush","parsed","parseCallPush","state","store","getState","chatSettingStore","config","videoCalls","enabled","current","call","phase","sameCall","callId","roomBareName","token","rooms","resolved","Object","values","find","room","jid","split","roomRef","roomJid","includes","dispatch","setIncomingCallToken","roomName","callerName","name","kind","peerXmppUsername","callerXmppUsername","exports"],"sourceRoot":"../../../src","sources":["helpers/incomingCallFromPush.ts"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,cAAc,GACzBC,IAA4C,IAChC;EACZ,IAAI,CAAC,IAAAC,oBAAU,EAACD,IA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CAAC,GAAG,CAAC,GAAG1B,MAAM,CAACwB,OAAO,GAAG,EAAE,CAAC;EACxE,IAAI,CAACC,OAAO,EAAE;IACZ,OAAO,IAAI;EACb;EAEAtB,gBAAK,CAACwB,QAAQ,CACZ,IAAAC,+BAAoB,EAAC;IACnBH,OAAO;IACPI,QAAQ,EAAE7B,MAAM,CAAC8B,UAAU,IAAIb,QAAQ,EAAEc,IAAI,IAAI,IAAI;IACrDjB,YAAY,EAAEd,MAAM,CAACc,YAAY;IACjCC,KAAK,EAAEf,MAAM,CAACe,KAAK;IACnBiB,IAAI,EAAEhC,MAAM,CAACgC,IAAI;IACjBnB,MAAM,EAAEb,MAAM,CAACa,MAAM;IACrBoB,gBAAgB,EAAEjC,MAAM,CAACkC;EAC3B,CAAC,CACH,CAAC;EAED,OAAO,IAAI;AACb,CAAC;AAACC,OAAA,CAAAtC,cAAA,GAAAA,cAAA","ignoreList":[]}
|
|
@@ -56,6 +56,18 @@ function insertMessageWithDelimiter(roomMessages, message, lastViewedTimestamp)
|
|
|
56
56
|
if (lastViewedTimestamp && !roomMessages.some(msg => msg.id === 'delimiter-new') && (0, _dateComparison.isDateAfter)(newMessageDate.toString(), lastViewedTimestamp.toString())) {
|
|
57
57
|
const delimiterIndex = roomMessages.findIndex(msg => (0, _dateComparison.isDateAfter)(msg.date?.toString() ?? '', lastViewedTimestamp.toString()));
|
|
58
58
|
if (delimiterIndex !== -1) {
|
|
59
|
+
// The divider's date is what ORDERS it: roomsSlice re-sorts every
|
|
60
|
+
// merged page by timestamp (see `byMs`), so a divider stamped with
|
|
61
|
+
// `new Date()` — i.e. now — sorted past every real message and
|
|
62
|
+
// rendered at the very bottom, BELOW the new messages it is
|
|
63
|
+
// supposed to introduce. Anchor it a hair before the first unread
|
|
64
|
+
// instead, which is where it belongs and where any later sort keeps
|
|
65
|
+
// it. Derived from that message rather than from
|
|
66
|
+
// lastViewedTimestamp so it works whatever format the caller passes.
|
|
67
|
+
const firstUnreadMs = Date.parse(String(roomMessages[delimiterIndex]?.date ?? ''));
|
|
68
|
+
const rawLastViewed = lastViewedTimestamp.toString();
|
|
69
|
+
const lastViewedMs = Date.parse(rawLastViewed) || Number(rawLastViewed) || Date.now();
|
|
70
|
+
const anchorMs = Number.isFinite(firstUnreadMs) ? firstUnreadMs - 1 : lastViewedMs;
|
|
59
71
|
roomMessages.splice(delimiterIndex, 0, {
|
|
60
72
|
id: 'delimiter-new',
|
|
61
73
|
user: {
|
|
@@ -64,7 +76,7 @@ function insertMessageWithDelimiter(roomMessages, message, lastViewedTimestamp)
|
|
|
64
76
|
token: '',
|
|
65
77
|
refreshToken: ''
|
|
66
78
|
},
|
|
67
|
-
date: new Date().
|
|
79
|
+
date: new Date(anchorMs).toISOString(),
|
|
68
80
|
body: 'New Messages',
|
|
69
81
|
roomJid: ''
|
|
70
82
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_dateComparison","require","deepMerge","target","source","key","Array","isArray","insertMessageWithDelimiter","roomMessages","message","lastViewedTimestamp","existingIndex","findIndex","msg","id","xmppId","existing","preservedUserId","user","merged","pending","newMessageDate","date","lastMessage","length","firstMessage","isDateAfter","toString","index","push","some","delimiterIndex","splice","name","undefined","token","refreshToken","
|
|
1
|
+
{"version":3,"names":["_dateComparison","require","deepMerge","target","source","key","Array","isArray","insertMessageWithDelimiter","roomMessages","message","lastViewedTimestamp","existingIndex","findIndex","msg","id","xmppId","existing","preservedUserId","user","merged","pending","newMessageDate","date","lastMessage","length","firstMessage","isDateAfter","toString","index","push","some","delimiterIndex","firstUnreadMs","Date","parse","String","rawLastViewed","lastViewedMs","Number","now","anchorMs","isFinite","splice","name","undefined","token","refreshToken","toISOString","body","roomJid","isDateBefore","unshift","i"],"sourceRoot":"../../../src","sources":["helpers/insertMessageWithDelimiter.ts"],"mappings":";;;;;;AACA,IAAAA,eAAA,GAAAC,OAAA;AAEA,SAASC,SAASA,CAACC,MAAW,EAAEC,MAAW,EAAO;EAChD,KAAK,MAA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AAEnB,YAAY,CAAC4C,CAAC,CAAC,CAAC9B,IAAI,EAAEK,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC,EAC/E;QACAnB,YAAY,CAACkC,MAAM,CAACU,CAAC,EAAE,CAAC,EAAE3C,OAAO,CAAC;QAClC;MACF;IACF;EACF;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isUnresolvedSenderId = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Whether a resolved sender "name" is really just an unresolved id.
|
|
9
|
+
*
|
|
10
|
+
* The name chain ends at the sender's JID localpart when `usersSet` has no
|
|
11
|
+
* entry and the wire carried no name. For a real member that never happens
|
|
12
|
+
* for long — the REST roster fills the cache in. But some senders are not
|
|
13
|
+
* members at all: a broadcast posted by the app itself arrives with the
|
|
14
|
+
* ROOM's own id as its occupant resource (e.g.
|
|
15
|
+
* `646cc8dc96d4a4dc8f7b2f2d_67f6823cf5995841ba431f06`), so no roster will
|
|
16
|
+
* ever resolve it and the bubble ends up captioned with 50 characters of
|
|
17
|
+
* hex.
|
|
18
|
+
*
|
|
19
|
+
* Ethora ids are `<24-hex appId>_<24-hex objectId>`, which is what this
|
|
20
|
+
* matches. A raw objectId on its own is matched too, since some senders
|
|
21
|
+
* carry only that half.
|
|
22
|
+
*/
|
|
23
|
+
const ETHORA_ID = /^[0-9a-f]{24}(_[0-9a-f]{24})?$/i;
|
|
24
|
+
const isUnresolvedSenderId = name => {
|
|
25
|
+
const trimmed = String(name || '').trim();
|
|
26
|
+
if (!trimmed) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
return ETHORA_ID.test(trimmed);
|
|
30
|
+
};
|
|
31
|
+
exports.isUnresolvedSenderId = isUnresolvedSenderId;
|
|
32
|
+
//# sourceMappingURL=isUnresolvedSenderId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ETHORA_ID","isUnresolvedSenderId","name","trimmed","String","trim","test","exports"],"sourceRoot":"../../../src","sources":["helpers/isUnresolvedSenderId.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,SAAS,GAAG,iCAAiC;AAE5C,MAAMC,oBAAoB,GAAIC,IAAa,IAAc;EAC9D,MAAMC,OAAO,GAAGC,MAAM,CAACF,IAAI,IAAI,EAAE,CAAC,CAACG,IAAI,CAAC,CAAC;EACzC,IAAI,CAACF,OAAO,EAAE;IACZ,OAAO,IAAI;EACb;EACA,OAAOH,SAAS,CAACM,IAAI,CAACH,OAAO,CAAC;AAChC,CAAC;AAACI,OAAA,CAAAN,oBAAA,GAAAA,oBAAA","ignoreList":[]}
|
|
@@ -14,6 +14,7 @@ const useChatSettingState = () => {
|
|
|
14
14
|
const selectedUser = (0, _reactRedux.useSelector)(state => state.chatSettingStore.selectedUser);
|
|
15
15
|
const langSource = (0, _reactRedux.useSelector)(state => state.chatSettingStore.langSource);
|
|
16
16
|
const client = (0, _reactRedux.useSelector)(state => state.chatSettingStore.client);
|
|
17
|
+
const translateMode = (0, _reactRedux.useSelector)(state => state.chatSettingStore.translateMode);
|
|
17
18
|
return {
|
|
18
19
|
user,
|
|
19
20
|
activeFile,
|
|
@@ -22,6 +23,7 @@ const useChatSettingState = () => {
|
|
|
22
23
|
deleteModal,
|
|
23
24
|
selectedUser,
|
|
24
25
|
langSource,
|
|
26
|
+
translateMode,
|
|
25
27
|
client
|
|
26
28
|
};
|
|
27
29
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactRedux","require","useChatSettingState","user","useSelector","state","chatSettingStore","activeFile","activeModal","config","deleteModal","selectedUser","langSource","client","exports"],"sourceRoot":"../../../src","sources":["hooks/useChatSettingState.tsx"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAGO,MAAMC,mBAAmB,GAAGA,CAAA,KAAM;EACvC,MAAMC,IAAI,GAAG,IAAAC,uBAAW,EAAEC,KAAgB,IAAKA,KAAK,CAACC,gBAAgB,CAACH,IAAI,CAAC;EAC3E,MAAMI,UAAU,GAAG,IAAAH,uBAAW,EAC3BC,KAAgB,IAAKA,KAAK,CAACC,gBAAgB,CAACC,UAC/C,CAAC;EACD,MAAMC,WAAW,GAAG,IAAAJ,uBAAW,EAC5BC,KAAgB,IAAKA,KAAK,CAACC,gBAAgB,CAACE,WAC/C,CAAC;EACD,MAAMC,MAAM,GAAG,IAAAL,uBAAW,EACvBC,KAAgB,IAAKA,KAAK,CAACC,gBAAgB,CAACG,MAC/C,CAAC;EACD,MAAMC,WAAW,GAAG,IAAAN,uBAAW,EAC5BC,KAAgB,IAAKA,KAAK,CAACC,gBAAgB,CAACI,WAC/C,CAAC;EACD,MAAMC,YAAY,GAAG,IAAAP,uBAAW,EAC7BC,KAAgB,IAAKA,KAAK,CAACC,gBAAgB,CAACK,YAC/C,CAAC;EACD,MAAMC,UAAU,GAAG,IAAAR,uBAAW,EAC3BC,KAAgB,IAAKA,KAAK,CAACC,gBAAgB,CAACM,UAC/C,CAAC;EACD,MAAMC,MAAM,GAAG,IAAAT,uBAAW,EACvBC,KAAgB,IAAKA,KAAK,CAACC,gBAAgB,CAACO,MAC/C,CAAC;EAED,OAAO;
|
|
1
|
+
{"version":3,"names":["_reactRedux","require","useChatSettingState","user","useSelector","state","chatSettingStore","activeFile","activeModal","config","deleteModal","selectedUser","langSource","client","translateMode","exports"],"sourceRoot":"../../../src","sources":["hooks/useChatSettingState.tsx"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAGO,MAAMC,mBAAmB,GAAGA,CAAA,KAAM;EACvC,MAAMC,IAAI,GAAG,IAAAC,uBAAW,EAAEC,KAAgB,IAAKA,KAAK,CAACC,gBAAgB,CAACH,IAAI,CAAC;EAC3E,MAAMI,UAAU,GAAG,IAAAH,uBAAW,EAC3BC,KAAgB,IAAKA,KAAK,CAACC,gBAAgB,CAACC,UAC/C,CAAC;EACD,MAAMC,WAAW,GAAG,IAAAJ,uBAAW,EAC5BC,KAAgB,IAAKA,KAAK,CAACC,gBAAgB,CAACE,WAC/C,CAAC;EACD,MAAMC,MAAM,GAAG,IAAAL,uBAAW,EACvBC,KAAgB,IAAKA,KAAK,CAACC,gBAAgB,CAACG,MAC/C,CAAC;EACD,MAAMC,WAAW,GAAG,IAAAN,uBAAW,EAC5BC,KAAgB,IAAKA,KAAK,CAACC,gBAAgB,CAACI,WAC/C,CAAC;EACD,MAAMC,YAAY,GAAG,IAAAP,uBAAW,EAC7BC,KAAgB,IAAKA,KAAK,CAACC,gBAAgB,CAACK,YAC/C,CAAC;EACD,MAAMC,UAAU,GAAG,IAAAR,uBAAW,EAC3BC,KAAgB,IAAKA,KAAK,CAACC,gBAAgB,CAACM,UAC/C,CAAC;EACD,MAAMC,MAAM,GAAG,IAAAT,uBAAW,EACvBC,KAAgB,IAAKA,KAAK,CAACC,gBAAgB,CAACO,MAC/C,CAAC;EACD,MAAMC,aAAa,GAAG,IAAAV,uBAAW,EAC9BC,KAAgB,IAAKA,KAAK,CAACC,gBAAgB,CAACQ,aAC/C,CAAC;EAED,OAAO;IACLX,IAAI;IACJI,UAAU;IACVC,WAAW;IACXC,MAAM;IACNC,WAAW;IACXC,YAAY;IACZC,UAAU;IACVE,aAAa;IACbD;EACF,CAAC;AACH,CAAC;AAACE,OAAA,CAAAb,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useMessageTranslation = void 0;
|
|
7
|
+
var _strings = require("../i18n/strings");
|
|
8
|
+
// "42", "+1 (555) 123-4567", "3.14159" — text with no actual letters has
|
|
9
|
+
// nothing to translate.
|
|
10
|
+
const hasNoLetters = text => !/\p{L}/u.test(text);
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Translation for ONE message, into the reader's language only. Ported
|
|
14
|
+
* verbatim from the web SDK (src/hooks/useMessageTranslation.ts).
|
|
15
|
+
*
|
|
16
|
+
* Pure and synchronous — no HTTP call. Every translation this client ever
|
|
17
|
+
* shows arrives over XMPP already: the sender tags outgoing messages with
|
|
18
|
+
* `<translate source="xx"/>` (see sendTextMessageWithTranslateTag) and
|
|
19
|
+
* whatever process attaches actual translations does so server-side,
|
|
20
|
+
* landing on `message.translations` when the stanza is parsed (see
|
|
21
|
+
* getDataFromXml). This function only ever reads that — it never calls a
|
|
22
|
+
* translation service itself, so there's nothing to fail when one isn't
|
|
23
|
+
* reachable, and nothing to await.
|
|
24
|
+
*/
|
|
25
|
+
const useMessageTranslation = (message, readerLocale, enabled = true) => {
|
|
26
|
+
const originalText = message?.body || '';
|
|
27
|
+
const source = message?.langSource;
|
|
28
|
+
const targetBase = (0, _strings.toBaseLanguage)(readerLocale || 'en');
|
|
29
|
+
const sourceBase = (0, _strings.toBaseLanguage)(source);
|
|
30
|
+
|
|
31
|
+
// Nothing to do when we don't know the source language, the message is
|
|
32
|
+
// already in the reader's language (region ignored: en-US vs en-CA is the
|
|
33
|
+
// same language, not a translation job), or there's no actual text to
|
|
34
|
+
// translate (a bare number, a phone number, an emoji-only reaction).
|
|
35
|
+
const trimmedText = originalText.trim();
|
|
36
|
+
const needsTranslation = enabled && !!trimmedText && !!source && sourceBase !== targetBase && !hasNoLetters(trimmedText);
|
|
37
|
+
const result = needsTranslation ? message?.translations?.[readerLocale || '']?.translatedText || message?.translations?.[targetBase]?.translatedText : undefined;
|
|
38
|
+
|
|
39
|
+
// A "translation" that's byte-identical to the original (mistagged
|
|
40
|
+
// langSource, a no-op from the source, matching proper nouns/numbers in
|
|
41
|
+
// otherwise-different text) is worse than nothing: it renders the same
|
|
42
|
+
// sentence twice. Treat identical-after-trim as "nothing to show".
|
|
43
|
+
const isRealTranslation = !!result && result.trim() !== originalText.trim();
|
|
44
|
+
return {
|
|
45
|
+
hasTranslation: isRealTranslation,
|
|
46
|
+
originalText,
|
|
47
|
+
displayText: isRealTranslation ? result : originalText
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
exports.useMessageTranslation = useMessageTranslation;
|
|
51
|
+
//# sourceMappingURL=useMessageTranslation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_strings","require","hasNoLetters","text","test","useMessageTranslation","message","readerLocale","enabled","originalText","body","source","langSource","targetBase","toBaseLanguage","sourceBase","trimmedText","trim","needsTranslation","result","translations","translatedText","undefined","isRealTranslation","hasTranslation","displayText","exports"],"sourceRoot":"../../../src","sources":["hooks/useMessageTranslation.ts"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAYA;AACA;AACA,MAAMC,YAAY,GAAIC,IAAY,IAAc,CAAC,QAAQ,CAACC,IAAI,CAACD,IAAI,CAAC;;AAEpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAME,qBAAqB,GAAGA,CACnCC,OAA+D,EAC/DC,YAAqB,EACrBC,OAAO,GAAG,IAAI,KACc;EAC5B,MAAMC,YAAY,GAAGH,OAAO,EAAEI,IAAI,IAAI,EAAE;EACxC,MAAMC,MAAM,GAAGL,OAAO,EAAEM,UAAU;EAClC,MAAMC,UAAU,GAAG,IAAAC,uBAAc,EAACP,YAAY,IAAI,IAAI,CAAC;EACvD,MAAMQ,UAAU,GAAG,IAAAD,uBAAc,EAACH,MAAM,CAAC;;EAEzC;EACA;EACA;EACA;EACA,MAAMK,WAAW,GAAGP,YAAY,CAACQ,IAAI,CAAC,CAAC;EACvC,MAAMC,gBAAgB,GACpBV,OAAO,IACP,CAAC,CAACQ,WAAW,IACb,CAAC,CAACL,MAAM,IACRI,UAAU,KAAKF,UAAU,IACzB,CAACX,YAAY,CAACc,WAAW,CAAC;EAE5B,MAAMG,MAAM,GAAGD,gBAAgB,GAC3BZ,OAAO,EAAEc,YAAY,GAAGb,YAAY,IAAI,EAAE,CAAC,EAAEc,cAAc,IAC3Df,OAAO,EAAEc,YAAY,GAAGP,UAAU,CAAC,EAAEQ,cAAc,GACnDC,SAAS;;EAEb;EACA;EACA;EACA;EACA,MAAMC,iBAAiB,GACrB,CAAC,CAACJ,MAAM,IAAIA,MAAM,CAACF,IAAI,CAAC,CAAC,KAAKR,YAAY,CAACQ,IAAI,CAAC,CAAC;EAEnD,OAAO;IACLO,cAAc,EAAED,iBAAiB;IACjCd,YAAY;IACZgB,WAAW,EAAEF,iBAAiB,GAAIJ,MAAM,GAAcV;EACxD,CAAC;AACH,CAAC;AAACiB,OAAA,CAAArB,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -11,6 +11,7 @@ var _pushSubscriptionService = require("../services/pushSubscriptionService");
|
|
|
11
11
|
var _reactRedux = require("react-redux");
|
|
12
12
|
var _useLocalStorage = require("./useLocalStorage");
|
|
13
13
|
var _roomsSlice = require("../roomStore/roomsSlice");
|
|
14
|
+
var _incomingCallFromPush = require("../helpers/incomingCallFromPush");
|
|
14
15
|
function usePushNotifications() {
|
|
15
16
|
const [fcmToken, setFcmToken] = (0, _react.useState)(null);
|
|
16
17
|
const [notification, setNotification] = (0, _react.useState)(null);
|
|
@@ -25,7 +26,11 @@ function usePushNotifications() {
|
|
|
25
26
|
get
|
|
26
27
|
} = (0, _useLocalStorage.useLocalStorage)('fcmToken');
|
|
27
28
|
const handleNotificationPress = remoteMessage => {
|
|
28
|
-
|
|
29
|
+
// Tapping a call notification (or launching the app from one) should
|
|
30
|
+
// land on the ring screen, not on the chat room.
|
|
31
|
+
if ((0, _incomingCallFromPush.handleCallPush)(remoteMessage?.data)) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
29
34
|
const jid = remoteMessage?.data?.jid || remoteMessage?.data?.chatJid || remoteMessage?.jid;
|
|
30
35
|
if (jid) {
|
|
31
36
|
dispatch((0, _roomsSlice.setPendingNotificationJid)(jid));
|
|
@@ -54,10 +59,15 @@ function usePushNotifications() {
|
|
|
54
59
|
// synchronous throw before the try-block ran would still leak.
|
|
55
60
|
initToken().catch(err => console.warn('[usePushNotifications] initToken rejected', err));
|
|
56
61
|
const unsubscribeForeground = (0, _pushNotifications.onForegroundMessage)(message => {
|
|
62
|
+
// Calls first: a call push must open the ring screen, never an
|
|
63
|
+
// "OK / Open" alert. handleCallPush returns true for anything
|
|
64
|
+
// call-shaped, so we bail before the chat-notification path.
|
|
65
|
+
if ((0, _incomingCallFromPush.handleCallPush)(message?.data)) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
57
68
|
setNotification(message);
|
|
58
69
|
const {
|
|
59
|
-
notification: notif
|
|
60
|
-
data
|
|
70
|
+
notification: notif
|
|
61
71
|
} = message;
|
|
62
72
|
if (notif) {
|
|
63
73
|
_reactNative.Alert.alert(notif.title || 'Notification', notif.body || '', [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactNative","_pushNotifications","_pushSubscriptionService","_reactRedux","_useLocalStorage","_roomsSlice","usePushNotifications","fcmToken","setFcmToken","useState","notification","setNotification","user","config","useSelector","state","chatSettingStore","rooms","dispatch","useDispatch","set","get","useLocalStorage","handleNotificationPress","remoteMessage","
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNative","_pushNotifications","_pushSubscriptionService","_reactRedux","_useLocalStorage","_roomsSlice","_incomingCallFromPush","usePushNotifications","fcmToken","setFcmToken","useState","notification","setNotification","user","config","useSelector","state","chatSettingStore","rooms","dispatch","useDispatch","set","get","useLocalStorage","handleNotificationPress","remoteMessage","handleCallPush","data","jid","chatJid","setPendingNotificationJid","console","warn","initToken","token","newToken","initPushNotifications","error","useEffect","catch","err","unsubscribeForeground","onForegroundMessage","message","notif","Alert","alert","title","body","text","onPress","unsubscribeOpened","onNotificationOpenedApp","log","JSON","stringify","getInitialNotification","then","xmppPassword","defaultWallet","walletAddress","pushSubscriptionService","subscribeToPush","projectName"],"sourceRoot":"../../../src","sources":["hooks/usePushNotifications.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,kBAAA,GAAAF,OAAA;AAMA,IAAAG,wBAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAEA,IAAAK,gBAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,qBAAA,GAAAP,OAAA;AAEO,SAASQ,oBAAoBA,CAAA,EAAG;EACrC,MAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAG,IAAAC,eAAQ,EAAgB,IAAI,CAAC;EAC7D,MAAM,CAACC,YAAY,EAAEC,eAAe,CAAC,GAAG,IAAAF,eAAQ,EAAM,IAAI,CAAC;EAC3D,MAAM;IAAEG,IAAI;IAAEC;EAAO,CAAC,GAAG,IAAAC,uBAAW,EAAEC,KAAgB,IAAKA,KAAK,CAACC,gBAAgB,CAAC;EAClF,MAAMC,KAAK,GAAG,IAAAH,uBAAW,EAAEC,KAAgB,IAAKA,KAAK,CAACE,KAAK,CAACA,KAAK,CAAC;EAClE,MAAMC,QAAQ,GAAG,IAAAC,uBAAW,EAAC,CAAC;EAE9B,MAAM;IAAEC,GAAG;IAAEC;EAAI,CAAC,GAAG,IAAAC,gCAAe,EAAC,UAAU,CAAC;EAEhD,MAAMC,uBAAuB,GAAIC,aAAkB,IAAK;IACtD;IACA;IACA,IAAI,IAAAC,oCAAc,EAACD,aAAa,EAAEE,IAAI,CAAC,EAAE;MACvC;IACF;IAEA,MAAMC,GAAG,GAAGH,aAAa,EAAEE,IAAI,EAAEC,GAAG,IAAIH,aAAa,EAAEE,IAAI,EAAEE,OAAO,IAAIJ,aAAa,EAAEG,GAAG;IAE1F,IAAIA,GAAG,EA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