@ethora/chat-component-rn 26.10.10 → 26.10.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 +16 -0
- package/README.md +125 -0
- package/lib/commonjs/booking/index.js +44 -0
- package/lib/commonjs/booking/index.js.map +1 -0
- package/lib/commonjs/booking/pendingScheduledCall.js +275 -0
- package/lib/commonjs/booking/pendingScheduledCall.js.map +1 -0
- package/lib/commonjs/booking/scheduleForm.js +91 -0
- package/lib/commonjs/booking/scheduleForm.js.map +1 -0
- package/lib/commonjs/booking/scheduledCall.js +141 -0
- package/lib/commonjs/booking/scheduledCall.js.map +1 -0
- package/lib/commonjs/booking/scheduledCallActions.js +128 -0
- package/lib/commonjs/booking/scheduledCallActions.js.map +1 -0
- package/lib/commonjs/booking/scheduledCallLink.js +143 -0
- package/lib/commonjs/booking/scheduledCallLink.js.map +1 -0
- package/lib/commonjs/booking/scheduledCallStore.js +64 -0
- package/lib/commonjs/booking/scheduledCallStore.js.map +1 -0
- package/lib/commonjs/booking/startRoomCall.js +84 -0
- package/lib/commonjs/booking/startRoomCall.js.map +1 -0
- package/lib/commonjs/calls/callBusy.js +18 -0
- package/lib/commonjs/calls/callBusy.js.map +1 -0
- package/lib/commonjs/calls/callDisplay.js +73 -0
- package/lib/commonjs/calls/callDisplay.js.map +1 -0
- package/lib/commonjs/calls/callMode.js +175 -0
- package/lib/commonjs/calls/callMode.js.map +1 -0
- package/lib/commonjs/calls/declineReport.js +20 -0
- package/lib/commonjs/calls/declineReport.js.map +1 -0
- package/lib/commonjs/calls/p2p/P2PCallController.js +724 -0
- package/lib/commonjs/calls/p2p/P2PCallController.js.map +1 -0
- package/lib/commonjs/calls/p2p/icePolicy.js +107 -0
- package/lib/commonjs/calls/p2p/icePolicy.js.map +1 -0
- package/lib/commonjs/calls/p2p/negotiator.js +202 -0
- package/lib/commonjs/calls/p2p/negotiator.js.map +1 -0
- package/lib/commonjs/calls/p2p/p2pRuntime.js +147 -0
- package/lib/commonjs/calls/p2p/p2pRuntime.js.map +1 -0
- package/lib/commonjs/calls/p2p/signalInbox.js +98 -0
- package/lib/commonjs/calls/p2p/signalInbox.js.map +1 -0
- package/lib/commonjs/calls/p2p/signalStanza.js +141 -0
- package/lib/commonjs/calls/p2p/signalStanza.js.map +1 -0
- package/lib/commonjs/calls/p2p/webrtcRuntime.js +53 -0
- package/lib/commonjs/calls/p2p/webrtcRuntime.js.map +1 -0
- package/lib/commonjs/calls/senderTrust.js +43 -0
- package/lib/commonjs/calls/senderTrust.js.map +1 -0
- package/lib/commonjs/calls/startCall.js +51 -0
- package/lib/commonjs/calls/startCall.js.map +1 -0
- package/lib/commonjs/components/Booking/BookingIcons.js +55 -0
- package/lib/commonjs/components/Booking/BookingIcons.js.map +1 -0
- package/lib/commonjs/components/Booking/ScheduleCallButton.js +64 -0
- package/lib/commonjs/components/Booking/ScheduleCallButton.js.map +1 -0
- package/lib/commonjs/components/Booking/ScheduleCallSheet.js +351 -0
- package/lib/commonjs/components/Booking/ScheduleCallSheet.js.map +1 -0
- package/lib/commonjs/components/Booking/ScheduledCallCard.js +203 -0
- package/lib/commonjs/components/Booking/ScheduledCallCard.js.map +1 -0
- package/lib/commonjs/components/Booking/ScheduledCallHost.js +23 -0
- package/lib/commonjs/components/Booking/ScheduledCallHost.js.map +1 -0
- package/lib/commonjs/components/Booking/ScheduledCallMessage.js +55 -0
- package/lib/commonjs/components/Booking/ScheduledCallMessage.js.map +1 -0
- package/lib/commonjs/components/Booking/ScheduledCallPreJoin.js +235 -0
- package/lib/commonjs/components/Booking/ScheduledCallPreJoin.js.map +1 -0
- package/lib/commonjs/components/Booking/bookingShared.js +305 -0
- package/lib/commonjs/components/Booking/bookingShared.js.map +1 -0
- package/lib/commonjs/components/MainComponents/ChatHeader.js +2 -1
- package/lib/commonjs/components/MainComponents/ChatHeader.js.map +1 -1
- package/lib/commonjs/components/MainComponents/LanguageSelectorButton.js +5 -2
- package/lib/commonjs/components/MainComponents/LanguageSelectorButton.js.map +1 -1
- package/lib/commonjs/components/MainComponents/LanguageSelectorModal.js +6 -3
- package/lib/commonjs/components/MainComponents/LanguageSelectorModal.js.map +1 -1
- package/lib/commonjs/components/MainComponents/MessageContainer.js +13 -0
- package/lib/commonjs/components/MainComponents/MessageContainer.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ReduxWrapper.js +10 -0
- package/lib/commonjs/components/MainComponents/ReduxWrapper.js.map +1 -1
- package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js +19 -15
- package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js.map +1 -1
- package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js +15 -8
- package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
- package/lib/commonjs/components/Modals/UserSettingsModal/LanguageCard.js +1 -1
- package/lib/commonjs/components/Modals/UserSettingsModal/LanguageCard.js.map +1 -1
- package/lib/commonjs/components/VideoCalls/ActiveCallBar.js +3 -2
- package/lib/commonjs/components/VideoCalls/ActiveCallBar.js.map +1 -1
- package/lib/commonjs/components/VideoCalls/CallButtons.js +19 -11
- package/lib/commonjs/components/VideoCalls/CallButtons.js.map +1 -1
- package/lib/commonjs/components/VideoCalls/CallControlBar.js +119 -0
- package/lib/commonjs/components/VideoCalls/CallControlBar.js.map +1 -0
- package/lib/commonjs/components/VideoCalls/CallVideo.js +49 -0
- package/lib/commonjs/components/VideoCalls/CallVideo.js.map +1 -0
- package/lib/commonjs/components/VideoCalls/GroupCallView.js +281 -0
- package/lib/commonjs/components/VideoCalls/GroupCallView.js.map +1 -0
- package/lib/commonjs/components/VideoCalls/P2PCallRunner.js +151 -0
- package/lib/commonjs/components/VideoCalls/P2PCallRunner.js.map +1 -0
- package/lib/commonjs/components/VideoCalls/VideoCallOverlay.js +38 -14
- package/lib/commonjs/components/VideoCalls/VideoCallOverlay.js.map +1 -1
- package/lib/commonjs/components/VideoCalls/VideoCallSession.js +57 -128
- package/lib/commonjs/components/VideoCalls/VideoCallSession.js.map +1 -1
- package/lib/commonjs/components/VideoCalls/callActions.js +3 -0
- package/lib/commonjs/components/VideoCalls/callActions.js.map +1 -1
- package/lib/commonjs/components/VideoCalls/callElapsed.js +38 -0
- package/lib/commonjs/components/VideoCalls/callElapsed.js.map +1 -0
- package/lib/commonjs/components/VideoCalls/callLive.js +15 -0
- package/lib/commonjs/components/VideoCalls/callLive.js.map +1 -0
- package/lib/commonjs/components/VideoCalls/callSessionController.js +81 -24
- package/lib/commonjs/components/VideoCalls/callSessionController.js.map +1 -1
- package/lib/commonjs/components/VideoCalls/callSessionTypes.js +41 -0
- package/lib/commonjs/components/VideoCalls/callSessionTypes.js.map +1 -0
- package/lib/commonjs/components/VideoCalls/groupLayout.js +43 -0
- package/lib/commonjs/components/VideoCalls/groupLayout.js.map +1 -0
- package/lib/commonjs/components/VideoCalls/p2pCallSession.js +272 -0
- package/lib/commonjs/components/VideoCalls/p2pCallSession.js.map +1 -0
- package/lib/commonjs/components/VideoCalls/useCallKeep.js +7 -2
- package/lib/commonjs/components/VideoCalls/useCallKeep.js.map +1 -1
- package/lib/commonjs/components/VideoCalls/useOngoingCallNotification.js +2 -1
- package/lib/commonjs/components/VideoCalls/useOngoingCallNotification.js.map +1 -1
- package/lib/commonjs/context/xmppProvider.js +2 -1
- package/lib/commonjs/context/xmppProvider.js.map +1 -1
- package/lib/commonjs/helpers/callPush.js +3 -1
- package/lib/commonjs/helpers/callPush.js.map +1 -1
- package/lib/commonjs/helpers/incomingCallFromPush.js +63 -7
- package/lib/commonjs/helpers/incomingCallFromPush.js.map +1 -1
- package/lib/commonjs/helpers/pushPayload.js +5 -0
- package/lib/commonjs/helpers/pushPayload.js.map +1 -1
- package/lib/commonjs/helpers/reportRoom.js +76 -0
- package/lib/commonjs/helpers/reportRoom.js.map +1 -0
- package/lib/commonjs/i18n/strings.js +444 -0
- package/lib/commonjs/i18n/strings.js.map +1 -1
- package/lib/commonjs/main.js +93 -0
- package/lib/commonjs/main.js.map +1 -1
- package/lib/commonjs/networking/api-requests/callState.api.js +75 -0
- package/lib/commonjs/networking/api-requests/callState.api.js.map +1 -0
- package/lib/commonjs/networking/api-requests/push.api.js +29 -6
- package/lib/commonjs/networking/api-requests/push.api.js.map +1 -1
- package/lib/commonjs/networking/api-requests/rooms.api.js +8 -2
- package/lib/commonjs/networking/api-requests/rooms.api.js.map +1 -1
- package/lib/commonjs/networking/api-requests/scheduledCalls.api.js +141 -0
- package/lib/commonjs/networking/api-requests/scheduledCalls.api.js.map +1 -0
- package/lib/commonjs/networking/callTokenStanza.js +210 -50
- package/lib/commonjs/networking/callTokenStanza.js.map +1 -1
- package/lib/commonjs/roomStore/callSlice.js +59 -4
- package/lib/commonjs/roomStore/callSlice.js.map +1 -1
- package/lib/commonjs/services/appBadge.js +80 -0
- package/lib/commonjs/services/appBadge.js.map +1 -0
- package/lib/commonjs/services/languageSettings.js +47 -15
- package/lib/commonjs/services/languageSettings.js.map +1 -1
- package/lib/commonjs/services/pushRegistration.js +21 -5
- package/lib/commonjs/services/pushRegistration.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/module/booking/index.js +5 -0
- package/lib/module/booking/index.js.map +1 -0
- package/lib/module/booking/pendingScheduledCall.js +261 -0
- package/lib/module/booking/pendingScheduledCall.js.map +1 -0
- package/lib/module/booking/scheduleForm.js +79 -0
- package/lib/module/booking/scheduleForm.js.map +1 -0
- package/lib/module/booking/scheduledCall.js +129 -0
- package/lib/module/booking/scheduledCall.js.map +1 -0
- package/lib/module/booking/scheduledCallActions.js +118 -0
- package/lib/module/booking/scheduledCallActions.js.map +1 -0
- package/lib/module/booking/scheduledCallLink.js +136 -0
- package/lib/module/booking/scheduledCallLink.js.map +1 -0
- package/lib/module/booking/scheduledCallStore.js +60 -0
- package/lib/module/booking/scheduledCallStore.js.map +1 -0
- package/lib/module/booking/startRoomCall.js +80 -0
- package/lib/module/booking/startRoomCall.js.map +1 -0
- package/lib/module/calls/callBusy.js +13 -0
- package/lib/module/calls/callBusy.js.map +1 -0
- package/lib/module/calls/callDisplay.js +65 -0
- package/lib/module/calls/callDisplay.js.map +1 -0
- package/lib/module/calls/callMode.js +168 -0
- package/lib/module/calls/callMode.js.map +1 -0
- package/lib/module/calls/declineReport.js +16 -0
- package/lib/module/calls/declineReport.js.map +1 -0
- package/lib/module/calls/p2p/P2PCallController.js +718 -0
- package/lib/module/calls/p2p/P2PCallController.js.map +1 -0
- package/lib/module/calls/p2p/icePolicy.js +102 -0
- package/lib/module/calls/p2p/icePolicy.js.map +1 -0
- package/lib/module/calls/p2p/negotiator.js +197 -0
- package/lib/module/calls/p2p/negotiator.js.map +1 -0
- package/lib/module/calls/p2p/p2pRuntime.js +137 -0
- package/lib/module/calls/p2p/p2pRuntime.js.map +1 -0
- package/lib/module/calls/p2p/signalInbox.js +93 -0
- package/lib/module/calls/p2p/signalInbox.js.map +1 -0
- package/lib/module/calls/p2p/signalStanza.js +135 -0
- package/lib/module/calls/p2p/signalStanza.js.map +1 -0
- package/lib/module/calls/p2p/webrtcRuntime.js +46 -0
- package/lib/module/calls/p2p/webrtcRuntime.js.map +1 -0
- package/lib/module/calls/senderTrust.js +38 -0
- package/lib/module/calls/senderTrust.js.map +1 -0
- package/lib/module/calls/startCall.js +47 -0
- package/lib/module/calls/startCall.js.map +1 -0
- package/lib/module/components/Booking/BookingIcons.js +48 -0
- package/lib/module/components/Booking/BookingIcons.js.map +1 -0
- package/lib/module/components/Booking/ScheduleCallButton.js +59 -0
- package/lib/module/components/Booking/ScheduleCallButton.js.map +1 -0
- package/lib/module/components/Booking/ScheduleCallSheet.js +345 -0
- package/lib/module/components/Booking/ScheduleCallSheet.js.map +1 -0
- package/lib/module/components/Booking/ScheduledCallCard.js +197 -0
- package/lib/module/components/Booking/ScheduledCallCard.js.map +1 -0
- package/lib/module/components/Booking/ScheduledCallHost.js +18 -0
- package/lib/module/components/Booking/ScheduledCallHost.js.map +1 -0
- package/lib/module/components/Booking/ScheduledCallMessage.js +48 -0
- package/lib/module/components/Booking/ScheduledCallMessage.js.map +1 -0
- package/lib/module/components/Booking/ScheduledCallPreJoin.js +229 -0
- package/lib/module/components/Booking/ScheduledCallPreJoin.js.map +1 -0
- package/lib/module/components/Booking/bookingShared.js +291 -0
- package/lib/module/components/Booking/bookingShared.js.map +1 -0
- package/lib/module/components/MainComponents/ChatHeader.js +2 -1
- package/lib/module/components/MainComponents/ChatHeader.js.map +1 -1
- package/lib/module/components/MainComponents/LanguageSelectorButton.js +5 -2
- package/lib/module/components/MainComponents/LanguageSelectorButton.js.map +1 -1
- package/lib/module/components/MainComponents/LanguageSelectorModal.js +7 -4
- package/lib/module/components/MainComponents/LanguageSelectorModal.js.map +1 -1
- package/lib/module/components/MainComponents/MessageContainer.js +13 -0
- package/lib/module/components/MainComponents/MessageContainer.js.map +1 -1
- package/lib/module/components/MainComponents/ReduxWrapper.js +10 -0
- package/lib/module/components/MainComponents/ReduxWrapper.js.map +1 -1
- package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js +21 -15
- package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js.map +1 -1
- package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js +17 -10
- package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
- package/lib/module/components/Modals/UserSettingsModal/LanguageCard.js +1 -1
- package/lib/module/components/Modals/UserSettingsModal/LanguageCard.js.map +1 -1
- package/lib/module/components/VideoCalls/ActiveCallBar.js +3 -2
- package/lib/module/components/VideoCalls/ActiveCallBar.js.map +1 -1
- package/lib/module/components/VideoCalls/CallButtons.js +19 -11
- package/lib/module/components/VideoCalls/CallButtons.js.map +1 -1
- package/lib/module/components/VideoCalls/CallControlBar.js +113 -0
- package/lib/module/components/VideoCalls/CallControlBar.js.map +1 -0
- package/lib/module/components/VideoCalls/CallVideo.js +43 -0
- package/lib/module/components/VideoCalls/CallVideo.js.map +1 -0
- package/lib/module/components/VideoCalls/GroupCallView.js +275 -0
- package/lib/module/components/VideoCalls/GroupCallView.js.map +1 -0
- package/lib/module/components/VideoCalls/P2PCallRunner.js +147 -0
- package/lib/module/components/VideoCalls/P2PCallRunner.js.map +1 -0
- package/lib/module/components/VideoCalls/VideoCallOverlay.js +38 -14
- package/lib/module/components/VideoCalls/VideoCallOverlay.js.map +1 -1
- package/lib/module/components/VideoCalls/VideoCallSession.js +46 -127
- package/lib/module/components/VideoCalls/VideoCallSession.js.map +1 -1
- package/lib/module/components/VideoCalls/callActions.js +3 -0
- package/lib/module/components/VideoCalls/callActions.js.map +1 -1
- package/lib/module/components/VideoCalls/callElapsed.js +33 -0
- package/lib/module/components/VideoCalls/callElapsed.js.map +1 -0
- package/lib/module/components/VideoCalls/callLive.js +10 -0
- package/lib/module/components/VideoCalls/callLive.js.map +1 -0
- package/lib/module/components/VideoCalls/callSessionController.js +80 -24
- package/lib/module/components/VideoCalls/callSessionController.js.map +1 -1
- package/lib/module/components/VideoCalls/callSessionTypes.js +37 -0
- package/lib/module/components/VideoCalls/callSessionTypes.js.map +1 -0
- package/lib/module/components/VideoCalls/groupLayout.js +36 -0
- package/lib/module/components/VideoCalls/groupLayout.js.map +1 -0
- package/lib/module/components/VideoCalls/p2pCallSession.js +256 -0
- package/lib/module/components/VideoCalls/p2pCallSession.js.map +1 -0
- package/lib/module/components/VideoCalls/useCallKeep.js +8 -2
- package/lib/module/components/VideoCalls/useCallKeep.js.map +1 -1
- package/lib/module/components/VideoCalls/useOngoingCallNotification.js +2 -1
- package/lib/module/components/VideoCalls/useOngoingCallNotification.js.map +1 -1
- package/lib/module/context/xmppProvider.js +2 -1
- package/lib/module/context/xmppProvider.js.map +1 -1
- package/lib/module/helpers/callPush.js +3 -1
- package/lib/module/helpers/callPush.js.map +1 -1
- package/lib/module/helpers/incomingCallFromPush.js +63 -7
- package/lib/module/helpers/incomingCallFromPush.js.map +1 -1
- package/lib/module/helpers/pushPayload.js +5 -0
- package/lib/module/helpers/pushPayload.js.map +1 -1
- package/lib/module/helpers/reportRoom.js +70 -0
- package/lib/module/helpers/reportRoom.js.map +1 -0
- package/lib/module/i18n/strings.js +444 -0
- package/lib/module/i18n/strings.js.map +1 -1
- package/lib/module/main.js +5 -0
- package/lib/module/main.js.map +1 -1
- package/lib/module/networking/api-requests/callState.api.js +66 -0
- package/lib/module/networking/api-requests/callState.api.js.map +1 -0
- package/lib/module/networking/api-requests/push.api.js +29 -6
- package/lib/module/networking/api-requests/push.api.js.map +1 -1
- package/lib/module/networking/api-requests/rooms.api.js +8 -2
- package/lib/module/networking/api-requests/rooms.api.js.map +1 -1
- package/lib/module/networking/api-requests/scheduledCalls.api.js +130 -0
- package/lib/module/networking/api-requests/scheduledCalls.api.js.map +1 -0
- package/lib/module/networking/callTokenStanza.js +210 -50
- package/lib/module/networking/callTokenStanza.js.map +1 -1
- package/lib/module/roomStore/callSlice.js +57 -3
- package/lib/module/roomStore/callSlice.js.map +1 -1
- package/lib/module/services/appBadge.js +74 -0
- package/lib/module/services/appBadge.js.map +1 -0
- package/lib/module/services/languageSettings.js +44 -13
- package/lib/module/services/languageSettings.js.map +1 -1
- package/lib/module/services/pushRegistration.js +21 -5
- package/lib/module/services/pushRegistration.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/booking/index.d.ts +3 -0
- package/lib/typescript/booking/index.d.ts.map +1 -0
- package/lib/typescript/booking/pendingScheduledCall.d.ts +80 -0
- package/lib/typescript/booking/pendingScheduledCall.d.ts.map +1 -0
- package/lib/typescript/booking/scheduleForm.d.ts +28 -0
- package/lib/typescript/booking/scheduleForm.d.ts.map +1 -0
- package/lib/typescript/booking/scheduledCall.d.ts +52 -0
- package/lib/typescript/booking/scheduledCall.d.ts.map +1 -0
- package/lib/typescript/booking/scheduledCallActions.d.ts +22 -0
- package/lib/typescript/booking/scheduledCallActions.d.ts.map +1 -0
- package/lib/typescript/booking/scheduledCallLink.d.ts +37 -0
- package/lib/typescript/booking/scheduledCallLink.d.ts.map +1 -0
- package/lib/typescript/booking/scheduledCallStore.d.ts +47 -0
- package/lib/typescript/booking/scheduledCallStore.d.ts.map +1 -0
- package/lib/typescript/booking/startRoomCall.d.ts +12 -0
- package/lib/typescript/booking/startRoomCall.d.ts.map +1 -0
- package/lib/typescript/calls/callBusy.d.ts +9 -0
- package/lib/typescript/calls/callBusy.d.ts.map +1 -0
- package/lib/typescript/calls/callDisplay.d.ts +23 -0
- package/lib/typescript/calls/callDisplay.d.ts.map +1 -0
- package/lib/typescript/calls/callMode.d.ts +106 -0
- package/lib/typescript/calls/callMode.d.ts.map +1 -0
- package/lib/typescript/calls/declineReport.d.ts +11 -0
- package/lib/typescript/calls/declineReport.d.ts.map +1 -0
- package/lib/typescript/calls/p2p/P2PCallController.d.ts +150 -0
- package/lib/typescript/calls/p2p/P2PCallController.d.ts.map +1 -0
- package/lib/typescript/calls/p2p/icePolicy.d.ts +37 -0
- package/lib/typescript/calls/p2p/icePolicy.d.ts.map +1 -0
- package/lib/typescript/calls/p2p/negotiator.d.ts +57 -0
- package/lib/typescript/calls/p2p/negotiator.d.ts.map +1 -0
- package/lib/typescript/calls/p2p/p2pRuntime.d.ts +41 -0
- package/lib/typescript/calls/p2p/p2pRuntime.d.ts.map +1 -0
- package/lib/typescript/calls/p2p/signalInbox.d.ts +35 -0
- package/lib/typescript/calls/p2p/signalInbox.d.ts.map +1 -0
- package/lib/typescript/calls/p2p/signalStanza.d.ts +52 -0
- package/lib/typescript/calls/p2p/signalStanza.d.ts.map +1 -0
- package/lib/typescript/calls/p2p/webrtcRuntime.d.ts +32 -0
- package/lib/typescript/calls/p2p/webrtcRuntime.d.ts.map +1 -0
- package/lib/typescript/calls/senderTrust.d.ts +8 -0
- package/lib/typescript/calls/senderTrust.d.ts.map +1 -0
- package/lib/typescript/calls/startCall.d.ts +17 -0
- package/lib/typescript/calls/startCall.d.ts.map +1 -0
- package/lib/typescript/components/Booking/BookingIcons.d.ts +9 -0
- package/lib/typescript/components/Booking/BookingIcons.d.ts.map +1 -0
- package/lib/typescript/components/Booking/ScheduleCallButton.d.ts +11 -0
- package/lib/typescript/components/Booking/ScheduleCallButton.d.ts.map +1 -0
- package/lib/typescript/components/Booking/ScheduleCallSheet.d.ts +4 -0
- package/lib/typescript/components/Booking/ScheduleCallSheet.d.ts.map +1 -0
- package/lib/typescript/components/Booking/ScheduledCallCard.d.ts +14 -0
- package/lib/typescript/components/Booking/ScheduledCallCard.d.ts.map +1 -0
- package/lib/typescript/components/Booking/ScheduledCallHost.d.ts +10 -0
- package/lib/typescript/components/Booking/ScheduledCallHost.d.ts.map +1 -0
- package/lib/typescript/components/Booking/ScheduledCallMessage.d.ts +20 -0
- package/lib/typescript/components/Booking/ScheduledCallMessage.d.ts.map +1 -0
- package/lib/typescript/components/Booking/ScheduledCallPreJoin.d.ts +8 -0
- package/lib/typescript/components/Booking/ScheduledCallPreJoin.d.ts.map +1 -0
- package/lib/typescript/components/Booking/bookingShared.d.ts +199 -0
- package/lib/typescript/components/Booking/bookingShared.d.ts.map +1 -0
- package/lib/typescript/components/MainComponents/ChatHeader.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/LanguageSelectorButton.d.ts +3 -1
- package/lib/typescript/components/MainComponents/LanguageSelectorButton.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/LanguageSelectorModal.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/MessageContainer.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/ReduxWrapper.d.ts.map +1 -1
- package/lib/typescript/components/Modals/ChatProfileModal/ReportChatModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/UserSettingsModal/LanguageCard.d.ts.map +1 -1
- package/lib/typescript/components/VideoCalls/ActiveCallBar.d.ts.map +1 -1
- package/lib/typescript/components/VideoCalls/CallButtons.d.ts +2 -1
- package/lib/typescript/components/VideoCalls/CallButtons.d.ts.map +1 -1
- package/lib/typescript/components/VideoCalls/CallControlBar.d.ts +17 -0
- package/lib/typescript/components/VideoCalls/CallControlBar.d.ts.map +1 -0
- package/lib/typescript/components/VideoCalls/CallVideo.d.ts +23 -0
- package/lib/typescript/components/VideoCalls/CallVideo.d.ts.map +1 -0
- package/lib/typescript/components/VideoCalls/GroupCallView.d.ts +22 -0
- package/lib/typescript/components/VideoCalls/GroupCallView.d.ts.map +1 -0
- package/lib/typescript/components/VideoCalls/P2PCallRunner.d.ts +2 -0
- package/lib/typescript/components/VideoCalls/P2PCallRunner.d.ts.map +1 -0
- package/lib/typescript/components/VideoCalls/VideoCallOverlay.d.ts.map +1 -1
- package/lib/typescript/components/VideoCalls/VideoCallSession.d.ts +10 -12
- package/lib/typescript/components/VideoCalls/VideoCallSession.d.ts.map +1 -1
- package/lib/typescript/components/VideoCalls/callActions.d.ts.map +1 -1
- package/lib/typescript/components/VideoCalls/callElapsed.d.ts +8 -0
- package/lib/typescript/components/VideoCalls/callElapsed.d.ts.map +1 -0
- package/lib/typescript/components/VideoCalls/callLive.d.ts +9 -0
- package/lib/typescript/components/VideoCalls/callLive.d.ts.map +1 -0
- package/lib/typescript/components/VideoCalls/callSessionController.d.ts +10 -31
- package/lib/typescript/components/VideoCalls/callSessionController.d.ts.map +1 -1
- package/lib/typescript/components/VideoCalls/callSessionTypes.d.ts +60 -0
- package/lib/typescript/components/VideoCalls/callSessionTypes.d.ts.map +1 -0
- package/lib/typescript/components/VideoCalls/groupLayout.d.ts +23 -0
- package/lib/typescript/components/VideoCalls/groupLayout.d.ts.map +1 -0
- package/lib/typescript/components/VideoCalls/p2pCallSession.d.ts +31 -0
- package/lib/typescript/components/VideoCalls/p2pCallSession.d.ts.map +1 -0
- package/lib/typescript/components/VideoCalls/useCallKeep.d.ts.map +1 -1
- package/lib/typescript/components/VideoCalls/useOngoingCallNotification.d.ts.map +1 -1
- package/lib/typescript/context/xmppProvider.d.ts.map +1 -1
- package/lib/typescript/helpers/callPush.d.ts +11 -1
- package/lib/typescript/helpers/callPush.d.ts.map +1 -1
- package/lib/typescript/helpers/incomingCallFromPush.d.ts.map +1 -1
- package/lib/typescript/helpers/pushPayload.d.ts +1 -1
- package/lib/typescript/helpers/pushPayload.d.ts.map +1 -1
- package/lib/typescript/helpers/reportRoom.d.ts +19 -0
- package/lib/typescript/helpers/reportRoom.d.ts.map +1 -0
- package/lib/typescript/i18n/strings.d.ts.map +1 -1
- package/lib/typescript/main.d.ts +6 -1
- package/lib/typescript/main.d.ts.map +1 -1
- package/lib/typescript/networking/api-requests/callState.api.d.ts +25 -0
- package/lib/typescript/networking/api-requests/callState.api.d.ts.map +1 -0
- package/lib/typescript/networking/api-requests/push.api.d.ts +9 -2
- package/lib/typescript/networking/api-requests/push.api.d.ts.map +1 -1
- package/lib/typescript/networking/api-requests/rooms.api.d.ts +2 -1
- package/lib/typescript/networking/api-requests/rooms.api.d.ts.map +1 -1
- package/lib/typescript/networking/api-requests/scheduledCalls.api.d.ts +86 -0
- package/lib/typescript/networking/api-requests/scheduledCalls.api.d.ts.map +1 -0
- package/lib/typescript/networking/callTokenStanza.d.ts.map +1 -1
- package/lib/typescript/roomStore/callSlice.d.ts +23 -1
- package/lib/typescript/roomStore/callSlice.d.ts.map +1 -1
- package/lib/typescript/services/appBadge.d.ts +3 -0
- package/lib/typescript/services/appBadge.d.ts.map +1 -0
- package/lib/typescript/services/languageSettings.d.ts +7 -0
- package/lib/typescript/services/languageSettings.d.ts.map +1 -1
- package/lib/typescript/services/pushRegistration.d.ts.map +1 -1
- package/lib/typescript/types/types.d.ts +67 -4
- package/lib/typescript/types/types.d.ts.map +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/booking/index.ts +10 -0
- package/src/booking/pendingScheduledCall.ts +272 -0
- package/src/booking/scheduleForm.ts +84 -0
- package/src/booking/scheduledCall.ts +163 -0
- package/src/booking/scheduledCallActions.ts +141 -0
- package/src/booking/scheduledCallLink.ts +145 -0
- package/src/booking/scheduledCallStore.ts +69 -0
- package/src/booking/startRoomCall.ts +103 -0
- package/src/calls/callBusy.ts +10 -0
- package/src/calls/callDisplay.ts +74 -0
- package/src/calls/callMode.ts +286 -0
- package/src/calls/declineReport.ts +16 -0
- package/src/calls/p2p/P2PCallController.ts +813 -0
- package/src/calls/p2p/icePolicy.ts +99 -0
- package/src/calls/p2p/negotiator.ts +186 -0
- package/src/calls/p2p/p2pRuntime.ts +164 -0
- package/src/calls/p2p/signalInbox.ts +117 -0
- package/src/calls/p2p/signalStanza.ts +205 -0
- package/src/calls/p2p/webrtcRuntime.ts +60 -0
- package/src/calls/senderTrust.ts +40 -0
- package/src/calls/startCall.ts +56 -0
- package/src/components/Booking/BookingIcons.tsx +44 -0
- package/src/components/Booking/ScheduleCallButton.tsx +66 -0
- package/src/components/Booking/ScheduleCallSheet.tsx +380 -0
- package/src/components/Booking/ScheduledCallCard.tsx +216 -0
- package/src/components/Booking/ScheduledCallHost.tsx +18 -0
- package/src/components/Booking/ScheduledCallMessage.tsx +62 -0
- package/src/components/Booking/ScheduledCallPreJoin.tsx +230 -0
- package/src/components/Booking/bookingShared.tsx +295 -0
- package/src/components/MainComponents/ChatHeader.tsx +2 -0
- package/src/components/MainComponents/LanguageSelectorButton.tsx +9 -2
- package/src/components/MainComponents/LanguageSelectorModal.tsx +10 -6
- package/src/components/MainComponents/MessageContainer.tsx +15 -0
- package/src/components/MainComponents/ReduxWrapper.tsx +10 -0
- package/src/components/Modals/ChatProfileModal/ReportChatModal.tsx +22 -22
- package/src/components/Modals/UserProfileModal/UserProfileModal.tsx +28 -9
- package/src/components/Modals/UserSettingsModal/LanguageCard.tsx +9 -7
- package/src/components/VideoCalls/ActiveCallBar.tsx +6 -5
- package/src/components/VideoCalls/CallButtons.tsx +23 -12
- package/src/components/VideoCalls/CallControlBar.tsx +131 -0
- package/src/components/VideoCalls/CallVideo.tsx +59 -0
- package/src/components/VideoCalls/GroupCallView.tsx +324 -0
- package/src/components/VideoCalls/P2PCallRunner.tsx +192 -0
- package/src/components/VideoCalls/VideoCallOverlay.tsx +62 -17
- package/src/components/VideoCalls/VideoCallSession.tsx +55 -133
- package/src/components/VideoCalls/callActions.ts +3 -0
- package/src/components/VideoCalls/callElapsed.ts +27 -0
- package/src/components/VideoCalls/callLive.ts +13 -0
- package/src/components/VideoCalls/callSessionController.ts +130 -55
- package/src/components/VideoCalls/callSessionTypes.ts +80 -0
- package/src/components/VideoCalls/groupLayout.ts +48 -0
- package/src/components/VideoCalls/p2pCallSession.ts +291 -0
- package/src/components/VideoCalls/useCallKeep.ts +9 -2
- package/src/components/VideoCalls/useOngoingCallNotification.ts +2 -2
- package/src/context/xmppProvider.tsx +3 -0
- package/src/helpers/callPush.ts +13 -1
- package/src/helpers/incomingCallFromPush.ts +65 -7
- package/src/helpers/pushPayload.ts +9 -1
- package/src/helpers/reportRoom.ts +93 -0
- package/src/i18n/strings.ts +444 -0
- package/src/main.ts +33 -0
- package/src/networking/api-requests/callState.api.ts +83 -0
- package/src/networking/api-requests/push.api.ts +28 -3
- package/src/networking/api-requests/rooms.api.ts +12 -3
- package/src/networking/api-requests/scheduledCalls.api.ts +232 -0
- package/src/networking/callTokenStanza.ts +247 -50
- package/src/roomStore/callSlice.ts +86 -2
- package/src/services/appBadge.ts +85 -0
- package/src/services/languageSettings.ts +43 -8
- package/src/services/pushRegistration.ts +34 -3
- package/src/types/types.ts +70 -4
- package/src/version.ts +1 -1
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { store } from '../../roomStore';
|
|
2
|
+
import http from '../apiClient';
|
|
3
|
+
import { ethoraLogger } from '../../helpers/ethoraLogger';
|
|
4
|
+
import { IceServerConfig, normalizeIceServers } from '../../calls/callMode';
|
|
5
|
+
|
|
6
|
+
// REST side of P2P calls. A P2P call never touches LiveKit, so there is no
|
|
7
|
+
// LiveKit webhook to tell the server what happened: the clients report it.
|
|
8
|
+
// Every report is fire and forget (the UI never waits on it and a failure is
|
|
9
|
+
// only logged), and none of them may be sent for LiveKit calls (the server
|
|
10
|
+
// answers 409 CALL_NOT_P2P).
|
|
11
|
+
|
|
12
|
+
const authHeaders = () => ({
|
|
13
|
+
headers: { Authorization: store.getState().chatSettingStore.user?.token || '' },
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
type CallStateReport = 'ringing' | 'decline' | 'connected' | 'end';
|
|
17
|
+
|
|
18
|
+
const postCallState = (report: CallStateReport, callId: string | null) => {
|
|
19
|
+
const id = String(callId || '').trim();
|
|
20
|
+
if (!id) return;
|
|
21
|
+
try {
|
|
22
|
+
void Promise.resolve(
|
|
23
|
+
http.post(
|
|
24
|
+
`/v1/chats/call/state/${report}/${encodeURIComponent(id)}`,
|
|
25
|
+
undefined,
|
|
26
|
+
authHeaders()
|
|
27
|
+
)
|
|
28
|
+
).catch((err) =>
|
|
29
|
+
ethoraLogger.log(`[call] state/${report} report failed`, err)
|
|
30
|
+
);
|
|
31
|
+
} catch (err) {
|
|
32
|
+
ethoraLogger.log(`[call] state/${report} report failed`, err);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/** Callee: the incoming UI is on screen. */
|
|
37
|
+
export const reportCallRinging = (callId: string | null) =>
|
|
38
|
+
postCallState('ringing', callId);
|
|
39
|
+
|
|
40
|
+
/** Callee: the user rejected the call. The server relays it to the caller. */
|
|
41
|
+
export const reportCallDeclined = (callId: string | null) =>
|
|
42
|
+
postCallState('decline', callId);
|
|
43
|
+
|
|
44
|
+
/** Media is flowing (ICE connected). Starts the server-side call timer. */
|
|
45
|
+
export const reportCallConnected = (callId: string | null) =>
|
|
46
|
+
postCallState('connected', callId);
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* A ringing or connected call ended for any reason. Idempotent on the server
|
|
50
|
+
* (a second report returns `ended:false`), so both peers may send it.
|
|
51
|
+
*/
|
|
52
|
+
export const reportCallEnded = (callId: string | null) =>
|
|
53
|
+
postCallState('end', callId);
|
|
54
|
+
|
|
55
|
+
export interface IceServersResponse {
|
|
56
|
+
enabled: boolean;
|
|
57
|
+
iceServers: IceServerConfig[];
|
|
58
|
+
ttlSeconds: number | null;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* GET /v1/calls/ice-servers: fresh STUN/TURN credentials. Used by a callee
|
|
63
|
+
* whose call-token carried no `ice` list, and to refresh the (ephemeral)
|
|
64
|
+
* credentials before an ICE restart. Returns null on any failure so callers
|
|
65
|
+
* can carry on with the servers they already have.
|
|
66
|
+
*/
|
|
67
|
+
export async function fetchIceServers(): Promise<IceServersResponse | null> {
|
|
68
|
+
try {
|
|
69
|
+
const response = await http.get('/v1/calls/ice-servers', authHeaders());
|
|
70
|
+
const data = (response?.data || {}) as Record<string, any>;
|
|
71
|
+
const iceServers = normalizeIceServers(data.iceServers);
|
|
72
|
+
const ttl = Number(data.ttlSeconds);
|
|
73
|
+
return {
|
|
74
|
+
// Older servers omit `enabled`; a non-empty list means usable.
|
|
75
|
+
enabled: typeof data.enabled === 'boolean' ? data.enabled : iceServers.length > 0,
|
|
76
|
+
iceServers,
|
|
77
|
+
ttlSeconds: Number.isFinite(ttl) && ttl > 0 ? ttl : null,
|
|
78
|
+
};
|
|
79
|
+
} catch (err) {
|
|
80
|
+
ethoraLogger.log('[call] ice-servers fetch failed', err);
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -81,6 +81,11 @@ export interface PushSubscriptionPayload {
|
|
|
81
81
|
pushKey?: string;
|
|
82
82
|
pushKeyAlg?: typeof PUSH_KEY_ALG;
|
|
83
83
|
pushKeyId?: string;
|
|
84
|
+
/**
|
|
85
|
+
* BCP-47 tag the service writes this device's pushes in. A full tag is
|
|
86
|
+
* fine: the service reduces fr-CA / es-US to fr / es itself.
|
|
87
|
+
*/
|
|
88
|
+
language?: string;
|
|
84
89
|
}
|
|
85
90
|
|
|
86
91
|
export interface RegisterPushSubscriptionArgs {
|
|
@@ -91,13 +96,16 @@ export interface RegisterPushSubscriptionArgs {
|
|
|
91
96
|
/** Base64 public key for encrypted pushes (`ensurePushKeyPair().publicKey`). */
|
|
92
97
|
pushKey?: string;
|
|
93
98
|
pushKeyId?: string;
|
|
99
|
+
/** Language of this device's pushes (`config.translates.readerLocale` / `i18n.locale`). */
|
|
100
|
+
language?: string;
|
|
94
101
|
}
|
|
95
102
|
|
|
96
103
|
export const buildPushSubscriptionPayload = (
|
|
97
104
|
token: string,
|
|
98
105
|
tokenType: PushTokenType,
|
|
99
106
|
pushKey?: string,
|
|
100
|
-
pushKeyId?: string
|
|
107
|
+
pushKeyId?: string,
|
|
108
|
+
language?: string
|
|
101
109
|
): PushSubscriptionPayload => ({
|
|
102
110
|
registrationToken: token,
|
|
103
111
|
deviceType: resolvePushDeviceType(),
|
|
@@ -105,6 +113,7 @@ export const buildPushSubscriptionPayload = (
|
|
|
105
113
|
...(pushKey
|
|
106
114
|
? { pushKey, pushKeyAlg: PUSH_KEY_ALG, ...(pushKeyId ? { pushKeyId } : {}) }
|
|
107
115
|
: {}),
|
|
116
|
+
...(language ? { language } : {}),
|
|
108
117
|
});
|
|
109
118
|
|
|
110
119
|
export async function registerPushSubscription({
|
|
@@ -114,13 +123,29 @@ export async function registerPushSubscription({
|
|
|
114
123
|
authToken,
|
|
115
124
|
pushKey,
|
|
116
125
|
pushKeyId,
|
|
126
|
+
language,
|
|
117
127
|
}: RegisterPushSubscriptionArgs): Promise<void> {
|
|
118
128
|
const path = `/v1/push/subscription/${encodeURIComponent(appId)}`;
|
|
119
129
|
const headers = { Authorization: authToken };
|
|
120
|
-
const payload = buildPushSubscriptionPayload(token, tokenType, pushKey, pushKeyId);
|
|
130
|
+
const payload = buildPushSubscriptionPayload(token, tokenType, pushKey, pushKeyId, language);
|
|
131
|
+
// A backend that predates `language` still delivers, in its default
|
|
132
|
+
// language: worth more than no push at all, so that field alone is retried
|
|
133
|
+
// without.
|
|
134
|
+
const post = async (body: PushSubscriptionPayload): Promise<void> => {
|
|
135
|
+
try {
|
|
136
|
+
await http.post(path, body, { headers });
|
|
137
|
+
} catch (error: any) {
|
|
138
|
+
if (!(body.language && isUnknownFieldError(error))) {
|
|
139
|
+
throw error;
|
|
140
|
+
}
|
|
141
|
+
const withoutLanguage = { ...body };
|
|
142
|
+
delete withoutLanguage.language;
|
|
143
|
+
await http.post(path, withoutLanguage, { headers });
|
|
144
|
+
}
|
|
145
|
+
};
|
|
121
146
|
|
|
122
147
|
try {
|
|
123
|
-
await
|
|
148
|
+
await post(payload);
|
|
124
149
|
return;
|
|
125
150
|
} catch (error: any) {
|
|
126
151
|
// A backend that predates `tokenType` still delivers to apns / fcm
|
|
@@ -4,6 +4,10 @@ import { store } from '../../roomStore';
|
|
|
4
4
|
import { addRoom, mergeUsersSet, updateRoom } from '../../roomStore/roomsSlice';
|
|
5
5
|
import { IRoom } from '../../types/types';
|
|
6
6
|
import http from '../apiClient';
|
|
7
|
+
import {
|
|
8
|
+
CallCreateResult,
|
|
9
|
+
parseCallCreateResponse,
|
|
10
|
+
} from '../../calls/callMode';
|
|
7
11
|
import {
|
|
8
12
|
mapApiLastMessage,
|
|
9
13
|
readApiUnreadCount,
|
|
@@ -450,7 +454,7 @@ export async function postReportRoom(data: PostReportRoom) {
|
|
|
450
454
|
);
|
|
451
455
|
return response.data.result;
|
|
452
456
|
} catch (error) {
|
|
453
|
-
throw new Error('Error
|
|
457
|
+
throw new Error('Error reporting chat');
|
|
454
458
|
}
|
|
455
459
|
}
|
|
456
460
|
|
|
@@ -545,6 +549,10 @@ export async function deleteRoom(name: string) {
|
|
|
545
549
|
// call-token stanza for the callee. When the server doesn't recognize the
|
|
546
550
|
// field both sides still fall through to a video call (the default), which
|
|
547
551
|
// matches the prior single-mode behavior.
|
|
552
|
+
// We never send a transport: the server decides (`p2p` for private chats when
|
|
553
|
+
// it has P2P enabled, `livekit` otherwise and always for group chats) and
|
|
554
|
+
// tells us in the response. An old server answers with no `mode`, which
|
|
555
|
+
// parses as `livekit`.
|
|
548
556
|
// No timeout is set on the shared `http` client (matches web — neither SDK
|
|
549
557
|
// configures one anywhere), so a stalled connection leaves this request
|
|
550
558
|
// hanging indefinitely with nothing surfaced to the caller. Observed live
|
|
@@ -561,12 +569,12 @@ const CALL_CREATE_TIMEOUT_MS = 15000;
|
|
|
561
569
|
export async function createChatCall(
|
|
562
570
|
chatName: string,
|
|
563
571
|
options?: { kind?: 'audio' | 'video' }
|
|
564
|
-
): Promise<
|
|
572
|
+
): Promise<CallCreateResult> {
|
|
565
573
|
const token = store.getState().chatSettingStore.user.token || '';
|
|
566
574
|
const kind = options?.kind || 'video';
|
|
567
575
|
|
|
568
576
|
try {
|
|
569
|
-
await http.post(
|
|
577
|
+
const response = await http.post(
|
|
570
578
|
`/v1/chats/call/create/${chatName}`,
|
|
571
579
|
{ kind },
|
|
572
580
|
{
|
|
@@ -576,6 +584,7 @@ export async function createChatCall(
|
|
|
576
584
|
timeout: CALL_CREATE_TIMEOUT_MS,
|
|
577
585
|
}
|
|
578
586
|
);
|
|
587
|
+
return parseCallCreateResponse(response?.data, kind);
|
|
579
588
|
} catch (error: any) {
|
|
580
589
|
// Distinguish a timeout from a real server rejection — the caller
|
|
581
590
|
// (CallButtons) surfaces this string directly on the ring/error
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import http from '../apiClient';
|
|
2
|
+
import { store } from '../../roomStore';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Scheduled calls (booking). Wrappers for `/v1/chats/calls/scheduled`.
|
|
6
|
+
*
|
|
7
|
+
* The backend decides every link: the join link, the .ics download and the
|
|
8
|
+
* Google / Outlook templates come back in `links`, and the client only opens
|
|
9
|
+
* them. No calendar URL is ever built here.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export type ScheduledCallKind = 'video' | 'audio';
|
|
13
|
+
export type ScheduledCallRecordStatus = 'scheduled' | 'cancelled';
|
|
14
|
+
|
|
15
|
+
export interface ScheduledCall {
|
|
16
|
+
id?: string;
|
|
17
|
+
chatName: string;
|
|
18
|
+
chatType?: 'private' | 'group' | 'public' | string;
|
|
19
|
+
createdBy?: string;
|
|
20
|
+
title: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
/** ISO 8601, UTC. */
|
|
23
|
+
startAt: string;
|
|
24
|
+
durationMinutes: number;
|
|
25
|
+
timezone?: string;
|
|
26
|
+
kind: ScheduledCallKind;
|
|
27
|
+
slug: string;
|
|
28
|
+
status: ScheduledCallRecordStatus;
|
|
29
|
+
sequence?: number;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface ScheduledCallLinks {
|
|
33
|
+
join: string;
|
|
34
|
+
ics?: string;
|
|
35
|
+
google?: string;
|
|
36
|
+
outlook?: string;
|
|
37
|
+
office365?: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface ScheduledCallChat {
|
|
41
|
+
name?: string;
|
|
42
|
+
title?: string;
|
|
43
|
+
type?: string;
|
|
44
|
+
jid?: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface ScheduledCallDetail {
|
|
48
|
+
scheduledCall: ScheduledCall;
|
|
49
|
+
links: ScheduledCallLinks;
|
|
50
|
+
/** Only the single-call GET carries it. */
|
|
51
|
+
chat?: ScheduledCallChat;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface CreateScheduledCallInput {
|
|
55
|
+
/** The bare room name (JID localpart), as the call endpoints take it. */
|
|
56
|
+
chatName: string;
|
|
57
|
+
title?: string;
|
|
58
|
+
description?: string;
|
|
59
|
+
/** ISO 8601. */
|
|
60
|
+
startAt: string;
|
|
61
|
+
durationMinutes?: number;
|
|
62
|
+
timezone?: string;
|
|
63
|
+
kind?: ScheduledCallKind;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface UpdateScheduledCallInput {
|
|
67
|
+
title?: string;
|
|
68
|
+
description?: string;
|
|
69
|
+
startAt?: string;
|
|
70
|
+
durationMinutes?: number;
|
|
71
|
+
kind?: ScheduledCallKind;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export type ScheduledCallErrorCode =
|
|
75
|
+
| 'not-found'
|
|
76
|
+
| 'not-a-member'
|
|
77
|
+
| 'forbidden'
|
|
78
|
+
| 'invalid'
|
|
79
|
+
| 'conflict'
|
|
80
|
+
| 'network'
|
|
81
|
+
| 'unknown';
|
|
82
|
+
|
|
83
|
+
export class ScheduledCallApiError extends Error {
|
|
84
|
+
code: ScheduledCallErrorCode;
|
|
85
|
+
status?: number;
|
|
86
|
+
/** The server's own `code` (e.g. `START_IN_PAST`, `CALL_CANCELLED`), when it sent one. */
|
|
87
|
+
serverCode?: string;
|
|
88
|
+
constructor(
|
|
89
|
+
code: ScheduledCallErrorCode,
|
|
90
|
+
status?: number,
|
|
91
|
+
message?: string,
|
|
92
|
+
serverCode?: string
|
|
93
|
+
) {
|
|
94
|
+
super(message || code);
|
|
95
|
+
this.name = 'ScheduledCallApiError';
|
|
96
|
+
this.code = code;
|
|
97
|
+
this.status = status;
|
|
98
|
+
this.serverCode = serverCode;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export const isScheduledCallApiError = (
|
|
103
|
+
error: unknown
|
|
104
|
+
): error is ScheduledCallApiError =>
|
|
105
|
+
error instanceof ScheduledCallApiError ||
|
|
106
|
+
(!!error && (error as any).name === 'ScheduledCallApiError');
|
|
107
|
+
|
|
108
|
+
const REQUEST_TIMEOUT_MS = 15000;
|
|
109
|
+
const BASE = '/v1/chats/calls/scheduled';
|
|
110
|
+
|
|
111
|
+
const authHeaders = () => ({
|
|
112
|
+
Authorization: store.getState().chatSettingStore.user?.token || '',
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
const toApiError = (error: any): ScheduledCallApiError => {
|
|
116
|
+
const status: number | undefined = error?.response?.status;
|
|
117
|
+
const body = error?.response?.data;
|
|
118
|
+
const reason = String(body?.error || body?.message || '');
|
|
119
|
+
const serverCode = body?.code ? String(body.code) : undefined;
|
|
120
|
+
if (!error?.response) {
|
|
121
|
+
return new ScheduledCallApiError('network', undefined, error?.message);
|
|
122
|
+
}
|
|
123
|
+
if (status === 404) {return new ScheduledCallApiError('not-found', status, reason, serverCode);}
|
|
124
|
+
if (status === 403) {
|
|
125
|
+
return new ScheduledCallApiError(
|
|
126
|
+
reason === 'not-a-member' ? 'not-a-member' : 'forbidden',
|
|
127
|
+
status,
|
|
128
|
+
reason,
|
|
129
|
+
serverCode
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
if (status === 400 || status === 422) {
|
|
133
|
+
return new ScheduledCallApiError('invalid', status, reason, serverCode);
|
|
134
|
+
}
|
|
135
|
+
// PATCH on a cancelled call.
|
|
136
|
+
if (status === 409) {
|
|
137
|
+
return new ScheduledCallApiError('conflict', status, reason, serverCode);
|
|
138
|
+
}
|
|
139
|
+
return new ScheduledCallApiError(
|
|
140
|
+
'unknown',
|
|
141
|
+
status,
|
|
142
|
+
reason || error?.message,
|
|
143
|
+
serverCode
|
|
144
|
+
);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const pick = (data: any): ScheduledCallDetail => {
|
|
148
|
+
const scheduledCall = data?.scheduledCall;
|
|
149
|
+
if (!scheduledCall || typeof scheduledCall !== 'object') {
|
|
150
|
+
throw new ScheduledCallApiError('unknown', undefined, 'bad response');
|
|
151
|
+
}
|
|
152
|
+
return {
|
|
153
|
+
scheduledCall,
|
|
154
|
+
links: data?.links || { join: '' },
|
|
155
|
+
...(data?.chat ? { chat: data.chat } : {}),
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
const run = async <T>(call: () => Promise<T>): Promise<T> => {
|
|
160
|
+
try {
|
|
161
|
+
return await call();
|
|
162
|
+
} catch (error) {
|
|
163
|
+
if (isScheduledCallApiError(error)) {throw error;}
|
|
164
|
+
throw toApiError(error);
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
/** POST /v1/chats/calls/scheduled */
|
|
169
|
+
export const createScheduledCall = (
|
|
170
|
+
input: CreateScheduledCallInput
|
|
171
|
+
): Promise<ScheduledCallDetail> =>
|
|
172
|
+
run(async () => {
|
|
173
|
+
const response = await http.post(BASE, input, {
|
|
174
|
+
headers: authHeaders(),
|
|
175
|
+
timeout: REQUEST_TIMEOUT_MS,
|
|
176
|
+
});
|
|
177
|
+
return pick(response?.data);
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
/** GET /v1/chats/calls/scheduled?chatName=&from=&to= (upcoming first). */
|
|
181
|
+
export const listScheduledCalls = (params: {
|
|
182
|
+
chatName?: string;
|
|
183
|
+
from?: string;
|
|
184
|
+
to?: string;
|
|
185
|
+
}): Promise<ScheduledCallDetail[]> =>
|
|
186
|
+
run(async () => {
|
|
187
|
+
const response = await http.get(BASE, {
|
|
188
|
+
params,
|
|
189
|
+
headers: authHeaders(),
|
|
190
|
+
timeout: REQUEST_TIMEOUT_MS,
|
|
191
|
+
});
|
|
192
|
+
const items = response?.data?.items;
|
|
193
|
+
return Array.isArray(items) ? items.map(pick) : [];
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
/** GET /v1/chats/calls/scheduled/:slug. 404 unknown, 403 not a member. */
|
|
197
|
+
export const getScheduledCall = (slug: string): Promise<ScheduledCallDetail> =>
|
|
198
|
+
run(async () => {
|
|
199
|
+
const response = await http.get(`${BASE}/${encodeURIComponent(slug)}`, {
|
|
200
|
+
headers: authHeaders(),
|
|
201
|
+
timeout: REQUEST_TIMEOUT_MS,
|
|
202
|
+
});
|
|
203
|
+
return pick(response?.data);
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
/** PATCH /v1/chats/calls/scheduled/:slug (creator or room owner). */
|
|
207
|
+
export const updateScheduledCall = (
|
|
208
|
+
slug: string,
|
|
209
|
+
patch: UpdateScheduledCallInput
|
|
210
|
+
): Promise<ScheduledCallDetail> =>
|
|
211
|
+
run(async () => {
|
|
212
|
+
const response = await http.patch(
|
|
213
|
+
`${BASE}/${encodeURIComponent(slug)}`,
|
|
214
|
+
patch,
|
|
215
|
+
{ headers: authHeaders(), timeout: REQUEST_TIMEOUT_MS }
|
|
216
|
+
);
|
|
217
|
+
return pick(response?.data);
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
/** DELETE /v1/chats/calls/scheduled/:slug (creator or room owner). */
|
|
221
|
+
export const cancelScheduledCall = (slug: string): Promise<ScheduledCall> =>
|
|
222
|
+
run(async () => {
|
|
223
|
+
const response = await http.delete(
|
|
224
|
+
`${BASE}/${encodeURIComponent(slug)}`,
|
|
225
|
+
{ headers: authHeaders(), timeout: REQUEST_TIMEOUT_MS }
|
|
226
|
+
);
|
|
227
|
+
const scheduledCall = response?.data?.scheduledCall;
|
|
228
|
+
if (!scheduledCall) {
|
|
229
|
+
throw new ScheduledCallApiError('unknown', undefined, 'bad response');
|
|
230
|
+
}
|
|
231
|
+
return scheduledCall as ScheduledCall;
|
|
232
|
+
});
|