@nethesis/phone-island 1.1.7 → 1.1.8-dev.1
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/dist/components/AlertView/index.js +1 -1
- package/dist/components/AlertView/index.js.map +1 -1
- package/dist/components/AudioPlayerView/PlayerFooterActions.js +1 -1
- package/dist/components/AudioPlayerView/PlayerFooterActions.js.map +1 -1
- package/dist/components/AudioPlayerView/Progress.js +1 -1
- package/dist/components/AudioPlayerView/Progress.js.map +1 -1
- package/dist/components/AudioPlayerView/index.js +1 -1
- package/dist/components/AudioPlayerView/index.js.map +1 -1
- package/dist/components/Button.js +1 -1
- package/dist/components/Button.js.map +1 -1
- package/dist/components/CallView/Actions.js +1 -1
- package/dist/components/CallView/Actions.js.map +1 -1
- package/dist/components/CallView/Number.js +1 -1
- package/dist/components/CallView/Number.js.map +1 -1
- package/dist/components/CallView/index.js +1 -1
- package/dist/components/CallView/index.js.map +1 -1
- package/dist/components/ConferenceView/index.js +1 -1
- package/dist/components/ConferenceView/index.js.map +1 -1
- package/dist/components/ContactView/ContactListView.js +1 -1
- package/dist/components/ContactView/ContactListView.js.map +1 -1
- package/dist/components/ContactView/TransferActions.js +1 -1
- package/dist/components/ContactView/TransferActions.js.map +1 -1
- package/dist/components/CustomThemedTooltip.js.map +1 -1
- package/dist/components/Events.js +1 -1
- package/dist/components/Events.js.map +1 -1
- package/dist/components/Hangup.js +1 -1
- package/dist/components/Hangup.js.map +1 -1
- package/dist/components/Island.js +1 -1
- package/dist/components/Island.js.map +1 -1
- package/dist/components/IslandDrag.js +1 -1
- package/dist/components/IslandDrag.js.map +1 -1
- package/dist/components/IslandMotion.js +1 -1
- package/dist/components/IslandMotion.js.map +1 -1
- package/dist/components/KeypadView/Actions.js +1 -1
- package/dist/components/KeypadView/Actions.js.map +1 -1
- package/dist/components/KeypadView/index.js +1 -1
- package/dist/components/KeypadView/index.js.map +1 -1
- package/dist/components/PhysicalRecorderView/index.js +1 -1
- package/dist/components/PhysicalRecorderView/index.js.map +1 -1
- package/dist/components/RecorderView/Actions.js +1 -1
- package/dist/components/RecorderView/Actions.js.map +1 -1
- package/dist/components/SettingsView/AudioView.js +1 -1
- package/dist/components/SettingsView/AudioView.js.map +1 -1
- package/dist/components/SettingsView/MicrophoneView.js +1 -1
- package/dist/components/SettingsView/MicrophoneView.js.map +1 -1
- package/dist/components/SettingsView/ThemeView.js +1 -1
- package/dist/components/SettingsView/ThemeView.js.map +1 -1
- package/dist/components/SettingsView/VideoInputView.js +1 -1
- package/dist/components/SettingsView/VideoInputView.js.map +1 -1
- package/dist/components/SideView/hooks/useSideViewLogic.js +1 -1
- package/dist/components/SideView/hooks/useSideViewLogic.js.map +1 -1
- package/dist/components/Socket.js +1 -1
- package/dist/components/Socket.js.map +1 -1
- package/dist/components/StreamingAnswerView/index.js +1 -1
- package/dist/components/StreamingAnswerView/index.js.map +1 -1
- package/dist/components/StreamingImage/index.js +1 -1
- package/dist/components/StreamingImage/index.js.map +1 -1
- package/dist/components/StreamingUnlock/index.js +2 -0
- package/dist/components/StreamingUnlock/index.js.map +1 -0
- package/dist/components/StreamingVideo/index.js +2 -0
- package/dist/components/StreamingVideo/index.js.map +1 -0
- package/dist/components/SwitchInputView/DropdownContent.js +1 -1
- package/dist/components/SwitchInputView/DropdownContent.js.map +1 -1
- package/dist/components/SwitchInputView/Index.js +1 -1
- package/dist/components/TranscriptionView/TranscriptionView.js +1 -1
- package/dist/components/TranscriptionView/TranscriptionView.js.map +1 -1
- package/dist/components/TransferButton.js +1 -1
- package/dist/components/TransferButton.js.map +1 -1
- package/dist/components/VideoView/index.js +1 -1
- package/dist/components/VideoView/index.js.map +1 -1
- package/dist/components/WebRTC.js +1 -1
- package/dist/components/WebRTC.js.map +1 -1
- package/dist/events/CallEvents.js +1 -1
- package/dist/events/CallEvents.js.map +1 -1
- package/dist/events/PlayerEvents.js +1 -1
- package/dist/events/PlayerEvents.js.map +1 -1
- package/dist/events/RecorderEvents.js +1 -1
- package/dist/events/RecorderEvents.js.map +1 -1
- package/dist/events/SocketEvents.js +1 -1
- package/dist/events/SocketEvents.js.map +1 -1
- package/dist/index.css +1 -1
- package/dist/lib/darkTheme.js +1 -1
- package/dist/lib/darkTheme.js.map +1 -1
- package/dist/lib/devices/devices.js +1 -1
- package/dist/lib/devices/devices.js.map +1 -1
- package/dist/lib/island/island.js +1 -1
- package/dist/lib/island/island.js.map +1 -1
- package/dist/lib/phone/call.js +1 -1
- package/dist/lib/phone/call.js.map +1 -1
- package/dist/lib/phone/video.js +1 -1
- package/dist/lib/phone/video.js.map +1 -1
- package/dist/lib/storage/local_storage.js +1 -1
- package/dist/lib/storage/local_storage.js.map +1 -1
- package/dist/lib/streaming/streamingVideo.js +2 -0
- package/dist/lib/streaming/streamingVideo.js.map +1 -0
- package/dist/lib/streaming/whepPlayer.js +2 -0
- package/dist/lib/streaming/whepPlayer.js.map +1 -0
- package/dist/models/currentCall.js +1 -1
- package/dist/models/currentCall.js.map +1 -1
- package/dist/models/island.js +1 -1
- package/dist/models/island.js.map +1 -1
- package/dist/models/motions.js +1 -1
- package/dist/models/motions.js.map +1 -1
- package/dist/models/streaming.js +1 -1
- package/dist/models/streaming.js.map +1 -1
- package/dist/node_modules/@fortawesome/free-solid-svg-icons/index.mjs.js +1 -1
- package/dist/node_modules/@fortawesome/free-solid-svg-icons/index.mjs.js.map +1 -1
- package/dist/node_modules/react-redux/node_modules/react-is/index.js +1 -1
- package/dist/node_modules/tslib/tslib.es6.js +1 -1
- package/dist/node_modules/tslib/tslib.es6.js.map +1 -1
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +1 -1
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js +1 -1
- package/dist/node_modules/use-sync-external-store/shim/index.js +1 -1
- package/dist/package.json.js +1 -1
- package/dist/public/locales/en/translation.json.js +1 -1
- package/dist/public/locales/it/translation.json.js +1 -1
- package/dist/services/user.js +1 -1
- package/dist/services/user.js.map +1 -1
- package/dist/utils/customHooks/useStreamingAspectRatio.js +2 -0
- package/dist/utils/customHooks/useStreamingAspectRatio.js.map +1 -0
- package/dist/utils/customHooks/useStreamingContentHeight.js +2 -0
- package/dist/utils/customHooks/useStreamingContentHeight.js.map +1 -0
- package/dist/utils/customHooks/useStreamingVideo.js +2 -0
- package/dist/utils/customHooks/useStreamingVideo.js.map +1 -0
- package/dist/utils/streaming/previewSize.js +2 -0
- package/dist/utils/streaming/previewSize.js.map +1 -0
- package/dist/utils/streaming/streamingUtils.js +1 -1
- package/dist/utils/streaming/streamingUtils.js.map +1 -1
- package/dist/utils/streaming/videoSource.js +2 -0
- package/dist/utils/streaming/videoSource.js.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/PhysicalRecorderView/index.tsx"],"sourcesContent":["// Copyright (C) 2024 Nethesis S.r.l.\n// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport React, { type FC, useRef, useEffect } from 'react'\nimport { useDispatch, useSelector } from 'react-redux'\nimport { Dispatch, RootState, store } from '../../store'\nimport { useTranslation } from 'react-i18next'\nimport Hangup from '../Hangup'\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\nimport { faCircle } from '@fortawesome/free-solid-svg-icons'\nimport { useEventListener, eventDispatch } from '../../utils'\nimport { startAnnouncementRecording } from '../../services/offhour'\nimport { dispatchPhysicalRecordingSave } from '../../events'\nimport PhysicalRecordingTimer from './PhysicalRecordingTimer'\n\nexport const PhysicalRecorderView: FC<PhysicalRecorderViewProps> = () => {\n const { isOpen } = useSelector((state: RootState) => state.island)\n const { recording } = useSelector((state: RootState) => ({\n recording: state.physicalRecorder.recording,\n }))\n\n const { username } = store.getState().currentUser\n const visibleContainerRef = useRef<HTMLDivElement>(null)\n\n // Initialize state dispatch\n const dispatch = useDispatch<Dispatch>()\n\n // Handle view close and reset state\n useEffect(() => {\n // Set visible container reference to recorder state\n dispatch.recorder.setVisibleContainerRef(visibleContainerRef)\n\n return () => {\n dispatch.recorder.reset()\n }\n }, [])\n\n const { t } = useTranslation()\n\n async function handleStart() {\n // Update the recorder state\n dispatch.physicalRecorder.setRecording(true)\n // Call the api to start the recording call\n const data: { tempFilename: string } | null = await startAnnouncementRecording()\n // Set the returned temp file name to the store\n if (data.tempFilename) dispatch.physicalRecorder.setTempFilename(data.tempFilename)\n eventDispatch('phone-island-recording-started', {})\n }\n\n // Save recording inside store and make api request\n useEventListener('phone-island-physical-recording-open', () => {\n handleStart()\n })\n\n const { recordingTempVariable } = store.getState().physicalRecorder\n // recording true and conversation not empty recording is started\n // recording true and conversation empty recording is stopped\n useEventListener('phone-island-conversations', (data: { [key: string]: any }) => {\n const keys = Object.keys(data)\n\n keys.forEach((key) => {\n if (key === username) {\n let conversations = data[key]?.conversations\n\n if (conversations) {\n const conversationKeys = Object.keys(conversations)\n if (\n conversationKeys.length > 0 &&\n conversations[conversationKeys[0]].counterpartName === 'REC'\n ) {\n // Set the start time of recording\n dispatch.physicalRecorder.setStartTime(`${Date.now() / 1000}`)\n let firstConversationKey = conversationKeys[0]\n let userRecordingData = conversations[firstConversationKey]\n if (userRecordingData) {\n if (userRecordingData.chSource) {\n let recordingCallInformation = {\n conversationId: userRecordingData.id,\n endpointId: userRecordingData.chSource.callerNum,\n }\n dispatch.physicalRecorder.setCallRecordingInformations({\n recordingCallInformation,\n })\n }\n }\n }\n if (conversationKeys.length === 0 && recording && !recordingTempVariable) {\n // close physical recording phone island view\n dispatchPhysicalRecordingSave()\n dispatch.island.setIslandView(null)\n dispatch.physicalRecorder.setRecording(false)\n }\n }\n }\n })\n })\n\n return (\n <>\n {isOpen ? (\n <div className=''>\n {recordingTempVariable && (\n <div className='pi-flex pi-w-full pi-justify-center pi-items-center pi-pt-4 pi-pb-9'>\n <div className='pi-font-medium pi-text-4xl pi-w-fit pi-h-fit dark:pi-text-white'>\n <PhysicalRecordingTimer />\n </div>\n </div>\n )}\n <div className='pi-flex pi-w-full pi-justify-center pi-items-center'>\n {recordingTempVariable ? (\n <div className='pi-sans pi-text-sm pi-w-fit pi-h-fit dark:pi-text-white'>\n {t('Common.Close the call to stop recording')}\n </div>\n ) : (\n <div className='pi-mt-12 pi-font-regular pi-text-lg pi-w-fit pi-h-fit dark:pi-text-white'>\n {t('Common.Answer phone to start recording')}\n </div>\n )}\n </div>\n <div className='pi-grid pi-pt-2 pi-mt-8'>\n <div className='pi-grid pi-justify-items-center'>\n <Hangup description={t('Tooltip.Interrupt recording')} isPhysicalRecording />\n </div>\n </div>\n </div>\n ) : (\n <div className='pi-flex pi-justify-between pi-items-center'>\n <div className='pi-font-medium pi-text-base'>{t('Common.Recording')}</div>\n <div\n className={`${\n !isOpen ? 'pi-h-6 pi-w-6' : 'pi-h-12 pi-w-12'\n } pi-flex pi-justify-center pi-items-center`}\n >\n <div\n className={`${\n !isOpen ? 'pi-h-4 pi-w-4 pi-rounded-full' : 'pi-h-8'\n } pi-w-fit pi-flex pi-justify-center pi-items-center pi-gap-1 pi-overflow-hidden`}\n >\n <span\n className={`${\n !isOpen ? 'pi-h-6 pi-w-6' : 'pi-w-8 pi-h-8'\n } pi-animate-ping pi-absolute pi-inline-flex pi-rounded-full pi-bg-red-400 pi-opacity-75 `}\n ></span>\n <FontAwesomeIcon\n className='pi-w-4 pi-h-6 pi-rotate-45 pi-text-red-500'\n icon={faCircle}\n ></FontAwesomeIcon>\n </div>\n </div>\n </div>\n )}\n </>\n )\n}\n\nexport interface PhysicalRecorderViewProps {}\n"],"names":["isOpen","useSelector","state","island","recording","physicalRecorder","username","store","getState","currentUser","visibleContainerRef","useRef","dispatch","useDispatch","useEffect","recorder","setVisibleContainerRef","reset","t","useTranslation","useEventListener","setRecording","startAnnouncementRecording","data","_a","sent","tempFilename","setTempFilename","eventDispatch","handleStart","recordingTempVariable","Object","keys","forEach","key","conversations","conversationKeys","length","counterpartName","setStartTime","concat","Date","now","userRecordingData","chSource","recordingCallInformation","conversationId","id","endpointId","callerNum","setCallRecordingInformations","dispatchPhysicalRecordingSave","setIslandView","React","createElement","Fragment","className","PhysicalRecordingTimer","Hangup","description","isPhysicalRecording","FontAwesomeIcon","icon","faCircle"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/PhysicalRecorderView/index.tsx"],"sourcesContent":["// Copyright (C) 2024 Nethesis S.r.l.\n// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport React, { type FC, useRef, useEffect } from 'react'\nimport { useDispatch, useSelector } from 'react-redux'\nimport { Dispatch, RootState, store } from '../../store'\nimport { useTranslation } from 'react-i18next'\nimport Hangup from '../Hangup'\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\nimport { faCircle } from '@fortawesome/free-solid-svg-icons'\nimport { useEventListener, eventDispatch } from '../../utils'\nimport { startAnnouncementRecording } from '../../services/offhour'\nimport { dispatchPhysicalRecordingSave } from '../../events'\nimport PhysicalRecordingTimer from './PhysicalRecordingTimer'\n\nexport const PhysicalRecorderView: FC<PhysicalRecorderViewProps> = () => {\n const { isOpen } = useSelector((state: RootState) => state.island)\n const { recording } = useSelector((state: RootState) => ({\n recording: state.physicalRecorder.recording,\n }))\n\n const { username } = store.getState().currentUser\n const visibleContainerRef = useRef<HTMLDivElement>(null)\n\n // Initialize state dispatch\n const dispatch = useDispatch<Dispatch>()\n\n // Handle view close and reset state\n useEffect(() => {\n // Set visible container reference to recorder state\n dispatch.recorder.setVisibleContainerRef(visibleContainerRef)\n\n return () => {\n dispatch.recorder.reset()\n }\n }, [])\n\n const { t } = useTranslation()\n\n async function handleStart() {\n // Update the recorder state\n dispatch.physicalRecorder.setRecording(true)\n // Call the api to start the recording call\n const data: { tempFilename: string } | null = await startAnnouncementRecording()\n // Set the returned temp file name to the store\n if (data.tempFilename) dispatch.physicalRecorder.setTempFilename(data.tempFilename)\n eventDispatch('phone-island-recording-started', {})\n }\n\n // Save recording inside store and make api request\n useEventListener('phone-island-physical-recording-open', () => {\n handleStart()\n })\n\n const { recordingTempVariable } = store.getState().physicalRecorder\n // recording true and conversation not empty recording is started\n // recording true and conversation empty recording is stopped\n useEventListener('phone-island-conversations', (data: { [key: string]: any }) => {\n const keys = Object.keys(data)\n\n keys.forEach((key) => {\n if (key === username) {\n let conversations = data[key]?.conversations\n\n if (conversations) {\n const conversationKeys = Object.keys(conversations)\n if (\n conversationKeys.length > 0 &&\n conversations[conversationKeys[0]].counterpartName === 'REC'\n ) {\n // Set the start time of recording\n dispatch.physicalRecorder.setStartTime(`${Date.now() / 1000}`)\n let firstConversationKey = conversationKeys[0]\n let userRecordingData = conversations[firstConversationKey]\n if (userRecordingData) {\n if (userRecordingData.chSource) {\n let recordingCallInformation = {\n conversationId: userRecordingData.id,\n endpointId: userRecordingData.chSource.callerNum,\n }\n dispatch.physicalRecorder.setCallRecordingInformations({\n recordingCallInformation,\n })\n }\n }\n }\n if (conversationKeys.length === 0 && recording && !recordingTempVariable) {\n // close physical recording phone island view\n dispatchPhysicalRecordingSave()\n dispatch.island.setIslandView(null)\n dispatch.physicalRecorder.setRecording(false)\n }\n }\n }\n })\n })\n\n return (\n <>\n {isOpen ? (\n <div className=''>\n {recordingTempVariable && (\n <div className='pi-flex pi-w-full pi-justify-center pi-items-center pi-pt-4 pi-pb-9'>\n <div className='pi-font-medium pi-text-4xl pi-w-fit pi-h-fit dark:pi-text-white'>\n <PhysicalRecordingTimer />\n </div>\n </div>\n )}\n <div className='pi-flex pi-w-full pi-justify-center pi-items-center'>\n {recordingTempVariable ? (\n <div className='pi-sans pi-text-sm pi-w-fit pi-h-fit dark:pi-text-white'>\n {t('Common.Close the call to stop recording')}\n </div>\n ) : (\n <div className='pi-mt-12 pi-font-regular pi-text-lg pi-w-fit pi-h-fit dark:pi-text-white'>\n {t('Common.Answer phone to start recording')}\n </div>\n )}\n </div>\n <div className='pi-grid pi-pt-2 pi-mt-8'>\n <div className='pi-grid pi-justify-items-center'>\n <Hangup description={t('Tooltip.Interrupt recording')} isPhysicalRecording />\n </div>\n </div>\n </div>\n ) : (\n <div className='pi-flex pi-justify-between pi-items-center'>\n <div className='pi-font-medium pi-text-base'>{t('Common.Recording')}</div>\n <div\n className={`${\n !isOpen ? 'pi-h-6 pi-w-6' : 'pi-h-12 pi-w-12'\n } pi-flex pi-justify-center pi-items-center`}\n >\n <div\n className={`${\n !isOpen ? 'pi-h-4 pi-w-4 pi-rounded-full' : 'pi-h-8'\n } pi-w-fit pi-flex pi-justify-center pi-items-center pi-gap-1 pi-overflow-hidden`}\n >\n <span\n className={`${\n !isOpen ? 'pi-h-6 pi-w-6' : 'pi-w-8 pi-h-8'\n } pi-animate-ping pi-absolute pi-inline-flex pi-rounded-full pi-bg-red-400 pi-opacity-75 `}\n ></span>\n <FontAwesomeIcon\n className='pi-w-4 pi-h-6 pi-rotate-45 pi-text-red-500'\n icon={faCircle}\n ></FontAwesomeIcon>\n </div>\n </div>\n </div>\n )}\n </>\n )\n}\n\nexport interface PhysicalRecorderViewProps {}\n"],"names":["isOpen","useSelector","state","island","recording","physicalRecorder","username","store","getState","currentUser","visibleContainerRef","useRef","dispatch","useDispatch","useEffect","recorder","setVisibleContainerRef","reset","t","useTranslation","useEventListener","setRecording","startAnnouncementRecording","data","_a","sent","tempFilename","setTempFilename","eventDispatch","handleStart","recordingTempVariable","Object","keys","forEach","key","conversations","conversationKeys","length","counterpartName","setStartTime","concat","Date","now","userRecordingData","chSource","recordingCallInformation","conversationId","id","endpointId","callerNum","setCallRecordingInformations","dispatchPhysicalRecordingSave","setIslandView","React","createElement","Fragment","className","PhysicalRecordingTimer","Hangup","description","isPhysicalRecording","FontAwesomeIcon","icon","faCircle"],"mappings":"k0CAemE,WACzD,IAAAA,EAAWC,cAAY,SAACC,GAAqB,OAAAA,EAAMC,gBACnDC,EAAcH,EAAAA,YAAY,SAACC,GAAqB,MAAC,CACvDE,UAAWF,EAAMG,iBAAiBD,UADoB,GAErDA,UAEKE,EAAaC,EAAKA,MAACC,WAAWC,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D,EAAAA,QAAAC,cAAA,MAAA,CAAKE,UAAU,IACZ1B,GACCuB,EAAK,QAAAC,cAAA,MAAA,CAAAE,UAAU,uEACbH,EAAAA,QAAKC,cAAA,MAAA,CAAAE,UAAU,mEACbH,EAAAA,QAAAC,cAACG,EAAAA,QAAsB,QAI7BJ,EAAAA,QAAAC,cAAA,MAAA,CAAKE,UAAU,uDACZ1B,EACCuB,+BAAKG,UAAU,2DACZtC,EAAE,4CAGLmC,+BAAKG,UAAU,4EACZtC,EAAE,4CAITmC,EAAAA,QAAKC,cAAA,MAAA,CAAAE,UAAU,2BACbH,EAAAA,QAAKC,cAAA,MAAA,CAAAE,UAAU,mCACbH,EAAC,QAAAC,cAAAI,WAAOC,YAAazC,EAAE,+BAAgC0C,qBAAmB,OAKhFP,EAAA,QAAAC,cAAA,MAAA,CAAKE,UAAU,8CACbH,UAAKC,cAAA,MAAA,CAAAE,UAAU,+BAA+BtC,EAAE,qBAChDmC,EAAAA,QAAAC,cAAA,MAAA,CACEE,UAAW,GACThB,OAACxC,EAA2B,kBAAlB,gBACgC,+CAE5CqD,EAAAA,QAAAC,cAAA,MAAA,CACEE,UAAW,GACThB,OAACxC,EAA2C,SAAlC,gCACqE,oFAEjFqD,EAAAA,QAAAC,cAAA,OAAA,CACEE,UAAW,GACThB,OAACxC,EAA2B,gBAAlB,8GAGdqD,EAAAA,QAAAC,cAACO,kBACC,CAAAL,UAAU,6CACVM,KAAMC,gBAQtB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/tslib/tslib.es6.js"),t=require("react"),i=require("../Button.js"),r=require("../../node_modules/@fortawesome/react-fontawesome/dist/index.js"),o=require("../../node_modules/@fortawesome/free-solid-svg-icons/index.mjs.js"),n=require("../../services/offhour.js");require("../../node_modules/react-redux/es/index.js");var s=require("../../lib/phone/call.js"),a=require("../../utils/customHooks/useEventListener.js"),c=require("../../utils/genericFunctions/eventDispatch.js");require("../../store/index.js");var l=require("../../events/RecorderEvents.js");require("../../node_modules/i18next/dist/esm/i18next.js"),require("../../node_modules/react-i18next/dist/es/context.js");var d=require("../../node_modules/react-i18next/dist/es/useTranslation.js"),u=require("../CustomThemedTooltip.js"),p=require("../../node_modules/@nethesis/nethesis-solid-svg-icons/index.mjs.js"),m=require("../../node_modules/react-redux/es/utils/shallowEqual.js");require("../../node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js"),require("../../node_modules/react-redux/node_modules/react-is/index.js");var f=require("../../node_modules/react-redux/es/hooks/useDispatch.js"),g=require("../../node_modules/react-redux/es/hooks/useSelector.js");function
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/tslib/tslib.es6.js"),t=require("react"),i=require("../Button.js"),r=require("../../node_modules/@fortawesome/react-fontawesome/dist/index.js"),o=require("../../node_modules/@fortawesome/free-solid-svg-icons/index.mjs.js"),n=require("../../services/offhour.js");require("../../node_modules/react-redux/es/index.js");var s=require("../../lib/phone/call.js"),a=require("../../utils/customHooks/useEventListener.js"),c=require("../../utils/genericFunctions/eventDispatch.js");require("../../store/index.js"),require("../../services/user.js");var l=require("../../events/RecorderEvents.js");require("../../node_modules/i18next/dist/esm/i18next.js"),require("../../node_modules/react-i18next/dist/es/context.js");var d=require("../../node_modules/react-i18next/dist/es/useTranslation.js"),u=require("../CustomThemedTooltip.js"),p=require("../../node_modules/@nethesis/nethesis-solid-svg-icons/index.mjs.js"),m=require("../../node_modules/react-redux/es/utils/shallowEqual.js");require("../../node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js"),require("../../node_modules/react-redux/node_modules/react-is/index.js");var f=require("../../node_modules/react-redux/es/hooks/useDispatch.js"),g=require("../../node_modules/react-redux/es/hooks/useSelector.js");function v(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=v(t);exports.Actions=function(){var v=f.useDispatch(),w=g.useSelector(function(e){return{incoming:e.recorder.incoming,waiting:e.recorder.waiting,recording:e.recorder.recording,recorded:e.recorder.recorded,playing:e.recorder.playing}},m.default),j=w.incoming,x=w.waiting,E=w.recording,q=w.recorded,_=w.playing;function y(){return e.__awaiter(this,void 0,void 0,function(){var t;return e.__generator(this,function(e){switch(e.label){case 0:return v.recorder.setRecording(!0),v.recorder.setWaiting(!0),[4,n.startAnnouncementRecording()];case 1:return(t=e.sent()).tempFilename&&v.recorder.setTempFilename(t.tempFilename),v.recorder.setStartTime("".concat(Date.now()/1e3)),c.eventDispatch("phone-island-recording-started",{}),[2]}})})}function T(){v.recorder.setWaiting(!0),s.hangupCurrentCall(),v.recorder.setRecorded(!0),c.eventDispatch("phone-island-recording-stopped",{})}function C(){_&&(v.player.pauseAudioPlayer(),v.recorder.setPlaying(!1),v.recorder.setPaused(!0)),l.dispatchRecordingSave(),v.island.setIslandView(null)}a.useEventListener("phone-island-recording-start",function(e){y()}),a.useEventListener("phone-island-recording-stop",function(e){T()}),a.useEventListener("phone-island-recording-save",function(e){C()}),t.useEffect(function(){E||v.recorder.setWaiting(!1)},[E]),t.useEffect(function(){j&&(s.answerIncomingCall(),v.recorder.setIncoming(!1),v.recorder.setWaiting(!1))},[j]);var N=d.useTranslation().t;return h.default.createElement("div",{className:"pi-flex pi-items-center pi-justify-between pi-px-6 pi-py-2 pi-gap-0 pi-w-full pi-mt-auto"},h.default.createElement(i.Button,{variant:"transparent",disabled:!0,className:"pi-w-6 pi-h-6 pi-flex pi-items-center pi-justify-center pi-flex-none"},h.default.createElement(r.FontAwesomeIcon,{icon:o.faDownLeftAndUpRightToCenter,className:"pi-w-6 pi-h-6"})),h.default.createElement("div",{className:"pi-flex pi-items-center pi-justify-center pi-flex-grow"},E&&h.default.createElement(i.Button,{onClick:T,variant:"default",className:"pi-rounded-full pi-w-14 pi-h-14 pi-flex pi-items-center pi-justify-center","data-tooltip-id":"tooltip-stop-recorder-view","data-tooltip-content":N("Tooltip.Stop")||""},x?h.default.createElement(r.FontAwesomeIcon,{icon:o.faCircleNotch,className:"fa-spin pi-loader",size:"lg"}):h.default.createElement(r.FontAwesomeIcon,{icon:o.faStop,size:"xl"})),q&&!E&&h.default.createElement(i.Button,{onClick:C,variant:"default",className:"pi-rounded-full pi-w-14 pi-h-14 pi-flex pi-items-center pi-justify-center","data-tooltip-id":"tooltip-confirm-record-view","data-tooltip-content":N("Tooltip.Confirm")||""},h.default.createElement(r.FontAwesomeIcon,{icon:o.faFloppyDisk,className:"pi-h-6 pi-w-6"})),!E&&!q&&h.default.createElement(i.Button,{onClick:y,variant:"default",className:"pi-rounded-full pi-w-14 pi-h-14 pi-flex pi-items-center pi-justify-center","data-tooltip-id":"tooltip-start-recording-recorder-view","data-tooltip-content":N("Tooltip.Start recording")||""},x?h.default.createElement(r.FontAwesomeIcon,{icon:o.faCircleNotch,className:"fa-spin pi-loader",size:"lg"}):h.default.createElement(r.FontAwesomeIcon,{icon:p.faRecord,className:"pi-h-6 pi-w-6"}))),h.default.createElement("div",{onClick:function(){return v.island.setIslandView("settings")},"data-tooltip-id":"tooltip-settings-view-recorder","data-tooltip-content":N("Tooltip.Go to settings")||"",className:"pi-flex pi-items-center pi-justify-center pi-cursor-pointer pi-text-gray-700 dark:pi-text-gray-200 pi-w-6 pi-h-6 pi-flex-none"},h.default.createElement(r.FontAwesomeIcon,{icon:o.faGear,className:"pi-h-6 pi-w-6"})),h.default.createElement(u.CustomThemedTooltip,{id:"tooltip-start-recording-recorder-view",place:"top"}),h.default.createElement(u.CustomThemedTooltip,{id:"tooltip-stop-recorder-view",place:"top"}),h.default.createElement(u.CustomThemedTooltip,{id:"tooltip-confirm-record-view",place:"top"}),h.default.createElement(u.CustomThemedTooltip,{id:"tooltip-settings-view-recorder",place:"top"}))};
|
|
2
2
|
//# sourceMappingURL=Actions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Actions.js","sources":["../../../src/components/RecorderView/Actions.tsx"],"sourcesContent":["//\n// Copyright (C) 2024 Nethesis S.r.l.\n// SPDX-License-Identifier: AGPL-3.0-or-later\n//\n\nimport React, { type FC, useEffect } from 'react'\nimport { Button } from '../Button'\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\nimport {\n faStop,\n faCircleNotch,\n faGear,\n faDownLeftAndUpRightToCenter,\n faFloppyDisk,\n} from '@fortawesome/free-solid-svg-icons'\nimport { startAnnouncementRecording } from '../../services/offhour'\nimport { useDispatch, useSelector, shallowEqual } from 'react-redux'\nimport { Dispatch, RootState } from '../../store'\nimport { hangupCurrentCall, answerIncomingCall } from '../../lib/phone/call'\nimport { dispatchRecordingSave } from '../../events'\nimport { useTranslation } from 'react-i18next'\nimport { useEventListener, eventDispatch } from '../../utils'\nimport { CustomThemedTooltip } from '../CustomThemedTooltip'\nimport { faRecord } from '@nethesis/nethesis-solid-svg-icons'\n\nexport const Actions: FC<{}> = () => {\n const dispatch = useDispatch<Dispatch>()\n const { incoming, waiting, recording, recorded, playing } = useSelector(\n (state: RootState) => ({\n incoming: state.recorder.incoming,\n waiting: state.recorder.waiting,\n recording: state.recorder.recording,\n recorded: state.recorder.recorded,\n playing: state.recorder.playing,\n }),\n shallowEqual,\n )\n\n async function handleStart() {\n // Update the recorder state\n dispatch.recorder.setRecording(true)\n dispatch.recorder.setWaiting(true)\n // Call the api to start the recording call\n const data: { tempFilename: string } | null = await startAnnouncementRecording()\n // Set the returned temp file name to the store\n if (data.tempFilename) dispatch.recorder.setTempFilename(data.tempFilename)\n // Set the start time of recording\n dispatch.recorder.setStartTime(`${Date.now() / 1000}`)\n eventDispatch('phone-island-recording-started', {})\n }\n useEventListener('phone-island-recording-start', (data: {}) => {\n handleStart()\n })\n\n function handleStop() {\n // Set waiting to true\n dispatch.recorder.setWaiting(true)\n // Call the function to hangup the current call used for recording\n hangupCurrentCall()\n dispatch.recorder.setRecorded(true)\n eventDispatch('phone-island-recording-stopped', {})\n }\n useEventListener('phone-island-recording-stop', (data: {}) => {\n handleStop()\n })\n\n function handleSaveRecording() {\n // check if the audio is playing and pause it\n if (playing) {\n dispatch.player.pauseAudioPlayer()\n dispatch.recorder.setPlaying(false)\n dispatch.recorder.setPaused(true)\n }\n // Dispatch the reconrding save event\n dispatchRecordingSave()\n // Close the Island\n dispatch.island.setIslandView(null)\n }\n useEventListener('phone-island-recording-save', (data: {}) => {\n handleSaveRecording()\n })\n\n useEffect(() => {\n if (!recording) {\n dispatch.recorder.setWaiting(false)\n }\n }, [recording])\n\n useEffect(() => {\n if (incoming) {\n // Answer the incoming call for recording\n answerIncomingCall()\n // Reset incoming to recorder state\n dispatch.recorder.setIncoming(false)\n dispatch.recorder.setWaiting(false)\n }\n }, [incoming])\n\n const { t } = useTranslation()\n\n return (\n <div\n className={`pi-flex pi-items-center pi-justify-between pi-px-6 pi-py-2 pi-gap-0 pi-w-full pi-mt-auto`}\n >\n <Button\n variant='transparent'\n disabled\n className='pi-w-6 pi-h-6 pi-flex pi-items-center pi-justify-center pi-flex-none'\n >\n <FontAwesomeIcon icon={faDownLeftAndUpRightToCenter} className='pi-w-6 pi-h-6' />\n </Button>\n\n <div className='pi-flex pi-items-center pi-justify-center pi-flex-grow'>\n {recording && (\n <Button\n onClick={handleStop}\n variant='default'\n className='pi-rounded-full pi-w-14 pi-h-14 pi-flex pi-items-center pi-justify-center'\n data-tooltip-id='tooltip-stop-recorder-view'\n data-tooltip-content={t('Tooltip.Stop') || ''}\n >\n {waiting ? (\n <FontAwesomeIcon icon={faCircleNotch} className='fa-spin pi-loader' size='lg' />\n ) : (\n <FontAwesomeIcon icon={faStop} size='xl' />\n )}\n </Button>\n )}\n {recorded && !recording && (\n <Button\n onClick={handleSaveRecording}\n variant='default'\n className='pi-rounded-full pi-w-14 pi-h-14 pi-flex pi-items-center pi-justify-center'\n data-tooltip-id='tooltip-confirm-record-view'\n data-tooltip-content={t('Tooltip.Confirm') || ''}\n >\n <FontAwesomeIcon icon={faFloppyDisk} className='pi-h-6 pi-w-6' />\n </Button>\n )}\n {!recording && !recorded && (\n <Button\n onClick={handleStart}\n variant='default'\n className='pi-rounded-full pi-w-14 pi-h-14 pi-flex pi-items-center pi-justify-center'\n data-tooltip-id='tooltip-start-recording-recorder-view'\n data-tooltip-content={t('Tooltip.Start recording') || ''}\n >\n {waiting ? (\n <FontAwesomeIcon icon={faCircleNotch} className='fa-spin pi-loader' size='lg' />\n ) : (\n <FontAwesomeIcon icon={faRecord} className='pi-h-6 pi-w-6' />\n )}\n </Button>\n )}\n </div>\n\n <div\n onClick={() => dispatch.island.setIslandView('settings')}\n data-tooltip-id='tooltip-settings-view-recorder'\n data-tooltip-content={t('Tooltip.Go to settings') || ''}\n className='pi-flex pi-items-center pi-justify-center pi-cursor-pointer pi-text-gray-700 dark:pi-text-gray-200 pi-w-6 pi-h-6 pi-flex-none'\n >\n <FontAwesomeIcon icon={faGear} className={`pi-h-6 pi-w-6`} />\n </div>\n\n {/* Buttons tooltips */}\n <CustomThemedTooltip id='tooltip-start-recording-recorder-view' place='top' />\n <CustomThemedTooltip id='tooltip-stop-recorder-view' place='top' />\n <CustomThemedTooltip id='tooltip-confirm-record-view' place='top' />\n <CustomThemedTooltip id='tooltip-settings-view-recorder' place='top' />\n </div>\n )\n}\n"],"names":["dispatch","useDispatch","_a","useSelector","state","incoming","recorder","waiting","recording","recorded","playing","shallowEqual","handleStart","setRecording","setWaiting","startAnnouncementRecording","data","sent","tempFilename","setTempFilename","setStartTime","concat","Date","now","eventDispatch","handleStop","hangupCurrentCall","setRecorded","handleSaveRecording","player","pauseAudioPlayer","setPlaying","setPaused","dispatchRecordingSave","island","setIslandView","useEventListener","useEffect","answerIncomingCall","setIncoming","t","useTranslation","React","createElement","className","Button","variant","disabled","FontAwesomeIcon","icon","faDownLeftAndUpRightToCenter","onClick","faCircleNotch","size","faStop","faFloppyDisk","faRecord","faGear","CustomThemedTooltip","id","place"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Actions.js","sources":["../../../src/components/RecorderView/Actions.tsx"],"sourcesContent":["//\n// Copyright (C) 2024 Nethesis S.r.l.\n// SPDX-License-Identifier: AGPL-3.0-or-later\n//\n\nimport React, { type FC, useEffect } from 'react'\nimport { Button } from '../Button'\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\nimport {\n faStop,\n faCircleNotch,\n faGear,\n faDownLeftAndUpRightToCenter,\n faFloppyDisk,\n} from '@fortawesome/free-solid-svg-icons'\nimport { startAnnouncementRecording } from '../../services/offhour'\nimport { useDispatch, useSelector, shallowEqual } from 'react-redux'\nimport { Dispatch, RootState } from '../../store'\nimport { hangupCurrentCall, answerIncomingCall } from '../../lib/phone/call'\nimport { dispatchRecordingSave } from '../../events'\nimport { useTranslation } from 'react-i18next'\nimport { useEventListener, eventDispatch } from '../../utils'\nimport { CustomThemedTooltip } from '../CustomThemedTooltip'\nimport { faRecord } from '@nethesis/nethesis-solid-svg-icons'\n\nexport const Actions: FC<{}> = () => {\n const dispatch = useDispatch<Dispatch>()\n const { incoming, waiting, recording, recorded, playing } = useSelector(\n (state: RootState) => ({\n incoming: state.recorder.incoming,\n waiting: state.recorder.waiting,\n recording: state.recorder.recording,\n recorded: state.recorder.recorded,\n playing: state.recorder.playing,\n }),\n shallowEqual,\n )\n\n async function handleStart() {\n // Update the recorder state\n dispatch.recorder.setRecording(true)\n dispatch.recorder.setWaiting(true)\n // Call the api to start the recording call\n const data: { tempFilename: string } | null = await startAnnouncementRecording()\n // Set the returned temp file name to the store\n if (data.tempFilename) dispatch.recorder.setTempFilename(data.tempFilename)\n // Set the start time of recording\n dispatch.recorder.setStartTime(`${Date.now() / 1000}`)\n eventDispatch('phone-island-recording-started', {})\n }\n useEventListener('phone-island-recording-start', (data: {}) => {\n handleStart()\n })\n\n function handleStop() {\n // Set waiting to true\n dispatch.recorder.setWaiting(true)\n // Call the function to hangup the current call used for recording\n hangupCurrentCall()\n dispatch.recorder.setRecorded(true)\n eventDispatch('phone-island-recording-stopped', {})\n }\n useEventListener('phone-island-recording-stop', (data: {}) => {\n handleStop()\n })\n\n function handleSaveRecording() {\n // check if the audio is playing and pause it\n if (playing) {\n dispatch.player.pauseAudioPlayer()\n dispatch.recorder.setPlaying(false)\n dispatch.recorder.setPaused(true)\n }\n // Dispatch the reconrding save event\n dispatchRecordingSave()\n // Close the Island\n dispatch.island.setIslandView(null)\n }\n useEventListener('phone-island-recording-save', (data: {}) => {\n handleSaveRecording()\n })\n\n useEffect(() => {\n if (!recording) {\n dispatch.recorder.setWaiting(false)\n }\n }, [recording])\n\n useEffect(() => {\n if (incoming) {\n // Answer the incoming call for recording\n answerIncomingCall()\n // Reset incoming to recorder state\n dispatch.recorder.setIncoming(false)\n dispatch.recorder.setWaiting(false)\n }\n }, [incoming])\n\n const { t } = useTranslation()\n\n return (\n <div\n className={`pi-flex pi-items-center pi-justify-between pi-px-6 pi-py-2 pi-gap-0 pi-w-full pi-mt-auto`}\n >\n <Button\n variant='transparent'\n disabled\n className='pi-w-6 pi-h-6 pi-flex pi-items-center pi-justify-center pi-flex-none'\n >\n <FontAwesomeIcon icon={faDownLeftAndUpRightToCenter} className='pi-w-6 pi-h-6' />\n </Button>\n\n <div className='pi-flex pi-items-center pi-justify-center pi-flex-grow'>\n {recording && (\n <Button\n onClick={handleStop}\n variant='default'\n className='pi-rounded-full pi-w-14 pi-h-14 pi-flex pi-items-center pi-justify-center'\n data-tooltip-id='tooltip-stop-recorder-view'\n data-tooltip-content={t('Tooltip.Stop') || ''}\n >\n {waiting ? (\n <FontAwesomeIcon icon={faCircleNotch} className='fa-spin pi-loader' size='lg' />\n ) : (\n <FontAwesomeIcon icon={faStop} size='xl' />\n )}\n </Button>\n )}\n {recorded && !recording && (\n <Button\n onClick={handleSaveRecording}\n variant='default'\n className='pi-rounded-full pi-w-14 pi-h-14 pi-flex pi-items-center pi-justify-center'\n data-tooltip-id='tooltip-confirm-record-view'\n data-tooltip-content={t('Tooltip.Confirm') || ''}\n >\n <FontAwesomeIcon icon={faFloppyDisk} className='pi-h-6 pi-w-6' />\n </Button>\n )}\n {!recording && !recorded && (\n <Button\n onClick={handleStart}\n variant='default'\n className='pi-rounded-full pi-w-14 pi-h-14 pi-flex pi-items-center pi-justify-center'\n data-tooltip-id='tooltip-start-recording-recorder-view'\n data-tooltip-content={t('Tooltip.Start recording') || ''}\n >\n {waiting ? (\n <FontAwesomeIcon icon={faCircleNotch} className='fa-spin pi-loader' size='lg' />\n ) : (\n <FontAwesomeIcon icon={faRecord} className='pi-h-6 pi-w-6' />\n )}\n </Button>\n )}\n </div>\n\n <div\n onClick={() => dispatch.island.setIslandView('settings')}\n data-tooltip-id='tooltip-settings-view-recorder'\n data-tooltip-content={t('Tooltip.Go to settings') || ''}\n className='pi-flex pi-items-center pi-justify-center pi-cursor-pointer pi-text-gray-700 dark:pi-text-gray-200 pi-w-6 pi-h-6 pi-flex-none'\n >\n <FontAwesomeIcon icon={faGear} className={`pi-h-6 pi-w-6`} />\n </div>\n\n {/* Buttons tooltips */}\n <CustomThemedTooltip id='tooltip-start-recording-recorder-view' place='top' />\n <CustomThemedTooltip id='tooltip-stop-recorder-view' place='top' />\n <CustomThemedTooltip id='tooltip-confirm-record-view' place='top' />\n <CustomThemedTooltip id='tooltip-settings-view-recorder' place='top' />\n </div>\n )\n}\n"],"names":["dispatch","useDispatch","_a","useSelector","state","incoming","recorder","waiting","recording","recorded","playing","shallowEqual","handleStart","setRecording","setWaiting","startAnnouncementRecording","data","sent","tempFilename","setTempFilename","setStartTime","concat","Date","now","eventDispatch","handleStop","hangupCurrentCall","setRecorded","handleSaveRecording","player","pauseAudioPlayer","setPlaying","setPaused","dispatchRecordingSave","island","setIslandView","useEventListener","useEffect","answerIncomingCall","setIncoming","t","useTranslation","React","createElement","className","Button","variant","disabled","FontAwesomeIcon","icon","faDownLeftAndUpRightToCenter","onClick","faCircleNotch","size","faStop","faFloppyDisk","faRecord","faGear","CustomThemedTooltip","id","place"],"mappings":"m8CAyB+B,WAC7B,IAAMA,EAAWC,EAAAA,cACXC,EAAsDC,EAAAA,YAC1D,SAACC,GAAqB,MAAC,CAC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M,QAC3DlB,EAAC,QAAAC,cAAAe,uBAAoBC,GAAG,8BAA8BC,MAAM,QAC5DlB,UAAAC,cAACe,EAAAA,oBAAmB,CAACC,GAAG,iCAAiCC,MAAM,QAGrE"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");require("../../node_modules/react-redux/es/index.js");var t=require("../../store/index.js"),i=require("../../node_modules/@fortawesome/react-fontawesome/dist/index.js"),r=require("../../node_modules/@fortawesome/free-solid-svg-icons/index.mjs.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");require("../../node_modules/react-redux/es/index.js");var t=require("../../store/index.js"),i=require("../../node_modules/@fortawesome/react-fontawesome/dist/index.js"),r=require("../../node_modules/@fortawesome/free-solid-svg-icons/index.mjs.js"),s=require("../../utils/customHooks/useEventListener.js"),a=require("../../utils/genericFunctions/eventDispatch.js"),o=require("../../utils/genericFunctions/localStorage.js");require("../../node_modules/tslib/tslib.es6.js"),require("../../services/user.js");var l=require("./SettingsHeader.js");require("../../node_modules/i18next/dist/esm/i18next.js"),require("../../node_modules/react-i18next/dist/es/context.js");var n=require("../../node_modules/react-i18next/dist/es/useTranslation.js"),u=require("../../lib/devices/devices.js"),c=require("../../node_modules/react-redux/es/hooks/useSelector.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=d(e);exports.default=function(){var d=c.useSelector(function(e){return e.player.remoteAudio}),m=n.useTranslation().t,f=t.store.select.mediaDevices.audioOutputDevices(t.store.getState()),v=e.useState(u.getCurrentAudioOutputDeviceId()||null),x=v[0],g=v[1],b=function(e){g(e),null==d||d.current.setSinkId(e).then(function(){console.info("Audio output device switch success!"),o.setJSONItem("phone-island-audio-output-device",{deviceId:e}),a.eventDispatch("phone-island-call-audio-output-switched",{})}).catch(function(e){console.error("Audio output device switch error:",e)})};s.useEventListener("phone-island-call-audio-output-switch",function(e){b(e.deviceId)});var h=e.useState(null),y=h[0],k=h[1];return p.default.createElement("div",{className:"pi-flex pi-flex-col pi-w-full"},p.default.createElement(l.SettingsHeader,{title:m("Settings.Speakers"),tooltipPrefix:"audio"}),p.default.createElement("div",{className:"pi-flex pi-flex-col pi-mt-2 pi-space-y-1 pi-max-h-48 pi-overflow-y-auto pi-scrollbar-thin pi-scrollbar-thumb-gray-400 pi-dark:scrollbar-thumb-gray-400 pi-scrollbar-thumb-rounded-full pi-scrollbar-thumb-opacity-50 dark:pi-scrollbar-track-gray-900 pi-scrollbar-track-gray-200 pi-dark:scrollbar-track-gray-900 pi-scrollbar-track-rounded-full pi-scrollbar-track-opacity-25"},f.map(function(e,t){return p.default.createElement("div",{key:t,className:"pi-flex pi-items-center pi-justify-between pi-px-4 pi-py-3 pi-text-base pi-font-normal pi-leading-6 dark:pi-text-gray-200 pi-text-gray-700 hover:pi-bg-gray-200 dark:hover:pi-bg-gray-700 dark:pi-bg-gray-950 pi-bg-gray-50 pi-rounded-md pi-cursor-pointer",onClick:function(){return b(null==e?void 0:e.deviceId)},onMouseEnter:function(){return k(null==e?void 0:e.deviceId)},onMouseLeave:function(){return k(null)}},p.default.createElement("div",{className:"pi-flex pi-items-center"},p.default.createElement(i.FontAwesomeIcon,{icon:r.faVolumeHigh,className:"pi-mr-2 pi-w-5 pi-h-5"}),p.default.createElement("span",null,(null==e?void 0:e.label)||"Input device ".concat(t+1))),p.default.createElement("div",{className:"pi-flex pi-items-center"},x===(null==e?void 0:e.deviceId)&&p.default.createElement(i.FontAwesomeIcon,{icon:r.faCheck,className:"".concat(y===(null==e?void 0:e.deviceId)?"pi-text-gray-700 dark:pi-text-gray-200":"pi-text-emerald-700 dark:pi-text-emerald-500"," pi-w-5 pi-h-5")})))})))};
|
|
2
2
|
//# sourceMappingURL=AudioView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AudioView.js","sources":["../../../src/components/SettingsView/AudioView.tsx"],"sourcesContent":["// Copyright (C) 2025 Nethesis S.r.l.\n// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport React, { useState } from 'react'\nimport { useSelector } from 'react-redux'\nimport { RootState, store } from '../../store'\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\nimport { faCheck, faVolumeHigh } from '@fortawesome/free-solid-svg-icons'\nimport { eventDispatch, setJSONItem, useEventListener } from '../../utils'\nimport { SettingsHeader } from './SettingsHeader'\nimport { useTranslation } from 'react-i18next'\nimport { getCurrentAudioOutputDeviceId } from '../../lib/devices/devices'\n\nconst AudioView = () => {\n const remoteAudioElement: any = useSelector((state: RootState) => state.player.remoteAudio)\n\n const { t } = useTranslation()\n const audioOutputDevices = store.select.mediaDevices.audioOutputDevices(store.getState())\n const [selectedAudioOutput, setSelectedAudioOutput] = useState<string | null>(\n getCurrentAudioOutputDeviceId() || null,\n )\n const handleClickAudioOutput = (audioOutputDevice: string) => {\n setSelectedAudioOutput(audioOutputDevice)\n\n remoteAudioElement?.current\n .setSinkId(audioOutputDevice)\n .then(function () {\n console.info('Audio output device switch success!')\n // set device to localstorage\n setJSONItem('phone-island-audio-output-device', { deviceId: audioOutputDevice })\n\n // dispatch event\n eventDispatch('phone-island-call-audio-output-switched', {})\n })\n .catch(function (err) {\n console.error('Audio output device switch error:', err)\n })\n }\n useEventListener('phone-island-call-audio-output-switch', (data: DeviceInputOutputTypes) => {\n handleClickAudioOutput(data.deviceId)\n })\n\n const [hoveredDevice, setHoveredDevice] = useState<string | null>(null)\n\n return (\n <div className='pi-flex pi-flex-col pi-w-full'>\n {/* Title */}\n <SettingsHeader title={t('Settings.Speakers')} tooltipPrefix='audio' />\n {/* Audio List */}\n <div className='pi-flex pi-flex-col pi-mt-2 pi-space-y-1 pi-max-h-48 pi-overflow-y-auto pi-scrollbar-thin pi-scrollbar-thumb-gray-400 pi-dark:scrollbar-thumb-gray-400 pi-scrollbar-thumb-rounded-full pi-scrollbar-thumb-opacity-50 dark:pi-scrollbar-track-gray-900 pi-scrollbar-track-gray-200 pi-dark:scrollbar-track-gray-900 pi-scrollbar-track-rounded-full pi-scrollbar-track-opacity-25'>\n {audioOutputDevices.map((audioDevice, index) => (\n <div\n key={index}\n className='pi-flex pi-items-center pi-justify-between pi-px-4 pi-py-3 pi-text-base pi-font-normal pi-leading-6 dark:pi-text-gray-200 pi-text-gray-700 hover:pi-bg-gray-200 dark:hover:pi-bg-gray-700 dark:pi-bg-gray-950 pi-bg-gray-50 pi-rounded-md pi-cursor-pointer'\n onClick={() => handleClickAudioOutput(audioDevice?.deviceId)}\n onMouseEnter={() => setHoveredDevice(audioDevice?.deviceId)}\n onMouseLeave={() => setHoveredDevice(null)}\n >\n <div className='pi-flex pi-items-center'>\n <FontAwesomeIcon icon={faVolumeHigh} className='pi-mr-2 pi-w-5 pi-h-5' />\n <span>{audioDevice?.label || `Input device ${index + 1}`}</span>\n </div>\n <div className='pi-flex pi-items-center'>\n {selectedAudioOutput === audioDevice?.deviceId && (\n <FontAwesomeIcon\n icon={faCheck}\n className={`${\n hoveredDevice === audioDevice?.deviceId\n ? 'pi-text-gray-700 dark:pi-text-gray-200'\n : 'pi-text-emerald-700 dark:pi-text-emerald-500'\n } pi-w-5 pi-h-5`}\n />\n )}\n </div>\n </div>\n ))}\n </div>\n </div>\n )\n}\n\ninterface DeviceInputOutputTypes {\n deviceId: string\n}\n\nexport default AudioView\n"],"names":["remoteAudioElement","useSelector","state","player","remoteAudio","t","useTranslation","audioOutputDevices","store","select","mediaDevices","getState","_a","useState","getCurrentAudioOutputDeviceId","selectedAudioOutput","setSelectedAudioOutput","handleClickAudioOutput","audioOutputDevice","current","setSinkId","then","console","info","setJSONItem","deviceId","eventDispatch","catch","err","error","useEventListener","data","_b","hoveredDevice","setHoveredDevice","React","createElement","className","SettingsHeader","title","tooltipPrefix","map","audioDevice","index","key","onClick","onMouseEnter","onMouseLeave","FontAwesomeIcon","icon","faVolumeHigh","label","faCheck","concat"],"mappings":"
|
|
1
|
+
{"version":3,"file":"AudioView.js","sources":["../../../src/components/SettingsView/AudioView.tsx"],"sourcesContent":["// Copyright (C) 2025 Nethesis S.r.l.\n// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport React, { useState } from 'react'\nimport { useSelector } from 'react-redux'\nimport { RootState, store } from '../../store'\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\nimport { faCheck, faVolumeHigh } from '@fortawesome/free-solid-svg-icons'\nimport { eventDispatch, setJSONItem, useEventListener } from '../../utils'\nimport { SettingsHeader } from './SettingsHeader'\nimport { useTranslation } from 'react-i18next'\nimport { getCurrentAudioOutputDeviceId } from '../../lib/devices/devices'\n\nconst AudioView = () => {\n const remoteAudioElement: any = useSelector((state: RootState) => state.player.remoteAudio)\n\n const { t } = useTranslation()\n const audioOutputDevices = store.select.mediaDevices.audioOutputDevices(store.getState())\n const [selectedAudioOutput, setSelectedAudioOutput] = useState<string | null>(\n getCurrentAudioOutputDeviceId() || null,\n )\n const handleClickAudioOutput = (audioOutputDevice: string) => {\n setSelectedAudioOutput(audioOutputDevice)\n\n remoteAudioElement?.current\n .setSinkId(audioOutputDevice)\n .then(function () {\n console.info('Audio output device switch success!')\n // set device to localstorage\n setJSONItem('phone-island-audio-output-device', { deviceId: audioOutputDevice })\n\n // dispatch event\n eventDispatch('phone-island-call-audio-output-switched', {})\n })\n .catch(function (err) {\n console.error('Audio output device switch error:', err)\n })\n }\n useEventListener('phone-island-call-audio-output-switch', (data: DeviceInputOutputTypes) => {\n handleClickAudioOutput(data.deviceId)\n })\n\n const [hoveredDevice, setHoveredDevice] = useState<string | null>(null)\n\n return (\n <div className='pi-flex pi-flex-col pi-w-full'>\n {/* Title */}\n <SettingsHeader title={t('Settings.Speakers')} tooltipPrefix='audio' />\n {/* Audio List */}\n <div className='pi-flex pi-flex-col pi-mt-2 pi-space-y-1 pi-max-h-48 pi-overflow-y-auto pi-scrollbar-thin pi-scrollbar-thumb-gray-400 pi-dark:scrollbar-thumb-gray-400 pi-scrollbar-thumb-rounded-full pi-scrollbar-thumb-opacity-50 dark:pi-scrollbar-track-gray-900 pi-scrollbar-track-gray-200 pi-dark:scrollbar-track-gray-900 pi-scrollbar-track-rounded-full pi-scrollbar-track-opacity-25'>\n {audioOutputDevices.map((audioDevice, index) => (\n <div\n key={index}\n className='pi-flex pi-items-center pi-justify-between pi-px-4 pi-py-3 pi-text-base pi-font-normal pi-leading-6 dark:pi-text-gray-200 pi-text-gray-700 hover:pi-bg-gray-200 dark:hover:pi-bg-gray-700 dark:pi-bg-gray-950 pi-bg-gray-50 pi-rounded-md pi-cursor-pointer'\n onClick={() => handleClickAudioOutput(audioDevice?.deviceId)}\n onMouseEnter={() => setHoveredDevice(audioDevice?.deviceId)}\n onMouseLeave={() => setHoveredDevice(null)}\n >\n <div className='pi-flex pi-items-center'>\n <FontAwesomeIcon icon={faVolumeHigh} className='pi-mr-2 pi-w-5 pi-h-5' />\n <span>{audioDevice?.label || `Input device ${index + 1}`}</span>\n </div>\n <div className='pi-flex pi-items-center'>\n {selectedAudioOutput === audioDevice?.deviceId && (\n <FontAwesomeIcon\n icon={faCheck}\n className={`${\n hoveredDevice === audioDevice?.deviceId\n ? 'pi-text-gray-700 dark:pi-text-gray-200'\n : 'pi-text-emerald-700 dark:pi-text-emerald-500'\n } pi-w-5 pi-h-5`}\n />\n )}\n </div>\n </div>\n ))}\n </div>\n </div>\n )\n}\n\ninterface DeviceInputOutputTypes {\n deviceId: string\n}\n\nexport default AudioView\n"],"names":["remoteAudioElement","useSelector","state","player","remoteAudio","t","useTranslation","audioOutputDevices","store","select","mediaDevices","getState","_a","useState","getCurrentAudioOutputDeviceId","selectedAudioOutput","setSelectedAudioOutput","handleClickAudioOutput","audioOutputDevice","current","setSinkId","then","console","info","setJSONItem","deviceId","eventDispatch","catch","err","error","useEventListener","data","_b","hoveredDevice","setHoveredDevice","React","createElement","className","SettingsHeader","title","tooltipPrefix","map","audioDevice","index","key","onClick","onMouseEnter","onMouseLeave","FontAwesomeIcon","icon","faVolumeHigh","label","faCheck","concat"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AaS,QAAS,uBAAgBR,EAAQ,KAEvDR,EAAA,QAAAC,cAAA,MAAA,CAAKC,UAAU,2BACZtB,KAAwB2B,eAAAA,EAAajB,WACpCU,EAAAA,QAAAC,cAACY,EAAAA,gBAAe,CACdC,KAAMG,EAAOA,QACbf,UAAW,GACTgB,OAAApB,KAAkBS,aAAW,EAAXA,EAAajB,UAC3B,yCACA,+CACU,qBAKzB,IAIT"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");require("../../node_modules/react-redux/es/index.js");var t=require("../../store/index.js"),i=require("../../node_modules/@fortawesome/react-fontawesome/dist/index.js"),r=require("../../node_modules/@fortawesome/free-solid-svg-icons/index.mjs.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");require("../../node_modules/react-redux/es/index.js");var t=require("../../store/index.js"),i=require("../../node_modules/@fortawesome/react-fontawesome/dist/index.js"),r=require("../../node_modules/@fortawesome/free-solid-svg-icons/index.mjs.js"),s=require("../../utils/customHooks/useEventListener.js"),a=require("../../utils/genericFunctions/eventDispatch.js"),n=require("../../utils/genericFunctions/localStorage.js");require("../../node_modules/tslib/tslib.es6.js"),require("../../services/user.js");var o=require("./SettingsHeader.js");require("../../node_modules/i18next/dist/esm/i18next.js"),require("../../node_modules/react-i18next/dist/es/context.js");var l=require("../../node_modules/react-i18next/dist/es/useTranslation.js"),c=require("../../lib/devices/devices.js"),u=require("../../node_modules/react-redux/es/hooks/useSelector.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=d(e);exports.default=function(){var d=u.useSelector(function(e){return e.webrtc}).sipcall,m=l.useTranslation().t,f=e.useState(c.getCurrentAudioInputDeviceId()||null),v=f[0],x=f[1],b=t.store.select.mediaDevices.audioInputDevices(t.store.getState()),h=function(e){x(e),d.webrtcStuff.myStream?null==d||d.replaceTracks({tracks:[{type:"audio",mid:"0",capture:{deviceId:{exact:e}}}],success:function(){console.info("Audio input device switch success!"),n.setJSONItem("phone-island-audio-input-device",{deviceId:e}),a.eventDispatch("phone-island-call-audio-input-switched",{})},error:function(e){console.error("Audio input device switch error:",e)}}):(n.setJSONItem("phone-island-audio-input-device",{deviceId:e}),a.eventDispatch("phone-island-call-audio-input-switched",{}))};s.useEventListener("phone-island-call-audio-input-switch",function(e){h(e.deviceId)});var g=e.useState(null),y=g[0],k=g[1];return p.default.createElement("div",{className:"pi-flex pi-flex-col pi-w-full"},p.default.createElement(o.SettingsHeader,{title:m("Settings.Microphones"),tooltipPrefix:"microphone"}),p.default.createElement("div",{className:"pi-flex pi-flex-col pi-mt-2 pi-space-y-1 pi-max-h-48 pi-overflow-y-auto pi-scrollbar-thin pi-scrollbar-thumb-gray-400 pi-dark:scrollbar-thumb-gray-400 pi-scrollbar-thumb-rounded-full pi-scrollbar-thumb-opacity-50 dark:pi-scrollbar-track-gray-900 pi-scrollbar-track-gray-200 pi-dark:scrollbar-track-gray-900 pi-scrollbar-track-rounded-full pi-scrollbar-track-opacity-25"},b.map(function(e,t){return p.default.createElement("div",{key:t,className:"pi-flex pi-items-center pi-justify-between pi-px-4 pi-py-3 pi-text-base pi-font-normal pi-leading-6 dark:pi-text-gray-200 pi-text-gray-700 hover:pi-bg-gray-200 dark:hover:pi-bg-gray-700 dark:pi-bg-gray-950 pi-bg-gray-50 pi-rounded-md pi-cursor-pointer",onClick:function(){return h(null==e?void 0:e.deviceId)},onMouseEnter:function(){return k(null==e?void 0:e.deviceId)},onMouseLeave:function(){return k(null)}},p.default.createElement("div",{className:"pi-flex pi-items-center"},p.default.createElement(i.FontAwesomeIcon,{icon:r.faMicrophone,className:"pi-mr-2 pi-w-5 pi-h-5"}),p.default.createElement("span",null,(null==e?void 0:e.label)||"Input device ".concat(t+1))),p.default.createElement("div",{className:"pi-flex pi-items-center"},v===(null==e?void 0:e.deviceId)&&p.default.createElement(i.FontAwesomeIcon,{icon:r.faCheck,className:"".concat(y===(null==e?void 0:e.deviceId)?"pi-text-gray-700 dark:pi-text-gray-200":"pi-text-emerald-700 dark:pi-text-emerald-500"," pi-w-5 pi-h-5")})))})))};
|
|
2
2
|
//# sourceMappingURL=MicrophoneView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MicrophoneView.js","sources":["../../../src/components/SettingsView/MicrophoneView.tsx"],"sourcesContent":["// Copyright (C) 2024 Nethesis S.r.l.\n// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport React, { useState } from 'react'\nimport { useSelector } from 'react-redux'\nimport { RootState, store } from '../../store'\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\nimport { faCheck, faMicrophone } from '@fortawesome/free-solid-svg-icons'\nimport { eventDispatch, setJSONItem, useEventListener } from '../../utils'\nimport { SettingsHeader } from './SettingsHeader'\nimport { useTranslation } from 'react-i18next'\nimport { getCurrentAudioInputDeviceId } from '../../lib/devices/devices'\n\nconst MicrophoneView = () => {\n const { sipcall }: any = useSelector((state: RootState) => state.webrtc)\n const { t } = useTranslation()\n\n const [selectedAudioInput, setSelectedAudioInput] = useState<string | null>(\n getCurrentAudioInputDeviceId() || null,\n )\n const audioInputDevices = store.select.mediaDevices.audioInputDevices(store.getState())\n\n const handleClickAudioInput = (audioInputDevice: string) => {\n setSelectedAudioInput(audioInputDevice)\n\n if (sipcall.webrtcStuff.myStream) {\n sipcall?.replaceTracks({\n tracks: [\n {\n type: 'audio',\n mid: '0',\n capture: { deviceId: { exact: audioInputDevice } },\n },\n ],\n success: function () {\n console.info('Audio input device switch success!')\n setJSONItem('phone-island-audio-input-device', { deviceId: audioInputDevice })\n eventDispatch('phone-island-call-audio-input-switched', {})\n },\n error: function (err) {\n console.error('Audio input device switch error:', err)\n },\n })\n } else {\n setJSONItem('phone-island-audio-input-device', { deviceId: audioInputDevice })\n eventDispatch('phone-island-call-audio-input-switched', {})\n }\n }\n\n useEventListener('phone-island-call-audio-input-switch', (data: DeviceInputOutputTypes) => {\n handleClickAudioInput(data.deviceId)\n })\n\n const [hoveredDevice, setHoveredDevice] = useState<string | null>(null)\n\n return (\n <div className='pi-flex pi-flex-col pi-w-full'>\n {/* Title */}\n <SettingsHeader title={t('Settings.Microphones')} tooltipPrefix='microphone' />\n\n {/* Microphone List */}\n <div className='pi-flex pi-flex-col pi-mt-2 pi-space-y-1 pi-max-h-48 pi-overflow-y-auto pi-scrollbar-thin pi-scrollbar-thumb-gray-400 pi-dark:scrollbar-thumb-gray-400 pi-scrollbar-thumb-rounded-full pi-scrollbar-thumb-opacity-50 dark:pi-scrollbar-track-gray-900 pi-scrollbar-track-gray-200 pi-dark:scrollbar-track-gray-900 pi-scrollbar-track-rounded-full pi-scrollbar-track-opacity-25'>\n {audioInputDevices.map((audioDevice, index) => (\n <div\n key={index}\n className='pi-flex pi-items-center pi-justify-between pi-px-4 pi-py-3 pi-text-base pi-font-normal pi-leading-6 dark:pi-text-gray-200 pi-text-gray-700 hover:pi-bg-gray-200 dark:hover:pi-bg-gray-700 dark:pi-bg-gray-950 pi-bg-gray-50 pi-rounded-md pi-cursor-pointer'\n onClick={() => handleClickAudioInput(audioDevice?.deviceId)}\n onMouseEnter={() => setHoveredDevice(audioDevice?.deviceId)}\n onMouseLeave={() => setHoveredDevice(null)}\n >\n <div className='pi-flex pi-items-center'>\n <FontAwesomeIcon icon={faMicrophone} className='pi-mr-2 pi-w-5 pi-h-5' />\n <span>{audioDevice?.label || `Input device ${index + 1}`}</span>\n </div>\n <div className='pi-flex pi-items-center'>\n {selectedAudioInput === audioDevice?.deviceId && (\n <FontAwesomeIcon\n icon={faCheck}\n className={`${\n hoveredDevice === audioDevice?.deviceId\n ? 'pi-text-gray-700 dark:pi-text-gray-200'\n : 'pi-text-emerald-700 dark:pi-text-emerald-500'\n } pi-w-5 pi-h-5`}\n />\n )}\n </div>\n </div>\n ))}\n </div>\n </div>\n )\n}\n\ninterface DeviceInputOutputTypes {\n deviceId: string\n}\n\nexport default MicrophoneView\n"],"names":["sipcall","useSelector","state","webrtc","t","useTranslation","_a","useState","getCurrentAudioInputDeviceId","selectedAudioInput","setSelectedAudioInput","audioInputDevices","store","select","mediaDevices","getState","handleClickAudioInput","audioInputDevice","webrtcStuff","myStream","replaceTracks","tracks","type","mid","capture","deviceId","exact","success","console","info","setJSONItem","eventDispatch","error","err","useEventListener","data","_b","hoveredDevice","setHoveredDevice","React","createElement","className","SettingsHeader","title","tooltipPrefix","map","audioDevice","index","key","onClick","onMouseEnter","onMouseLeave","FontAwesomeIcon","icon","faMicrophone","label","faCheck","concat"],"mappings":"
|
|
1
|
+
{"version":3,"file":"MicrophoneView.js","sources":["../../../src/components/SettingsView/MicrophoneView.tsx"],"sourcesContent":["// Copyright (C) 2024 Nethesis S.r.l.\n// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport React, { useState } from 'react'\nimport { useSelector } from 'react-redux'\nimport { RootState, store } from '../../store'\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\nimport { faCheck, faMicrophone } from '@fortawesome/free-solid-svg-icons'\nimport { eventDispatch, setJSONItem, useEventListener } from '../../utils'\nimport { SettingsHeader } from './SettingsHeader'\nimport { useTranslation } from 'react-i18next'\nimport { getCurrentAudioInputDeviceId } from '../../lib/devices/devices'\n\nconst MicrophoneView = () => {\n const { sipcall }: any = useSelector((state: RootState) => state.webrtc)\n const { t } = useTranslation()\n\n const [selectedAudioInput, setSelectedAudioInput] = useState<string | null>(\n getCurrentAudioInputDeviceId() || null,\n )\n const audioInputDevices = store.select.mediaDevices.audioInputDevices(store.getState())\n\n const handleClickAudioInput = (audioInputDevice: string) => {\n setSelectedAudioInput(audioInputDevice)\n\n if (sipcall.webrtcStuff.myStream) {\n sipcall?.replaceTracks({\n tracks: [\n {\n type: 'audio',\n mid: '0',\n capture: { deviceId: { exact: audioInputDevice } },\n },\n ],\n success: function () {\n console.info('Audio input device switch success!')\n setJSONItem('phone-island-audio-input-device', { deviceId: audioInputDevice })\n eventDispatch('phone-island-call-audio-input-switched', {})\n },\n error: function (err) {\n console.error('Audio input device switch error:', err)\n },\n })\n } else {\n setJSONItem('phone-island-audio-input-device', { deviceId: audioInputDevice })\n eventDispatch('phone-island-call-audio-input-switched', {})\n }\n }\n\n useEventListener('phone-island-call-audio-input-switch', (data: DeviceInputOutputTypes) => {\n handleClickAudioInput(data.deviceId)\n })\n\n const [hoveredDevice, setHoveredDevice] = useState<string | null>(null)\n\n return (\n <div className='pi-flex pi-flex-col pi-w-full'>\n {/* Title */}\n <SettingsHeader title={t('Settings.Microphones')} tooltipPrefix='microphone' />\n\n {/* Microphone List */}\n <div className='pi-flex pi-flex-col pi-mt-2 pi-space-y-1 pi-max-h-48 pi-overflow-y-auto pi-scrollbar-thin pi-scrollbar-thumb-gray-400 pi-dark:scrollbar-thumb-gray-400 pi-scrollbar-thumb-rounded-full pi-scrollbar-thumb-opacity-50 dark:pi-scrollbar-track-gray-900 pi-scrollbar-track-gray-200 pi-dark:scrollbar-track-gray-900 pi-scrollbar-track-rounded-full pi-scrollbar-track-opacity-25'>\n {audioInputDevices.map((audioDevice, index) => (\n <div\n key={index}\n className='pi-flex pi-items-center pi-justify-between pi-px-4 pi-py-3 pi-text-base pi-font-normal pi-leading-6 dark:pi-text-gray-200 pi-text-gray-700 hover:pi-bg-gray-200 dark:hover:pi-bg-gray-700 dark:pi-bg-gray-950 pi-bg-gray-50 pi-rounded-md pi-cursor-pointer'\n onClick={() => handleClickAudioInput(audioDevice?.deviceId)}\n onMouseEnter={() => setHoveredDevice(audioDevice?.deviceId)}\n onMouseLeave={() => setHoveredDevice(null)}\n >\n <div className='pi-flex pi-items-center'>\n <FontAwesomeIcon icon={faMicrophone} className='pi-mr-2 pi-w-5 pi-h-5' />\n <span>{audioDevice?.label || `Input device ${index + 1}`}</span>\n </div>\n <div className='pi-flex pi-items-center'>\n {selectedAudioInput === audioDevice?.deviceId && (\n <FontAwesomeIcon\n icon={faCheck}\n className={`${\n hoveredDevice === audioDevice?.deviceId\n ? 'pi-text-gray-700 dark:pi-text-gray-200'\n : 'pi-text-emerald-700 dark:pi-text-emerald-500'\n } pi-w-5 pi-h-5`}\n />\n )}\n </div>\n </div>\n ))}\n </div>\n </div>\n )\n}\n\ninterface DeviceInputOutputTypes {\n deviceId: string\n}\n\nexport default MicrophoneView\n"],"names":["sipcall","useSelector","state","webrtc","t","useTranslation","_a","useState","getCurrentAudioInputDeviceId","selectedAudioInput","setSelectedAudioInput","audioInputDevices","store","select","mediaDevices","getState","handleClickAudioInput","audioInputDevice","webrtcStuff","myStream","replaceTracks","tracks","type","mid","capture","deviceId","exact","success","console","info","setJSONItem","eventDispatch","error","err","useEventListener","data","_b","hoveredDevice","setHoveredDevice","React","createElement","className","SettingsHeader","title","tooltipPrefix","map","audioDevice","index","key","onClick","onMouseEnter","onMouseLeave","FontAwesomeIcon","icon","faMicrophone","label","faCheck","concat"],"mappings":"+gCAauB,WACb,IAAAA,EAAiBC,cAAY,SAACC,GAAqB,OAAAA,EAAMC,iBACzDC,EAAMC,qBAERC,EAA8CC,EAAQA,SAC1DC,kCAAkC,MAD7BC,EAAkBH,EAAA,GAAEI,OAGrBC,EAAoBC,EAAKA,MAACC,OAAOC,aAAaH,kBAAkBC,EAAKA,MAACG,YAEtEC,EAAwB,SAACC,GAC7BP,EAAsBO,GAElBjB,EAAQkB,YAAYC,SACtBnB,SAAAA,EAASoB,cAAc,CACrBC,OAAQ,CACN,CACEC,KAAM,QACNC,IAAK,IACLC,QAAS,CAAEC,SAAU,CAAEC,MAAOT,MAGlCU,QAAS,WACPC,QAAQC,KAAK,sCACbC,EAAAA,YAAY,kCAAmC,CAAEL,SAAUR,IAC3Dc,gBAAc,yCAA0C,CAAA,EACzD,EACDC,MAAO,SAAUC,GACfL,QAAQI,MAAM,mCAAoCC,EACnD,KAGHH,EAAAA,YAAY,kCAAmC,CAAEL,SAAUR,IAC3Dc,gBAAc,yCAA0C,CAAA,GAE5D,EAEAG,mBAAiB,uCAAwC,SAACC,GACxDnB,EAAsBmB,EAAKV,SAC7B,GAEM,IAAAW,EAAoC7B,EAAAA,SAAwB,MAA3D8B,EAAaD,EAAA,GAAEE,EAAgBF,EAAA,GAEtC,OACEG,EAAA,QAAAC,cAAA,MAAA,CAAKC,UAAU,iCAEbF,UAAAC,cAACE,EAAcA,eAAA,CAACC,MAAOvC,EAAE,wBAAyBwC,cAAc,eAGhEL,EAAAA,QAAAC,cAAA,MAAA,CAAKC,UAAU,oXACZ9B,EAAkBkC,IAAI,SAACC,EAAaC,GAAU,OAC7CR,EAAAA,QACEC,cAAA,MAAA,CAAAQ,IAAKD,EACLN,UAAU,8PACVQ,QAAS,WAAM,OAAAjC,EAAsB8B,aAAA,EAAAA,EAAarB,SAAS,EAC3DyB,aAAc,WAAM,OAAAZ,EAAiBQ,aAAW,EAAXA,EAAarB,SAA9B,EACpB0B,aAAc,WAAM,OAAAb,EAAiB,QAErCC,EAAAA,QAAKC,cAAA,MAAA,CAAAC,UAAU,2BACbF,EAAC,QAAAC,cAAAY,mBAAgBC,KAAMC,eAAcb,UAAU,0BAC/CF,EAAA,QAAAC,cAAA,OAAA,MAAOM,eAAAA,EAAaS,QAAS,uBAAgBR,EAAQ,KAEvDR,EAAA,QAAAC,cAAA,MAAA,CAAKC,UAAU,2BACZhC,KAAuBqC,eAAAA,EAAarB,WACnCc,EAAAA,QAAAC,cAACY,EAAAA,gBAAe,CACdC,KAAMG,EAAOA,QACbf,UAAW,GACTgB,OAAApB,KAAkBS,aAAW,EAAXA,EAAarB,UAC3B,yCACA,+CACU,qBAKzB,IAIT"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");require("../../node_modules/react-redux/es/index.js");var t=require("../../node_modules/@fortawesome/react-fontawesome/dist/index.js"),i=require("../../node_modules/@fortawesome/free-solid-svg-icons/index.mjs.js"),r=require("../../utils/genericFunctions/eventDispatch.js");require("../../node_modules/tslib/tslib.es6.js"),require("../../store/index.js");var a=require("./SettingsHeader.js");require("../../node_modules/i18next/dist/esm/i18next.js"),require("../../node_modules/react-i18next/dist/es/context.js");var n=require("../../node_modules/react-i18next/dist/es/useTranslation.js"),s=require("../../node_modules/react-redux/es/hooks/useSelector.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=o(e);exports.default=function(){var o=n.useTranslation().t,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");require("../../node_modules/react-redux/es/index.js");var t=require("../../node_modules/@fortawesome/react-fontawesome/dist/index.js"),i=require("../../node_modules/@fortawesome/free-solid-svg-icons/index.mjs.js"),r=require("../../utils/genericFunctions/eventDispatch.js");require("../../node_modules/tslib/tslib.es6.js"),require("../../store/index.js"),require("../../services/user.js");var a=require("./SettingsHeader.js");require("../../node_modules/i18next/dist/esm/i18next.js"),require("../../node_modules/react-i18next/dist/es/context.js");var n=require("../../node_modules/react-i18next/dist/es/useTranslation.js"),s=require("../../node_modules/react-redux/es/hooks/useSelector.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=o(e);exports.default=function(){var o=n.useTranslation().t,u=s.useSelector(function(e){return e.darkTheme}).theme,d=e.useState(null),c=d[0],p=d[1];return l.default.createElement("div",{className:"pi-flex pi-flex-col pi-w-full"},l.default.createElement(a.SettingsHeader,{title:o("Settings.Theme"),tooltipPrefix:"theme"}),l.default.createElement("div",{className:"pi-flex pi-flex-col pi-mt-2 pi-space-y-1"},[{id:"dark",icon:i.faMoon,label:"Settings.Dark"},{id:"light",icon:i.faSun,label:"Settings.Light"}].map(function(e){var a=e.id,n=e.icon,s=e.label;return l.default.createElement("div",{key:a,className:"pi-flex pi-items-center pi-justify-between pi-px-4 pi-py-3 pi-text-base pi-font-normal pi-leading-6 dark:pi-text-gray-200 pi-text-gray-700 hover:pi-bg-gray-200 dark:hover:pi-bg-gray-700 dark:pi-bg-gray-950 pi-bg-gray-50 pi-rounded-md",onClick:function(){return e=a,void r.eventDispatch("phone-island-theme-change",{selectedTheme:e});var e},onMouseEnter:function(){return p(a)},onMouseLeave:function(){return p(null)},"data-stop-propagation":!0},l.default.createElement(t.FontAwesomeIcon,{icon:n,className:"pi-mr-2 pi-w-5 pi-h-5"}),l.default.createElement("div",{className:"pi-ml-1 pi-flex-grow"},o(s)),u===a&&l.default.createElement(t.FontAwesomeIcon,{size:"lg",icon:i.faCheck,className:"".concat(c===a?"pi-text-gray-700 dark:pi-text-gray-200":"pi-text-emerald-700 dark:pi-text-emerald-500"," pi-w-5 pi-h-5")}))})))};
|
|
2
2
|
//# sourceMappingURL=ThemeView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeView.js","sources":["../../../src/components/SettingsView/ThemeView.tsx"],"sourcesContent":["// Copyright (C) 2025 Nethesis S.r.l.\n// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport React, { useState } from 'react'\nimport { useSelector } from 'react-redux'\nimport { RootState } from '../../store'\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\nimport { faCheck, faMoon, faSun } from '@fortawesome/free-solid-svg-icons'\nimport { eventDispatch } from '../../utils'\nimport { SettingsHeader } from './SettingsHeader'\nimport { useTranslation } from 'react-i18next'\n\nconst ThemeView = () => {\n const handleSelectTheme = (clickedTheme: string) => {\n eventDispatch('phone-island-theme-change', { selectedTheme: clickedTheme })\n }\n const { t } = useTranslation()\n\n const { theme } = useSelector((state: RootState) => state.darkTheme)\n const [hoveredDevice, setHoveredDevice] = useState<string | null>(null)\n\n return (\n <div className='pi-flex pi-flex-col pi-w-full'>\n {/* Title */}\n <SettingsHeader title={t('Settings.Theme')} tooltipPrefix='theme' />\n {/* Theme List */}\n <div className='pi-flex pi-flex-col pi-mt-2 pi-space-y-1'>\n {[\n { id: 'dark', icon: faMoon, label: 'Settings.Dark' },\n { id: 'light', icon: faSun, label: 'Settings.Light' },\n ].map(({ id, icon, label }) => (\n <div\n key={id}\n className='pi-flex pi-items-center pi-justify-between pi-px-4 pi-py-3 pi-text-base pi-font-normal pi-leading-6 dark:pi-text-gray-200 pi-text-gray-700 hover:pi-bg-gray-200 dark:hover:pi-bg-gray-700 dark:pi-bg-gray-950 pi-bg-gray-50 pi-rounded-md'\n onClick={() => handleSelectTheme(id)}\n onMouseEnter={() => setHoveredDevice(id)}\n onMouseLeave={() => setHoveredDevice(null)}\n data-stop-propagation={true}\n >\n <FontAwesomeIcon icon={icon} className='pi-mr-2 pi-w-5 pi-h-5' />\n <div className='pi-ml-1 pi-flex-grow'>{t(label)}</div>\n {theme === id && (\n <FontAwesomeIcon\n size='lg'\n icon={faCheck}\n className={`${\n hoveredDevice === id\n ? 'pi-text-gray-700 dark:pi-text-gray-200'\n : 'pi-text-emerald-700 dark:pi-text-emerald-500'\n } pi-w-5 pi-h-5`}\n />\n )}\n </div>\n ))}\n </div>\n </div>\n )\n}\n\nexport default ThemeView\n"],"names":["t","useTranslation","theme","useSelector","state","darkTheme","_a","useState","hoveredDevice","setHoveredDevice","React","createElement","className","SettingsHeader","title","tooltipPrefix","id","icon","faMoon","label","faSun","map","key","onClick","clickedTheme","eventDispatch","selectedTheme","onMouseEnter","onMouseLeave","FontAwesomeIcon","size","faCheck","concat"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ThemeView.js","sources":["../../../src/components/SettingsView/ThemeView.tsx"],"sourcesContent":["// Copyright (C) 2025 Nethesis S.r.l.\n// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport React, { useState } from 'react'\nimport { useSelector } from 'react-redux'\nimport { RootState } from '../../store'\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\nimport { faCheck, faMoon, faSun } from '@fortawesome/free-solid-svg-icons'\nimport { eventDispatch } from '../../utils'\nimport { SettingsHeader } from './SettingsHeader'\nimport { useTranslation } from 'react-i18next'\n\nconst ThemeView = () => {\n const handleSelectTheme = (clickedTheme: string) => {\n eventDispatch('phone-island-theme-change', { selectedTheme: clickedTheme })\n }\n const { t } = useTranslation()\n\n const { theme } = useSelector((state: RootState) => state.darkTheme)\n const [hoveredDevice, setHoveredDevice] = useState<string | null>(null)\n\n return (\n <div className='pi-flex pi-flex-col pi-w-full'>\n {/* Title */}\n <SettingsHeader title={t('Settings.Theme')} tooltipPrefix='theme' />\n {/* Theme List */}\n <div className='pi-flex pi-flex-col pi-mt-2 pi-space-y-1'>\n {[\n { id: 'dark', icon: faMoon, label: 'Settings.Dark' },\n { id: 'light', icon: faSun, label: 'Settings.Light' },\n ].map(({ id, icon, label }) => (\n <div\n key={id}\n className='pi-flex pi-items-center pi-justify-between pi-px-4 pi-py-3 pi-text-base pi-font-normal pi-leading-6 dark:pi-text-gray-200 pi-text-gray-700 hover:pi-bg-gray-200 dark:hover:pi-bg-gray-700 dark:pi-bg-gray-950 pi-bg-gray-50 pi-rounded-md'\n onClick={() => handleSelectTheme(id)}\n onMouseEnter={() => setHoveredDevice(id)}\n onMouseLeave={() => setHoveredDevice(null)}\n data-stop-propagation={true}\n >\n <FontAwesomeIcon icon={icon} className='pi-mr-2 pi-w-5 pi-h-5' />\n <div className='pi-ml-1 pi-flex-grow'>{t(label)}</div>\n {theme === id && (\n <FontAwesomeIcon\n size='lg'\n icon={faCheck}\n className={`${\n hoveredDevice === id\n ? 'pi-text-gray-700 dark:pi-text-gray-200'\n : 'pi-text-emerald-700 dark:pi-text-emerald-500'\n } pi-w-5 pi-h-5`}\n />\n )}\n </div>\n ))}\n </div>\n </div>\n )\n}\n\nexport default ThemeView\n"],"names":["t","useTranslation","theme","useSelector","state","darkTheme","_a","useState","hoveredDevice","setHoveredDevice","React","createElement","className","SettingsHeader","title","tooltipPrefix","id","icon","faMoon","label","faSun","map","key","onClick","clickedTheme","eventDispatch","selectedTheme","onMouseEnter","onMouseLeave","FontAwesomeIcon","size","faCheck","concat"],"mappings":"g3BAYkB,WAChB,IAGQA,EAAMC,qBAENC,EAAUC,cAAY,SAACC,GAAqB,OAAAA,EAAMC,kBACpDC,EAAoCC,EAAAA,SAAwB,MAA3DC,EAAaF,EAAA,GAAEG,EAAgBH,EAAA,GAEtC,OACEI,EAAA,QAAAC,cAAA,MAAA,CAAKC,UAAU,iCAEbF,UAAAC,cAACE,EAAcA,eAAA,CAACC,MAAOd,EAAE,kBAAmBe,cAAc,UAE1DL,EAAAA,QAAKC,cAAA,MAAA,CAAAC,UAAU,4CACZ,CACC,CAAEI,GAAI,OAAQC,KAAMC,EAAAA,OAAQC,MAAO,iBACnC,CAAEH,GAAI,QAASC,KAAMG,EAAAA,MAAOD,MAAO,mBACnCE,IAAI,SAACf,GAAE,IAAAU,OAAIC,EAAIX,EAAAW,KAAEE,EAAKb,EAAAa,MAAO,OAC7BT,EACE,QAAAC,cAAA,MAAA,CAAAW,IAAKN,EACLJ,UAAU,4OACVW,QAAS,WAAM,OArBEC,EAqBgBR,OApBzCS,EAAAA,cAAc,4BAA6B,CAAEC,cAAeF,IADpC,IAACA,GAsBjBG,aAAc,WAAM,OAAAlB,EAAiBO,EAAG,EACxCY,aAAc,WAAM,OAAAnB,EAAiB,KAAjB,2BACG,GAEvBC,EAAC,QAAAC,cAAAkB,mBAAgBZ,KAAMA,EAAML,UAAU,0BACvCF,UAAKC,cAAA,MAAA,CAAAC,UAAU,wBAAwBZ,EAAEmB,IACxCjB,IAAUc,GACTN,EAAAA,sBAACmB,EAAAA,gBAAe,CACdC,KAAK,KACLb,KAAMc,EAAOA,QACbnB,UAAW,GACToB,OAAAxB,IAAkBQ,EACd,yCACA,+CAA8C,oBAK3D,IAIT"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");require("../../node_modules/react-redux/es/index.js");var t=require("../../store/index.js"),i=require("../../node_modules/@fortawesome/react-fontawesome/dist/index.js"),r=require("../../node_modules/@fortawesome/free-solid-svg-icons/index.mjs.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");require("../../node_modules/react-redux/es/index.js");var t=require("../../store/index.js"),i=require("../../node_modules/@fortawesome/react-fontawesome/dist/index.js"),r=require("../../node_modules/@fortawesome/free-solid-svg-icons/index.mjs.js"),s=require("../../node_modules/i18next/dist/esm/i18next.js"),n=require("../../utils/customHooks/useEventListener.js"),a=require("../../utils/genericFunctions/eventDispatch.js"),l=require("../../utils/genericFunctions/localStorage.js");require("../../node_modules/tslib/tslib.es6.js"),require("../../services/user.js");var o=require("./SettingsHeader.js"),c=require("../../lib/devices/devices.js"),d=require("../../node_modules/react-redux/es/hooks/useSelector.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=u(e);exports.default=function(){var u=d.useSelector(function(e){return e.webrtc}).sipcall,v=e.useState(c.getCurrentVideoInputDeviceId()||null),m=v[0],f=v[1],g=t.store.select.mediaDevices.videoInputDevices(t.store.getState()),b=function(e){f(e),u.webrtcStuff.myStream?null==u||u.replaceTracks({tracks:[{type:"video",mid:"1",capture:{deviceId:{exact:e}}}],success:function(){console.info("Video input device switch success"),l.setJSONItem("phone-island-video-input-device",{deviceId:e}),a.eventDispatch("phone-island-call-video-input-switched",{})},error:function(e){console.error("Video input device switch error:",e)}}):(l.setJSONItem("phone-island-video-input-device",{deviceId:e}),a.eventDispatch("phone-island-call-video-input-switched",{}))};n.useEventListener("phone-island-call-video-input-switch",function(e){b(e.deviceId)});var x=e.useState(null),y=x[0],h=x[1];return p.default.createElement("div",{className:"pi-flex pi-flex-col pi-w-full"},p.default.createElement(o.SettingsHeader,{title:s.t("Settings.Cameras"),tooltipPrefix:"video"}),p.default.createElement("div",{className:"pi-flex pi-flex-col pi-mt-2 pi-space-y-1 pi-max-h-48 pi-overflow-y-auto pi-scrollbar-thin pi-scrollbar-thumb-gray-400 pi-dark:scrollbar-thumb-gray-400 pi-scrollbar-thumb-rounded-full pi-scrollbar-thumb-opacity-50 dark:pi-scrollbar-track-gray-900 pi-scrollbar-track-gray-200 pi-dark:scrollbar-track-gray-900 pi-scrollbar-track-rounded-full pi-scrollbar-track-opacity-25"},g.map(function(e,t){return p.default.createElement("div",{key:t,className:"pi-flex pi-items-center pi-justify-between pi-px-4 pi-py-3 pi-text-base pi-font-normal pi-leading-6 dark:pi-text-gray-200 pi-text-gray-700 hover:pi-bg-gray-200 dark:hover:pi-bg-gray-700 dark:pi-bg-gray-950 pi-bg-gray-50 pi-rounded-md pi-cursor-pointer",onClick:function(){return b(null==e?void 0:e.deviceId)},onMouseEnter:function(){return h(null==e?void 0:e.deviceId)},onMouseLeave:function(){return h(null)}},p.default.createElement("div",{className:"pi-flex pi-items-center"},p.default.createElement(i.FontAwesomeIcon,{icon:r.faVideo,className:" pi-mr-2"}),p.default.createElement("span",null,(null==e?void 0:e.label)||"Input device ".concat(t+1))),p.default.createElement("div",{className:"pi-flex pi-items-center"},m===(null==e?void 0:e.deviceId)&&p.default.createElement(i.FontAwesomeIcon,{icon:r.faCheck,className:"".concat(y===(null==e?void 0:e.deviceId)?"pi-text-gray-500 dark:pi-text-gray-200":"pi-text-green-600 dark:pi-text-green-400")})))})))};
|
|
2
2
|
//# sourceMappingURL=VideoInputView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VideoInputView.js","sources":["../../../src/components/SettingsView/VideoInputView.tsx"],"sourcesContent":["// Copyright (C) 2025 Nethesis S.r.l.\n// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport React, { useState } from 'react'\nimport { useSelector } from 'react-redux'\nimport { RootState, store } from '../../store'\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\nimport { faCheck, faVideo } from '@fortawesome/free-solid-svg-icons'\nimport { t } from 'i18next'\nimport { eventDispatch, setJSONItem, useEventListener } from '../../utils'\nimport { SettingsHeader } from './SettingsHeader'\nimport { getCurrentVideoInputDeviceId } from '../../lib/devices/devices'\n\nconst VideoInputView = () => {\n const { sipcall }: any = useSelector((state: RootState) => state.webrtc)\n\n const [selectedVideoInput, setSelectedVideoInput] = useState<string | null>(\n getCurrentVideoInputDeviceId() || null,\n )\n const videoInputDevices = store.select.mediaDevices.videoInputDevices(store.getState())\n\n const handleClickVideoInput = (videoInputDevice: string) => {\n setSelectedVideoInput(videoInputDevice)\n\n if (sipcall.webrtcStuff.myStream) {\n sipcall?.replaceTracks({\n tracks: [\n {\n type: 'video',\n mid: '1',\n capture: { deviceId: { exact: videoInputDevice } },\n },\n ],\n success: function () {\n console.info('Video input device switch success')\n setJSONItem('phone-island-video-input-device', { deviceId: videoInputDevice })\n eventDispatch('phone-island-call-video-input-switched', {})\n },\n error: function (err) {\n console.error('Video input device switch error:', err)\n },\n })\n } else {\n setJSONItem('phone-island-video-input-device', { deviceId: videoInputDevice })\n eventDispatch('phone-island-call-video-input-switched', {})\n }\n }\n\n useEventListener('phone-island-call-video-input-switch', (data: DeviceInputOutputTypes) => {\n handleClickVideoInput(data.deviceId)\n })\n\n const [hoveredDevice, setHoveredDevice] = useState<string | null>(null)\n\n return (\n <div className='pi-flex pi-flex-col pi-w-full'>\n {/* Title */}\n <SettingsHeader title={t('Settings.Cameras')} tooltipPrefix='video' />\n\n {/* Video input list */}\n <div className='pi-flex pi-flex-col pi-mt-2 pi-space-y-1 pi-max-h-48 pi-overflow-y-auto pi-scrollbar-thin pi-scrollbar-thumb-gray-400 pi-dark:scrollbar-thumb-gray-400 pi-scrollbar-thumb-rounded-full pi-scrollbar-thumb-opacity-50 dark:pi-scrollbar-track-gray-900 pi-scrollbar-track-gray-200 pi-dark:scrollbar-track-gray-900 pi-scrollbar-track-rounded-full pi-scrollbar-track-opacity-25'>\n {videoInputDevices.map((videoDevice, index) => (\n <div\n key={index}\n className='pi-flex pi-items-center pi-justify-between pi-px-4 pi-py-3 pi-text-base pi-font-normal pi-leading-6 dark:pi-text-gray-200 pi-text-gray-700 hover:pi-bg-gray-200 dark:hover:pi-bg-gray-700 dark:pi-bg-gray-950 pi-bg-gray-50 pi-rounded-md pi-cursor-pointer'\n onClick={() => handleClickVideoInput(videoDevice?.deviceId)}\n onMouseEnter={() => setHoveredDevice(videoDevice?.deviceId)}\n onMouseLeave={() => setHoveredDevice(null)}\n >\n <div className='pi-flex pi-items-center'>\n <FontAwesomeIcon icon={faVideo} className=' pi-mr-2' />\n <span>{videoDevice?.label || `Input device ${index + 1}`}</span>\n </div>\n <div className='pi-flex pi-items-center'>\n {selectedVideoInput === videoDevice?.deviceId && (\n <FontAwesomeIcon\n icon={faCheck}\n className={`${\n hoveredDevice === videoDevice?.deviceId\n ? 'pi-text-gray-500 dark:pi-text-gray-200'\n : 'pi-text-green-600 dark:pi-text-green-400'\n }`}\n />\n )}\n </div>\n </div>\n ))}\n </div>\n </div>\n )\n}\n\ninterface DeviceInputOutputTypes {\n deviceId: string\n}\n\nexport default VideoInputView\n"],"names":["sipcall","useSelector","state","webrtc","_a","useState","getCurrentVideoInputDeviceId","selectedVideoInput","setSelectedVideoInput","videoInputDevices","store","select","mediaDevices","getState","handleClickVideoInput","videoInputDevice","webrtcStuff","myStream","replaceTracks","tracks","type","mid","capture","deviceId","exact","success","console","info","setJSONItem","eventDispatch","error","err","useEventListener","data","_b","hoveredDevice","setHoveredDevice","React","createElement","className","SettingsHeader","title","t","tooltipPrefix","map","videoDevice","index","key","onClick","onMouseEnter","onMouseLeave","FontAwesomeIcon","icon","faVideo","label","faCheck","concat"],"mappings":"
|
|
1
|
+
{"version":3,"file":"VideoInputView.js","sources":["../../../src/components/SettingsView/VideoInputView.tsx"],"sourcesContent":["// Copyright (C) 2025 Nethesis S.r.l.\n// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport React, { useState } from 'react'\nimport { useSelector } from 'react-redux'\nimport { RootState, store } from '../../store'\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\nimport { faCheck, faVideo } from '@fortawesome/free-solid-svg-icons'\nimport { t } from 'i18next'\nimport { eventDispatch, setJSONItem, useEventListener } from '../../utils'\nimport { SettingsHeader } from './SettingsHeader'\nimport { getCurrentVideoInputDeviceId } from '../../lib/devices/devices'\n\nconst VideoInputView = () => {\n const { sipcall }: any = useSelector((state: RootState) => state.webrtc)\n\n const [selectedVideoInput, setSelectedVideoInput] = useState<string | null>(\n getCurrentVideoInputDeviceId() || null,\n )\n const videoInputDevices = store.select.mediaDevices.videoInputDevices(store.getState())\n\n const handleClickVideoInput = (videoInputDevice: string) => {\n setSelectedVideoInput(videoInputDevice)\n\n if (sipcall.webrtcStuff.myStream) {\n sipcall?.replaceTracks({\n tracks: [\n {\n type: 'video',\n mid: '1',\n capture: { deviceId: { exact: videoInputDevice } },\n },\n ],\n success: function () {\n console.info('Video input device switch success')\n setJSONItem('phone-island-video-input-device', { deviceId: videoInputDevice })\n eventDispatch('phone-island-call-video-input-switched', {})\n },\n error: function (err) {\n console.error('Video input device switch error:', err)\n },\n })\n } else {\n setJSONItem('phone-island-video-input-device', { deviceId: videoInputDevice })\n eventDispatch('phone-island-call-video-input-switched', {})\n }\n }\n\n useEventListener('phone-island-call-video-input-switch', (data: DeviceInputOutputTypes) => {\n handleClickVideoInput(data.deviceId)\n })\n\n const [hoveredDevice, setHoveredDevice] = useState<string | null>(null)\n\n return (\n <div className='pi-flex pi-flex-col pi-w-full'>\n {/* Title */}\n <SettingsHeader title={t('Settings.Cameras')} tooltipPrefix='video' />\n\n {/* Video input list */}\n <div className='pi-flex pi-flex-col pi-mt-2 pi-space-y-1 pi-max-h-48 pi-overflow-y-auto pi-scrollbar-thin pi-scrollbar-thumb-gray-400 pi-dark:scrollbar-thumb-gray-400 pi-scrollbar-thumb-rounded-full pi-scrollbar-thumb-opacity-50 dark:pi-scrollbar-track-gray-900 pi-scrollbar-track-gray-200 pi-dark:scrollbar-track-gray-900 pi-scrollbar-track-rounded-full pi-scrollbar-track-opacity-25'>\n {videoInputDevices.map((videoDevice, index) => (\n <div\n key={index}\n className='pi-flex pi-items-center pi-justify-between pi-px-4 pi-py-3 pi-text-base pi-font-normal pi-leading-6 dark:pi-text-gray-200 pi-text-gray-700 hover:pi-bg-gray-200 dark:hover:pi-bg-gray-700 dark:pi-bg-gray-950 pi-bg-gray-50 pi-rounded-md pi-cursor-pointer'\n onClick={() => handleClickVideoInput(videoDevice?.deviceId)}\n onMouseEnter={() => setHoveredDevice(videoDevice?.deviceId)}\n onMouseLeave={() => setHoveredDevice(null)}\n >\n <div className='pi-flex pi-items-center'>\n <FontAwesomeIcon icon={faVideo} className=' pi-mr-2' />\n <span>{videoDevice?.label || `Input device ${index + 1}`}</span>\n </div>\n <div className='pi-flex pi-items-center'>\n {selectedVideoInput === videoDevice?.deviceId && (\n <FontAwesomeIcon\n icon={faCheck}\n className={`${\n hoveredDevice === videoDevice?.deviceId\n ? 'pi-text-gray-500 dark:pi-text-gray-200'\n : 'pi-text-green-600 dark:pi-text-green-400'\n }`}\n />\n )}\n </div>\n </div>\n ))}\n </div>\n </div>\n )\n}\n\ninterface DeviceInputOutputTypes {\n deviceId: string\n}\n\nexport default VideoInputView\n"],"names":["sipcall","useSelector","state","webrtc","_a","useState","getCurrentVideoInputDeviceId","selectedVideoInput","setSelectedVideoInput","videoInputDevices","store","select","mediaDevices","getState","handleClickVideoInput","videoInputDevice","webrtcStuff","myStream","replaceTracks","tracks","type","mid","capture","deviceId","exact","success","console","info","setJSONItem","eventDispatch","error","err","useEventListener","data","_b","hoveredDevice","setHoveredDevice","React","createElement","className","SettingsHeader","title","t","tooltipPrefix","map","videoDevice","index","key","onClick","onMouseEnter","onMouseLeave","FontAwesomeIcon","icon","faVideo","label","faCheck","concat"],"mappings":"s4BAauB,WACb,IAAAA,EAAiBC,cAAY,SAACC,GAAqB,OAAAA,EAAMC,iBAE3DC,EAA8CC,EAAQA,SAC1DC,kCAAkC,MAD7BC,EAAkBH,EAAA,GAAEI,OAGrBC,EAAoBC,EAAKA,MAACC,OAAOC,aAAaH,kBAAkBC,EAAKA,MAACG,YAEtEC,EAAwB,SAACC,GAC7BP,EAAsBO,GAElBf,EAAQgB,YAAYC,SACtBjB,SAAAA,EAASkB,cAAc,CACrBC,OAAQ,CACN,CACEC,KAAM,QACNC,IAAK,IACLC,QAAS,CAAEC,SAAU,CAAEC,M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yCACA,+CAMf,IAIT"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../node_modules/tslib/tslib.es6.js"),n=require("react");require("../../../node_modules/react-redux/es/index.js");var i=require("../../../store/index.js"),r=require("../../../utils/deviceUtils.js"),t=require("../../../lib/webrtc/janus.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../node_modules/tslib/tslib.es6.js"),n=require("react");require("../../../node_modules/react-redux/es/index.js");var i=require("../../../store/index.js"),r=require("../../../utils/deviceUtils.js"),t=require("../../../lib/webrtc/janus.js"),u=require("../../../lib/phone/trunk.js"),o=require("../../../lib/devices/devices.js"),l=require("../../../utils/genericFunctions/eventDispatch.js");require("../../../services/user.js");var s=require("../../../node_modules/react-redux/es/hooks/useDispatch.js"),a=require("../../../node_modules/react-redux/es/hooks/useSelector.js");exports.useSideViewLogic=function(d){var c,v,h,p,f,g,b,m,_=s.useDispatch(),S=a.useSelector(function(e){return e.currentUser}),k=a.useSelector(function(e){return e.users}),w=a.useSelector(function(e){return e.paramUrl}),j=i.store.select.mediaDevices.videoInputDevices(i.store.getState()),q=n.useRef(t.default),C=a.useSelector(function(e){return e.currentUser.conversations}),V=n.useState([]),D=V[0],y=V[1],T=n.useState(!0),U=T[0],I=T[1],x=n.useCallback(function(){var e=Object.values(C).find(function(e){return Object.keys(e).length>0});return e?Object.values(e)[0]:null},[C]),O=n.useCallback(function(e){if(_.island.toggleSideViewVisible(!1),"openUrl"===e){var n=Object.values(C).find(function(e){return Object.keys(e).length>0}),i=n?Object.values(n)[0]:null;if((null==i?void 0:i.connected)&&"in"===(null==i?void 0:i.direction)){var r={counterpartNum:i.counterpartNum,counterpartName:i.counterpartName,owner:i.owner,uniqueId:i.uniqueId,linkedId:i.linkedId,throughQueue:i.throughQueue,throughTrunk:i.throughTrunk,direction:i.direction,connected:i.connected};l.eventDispatch("phone-island-url-parameter-opened",r)}}else null!==e&&_.island.setIslandView(e)},[_.island,C]),Q=n.useCallback(function(){return e.__awaiter(void 0,void 0,void 0,function(){var n;return e.__generator(this,function(e){switch(e.label){case 0:return j.length>0?[4,o.checkWebCamPermission()]:[3,2];case 1:return n=e.sent(),I(n),[2,n];case 2:return I(!1),[2,!1]}})})},[j.length]),E=n.useCallback(function(){return e.__awaiter(void 0,void 0,void 0,function(){return e.__generator(this,function(e){switch(e.label){case 0:return[4,Q()];case 1:return e.sent()&&(O("video"),i.store.dispatch.currentCall.updateCurrentCall({isLocalVideoEnabled:!0,isStartingVideoCall:!0})),[2]}})})},[Q,O]),M=n.useCallback(function(){return e.__awaiter(void 0,void 0,void 0,function(){var n,r;return e.__generator(this,function(e){switch(e.label){case 0:if(i.store.getState().screenShare.active)return O("video"),[2];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,navigator.mediaDevices.getDisplayMedia({video:!0})];case 2:return n=e.sent(),[3,4];case 3:return r=e.sent(),console.warn("Screen share not started:",r),[2];case 4:return!i.store.getState().currentCall.accepted||i.store.getState().screenShare.active?(n.getTracks().forEach(function(e){return e.stop()}),[2]):(i.store.dispatch.screenShare.update({pendingScreenStream:n,isStartingScreenShare:!0}),O("video"),[2])}})})},[O]),N=n.useMemo(function(){var e;return(null===(e=null==S?void 0:S.profile)||void 0===e?void 0:e.macro_permissions)||{}},[null===(c=null==S?void 0:S.profile)||void 0===c?void 0:c.macro_permissions]),P=n.useMemo(function(){var e,n,i,r,t,u,o,l,s;return{canRecord:(null===(i=null===(n=null===(e=null==N?void 0:N.settings)||void 0===e?void 0:e.permissions)||void 0===n?void 0:n.recording)||void 0===i?void 0:i.value)||!1,canShareScreen:"safari"!==(null===(u=null===(t=null===(r=null==q?void 0:q.current)||void 0===r?void 0:r.webRTCAdapter)||void 0===t?void 0:t.browserDetails)||void 0===u?void 0:u.browser)&&((null===(s=null===(l=null===(o=null==N?void 0:N.nethvoice_cti)||void 0===o?void 0:o.permissions)||void 0===l?void 0:l.screen_sharing)||void 0===s?void 0:s.value)||!1),canSwitchDevice:(null==D?void 0:D.length)>0}},[null===(p=null===(h=null===(v=null==N?void 0:N.settings)||void 0===v?void 0:v.permissions)||void 0===h?void 0:h.recording)||void 0===p?void 0:p.value,null===(b=null===(g=null===(f=null==N?void 0:N.nethvoice_cti)||void 0===f?void 0:f.permissions)||void 0===g?void 0:g.screen_sharing)||void 0===b?void 0:b.value,null==D?void 0:D.length,null===(m=null==S?void 0:S.default_device)||void 0===m?void 0:m.type,d]),A=n.useMemo(function(){var e=x();if("never"===w.openParamUrlType)return!1;if(!(null==e?void 0:e.connected)||"in"!==(null==e?void 0:e.direction))return!1;if("button"===w.openParamUrlType){if(w.onlyQueues&&(null==e?void 0:e.throughQueue))return!0;if(!w.onlyQueues&&(u.isFromTrunk(e.counterpartNum)||(null==e?void 0:e.throughQueue)))return!0}return!1},[x,w.onlyQueues,w.openParamUrlType]);n.useEffect(function(){if(S&&k){var e=r.getAvailableDevices(S,k);y(e)}},[S,k]);var L=n.useCallback(function(){var e=x(),n=(null==e?void 0:e.linkedId)||(null==e?void 0:e.linkedid),i=(null==e?void 0:e.uniqueId)||(null==e?void 0:e.uniqueid);(n||i)&&(_.island.toggleSideViewVisible(!1),l.eventDispatch("phone-island-transcription-open",{linkedid:n,uniqueid:i}))},[_.island,x]),R=n.useMemo(function(){return(null==S?void 0:S.call_transcription_enabled)||!1},[null==S?void 0:S.call_transcription_enabled]);return e.__assign(e.__assign({userInformation:S,availableDevices:D,videoInputDevices:j,isVideoCallButtonVisible:U,isUrlButtonEnabled:A,hasValidUrl:w.hasValidUrl,isTranscriptionEnabled:R},P),{goToVideoCall:E,goToScreenSharing:M,closeSideViewAndLaunchEvent:O,openTranscriptionView:L})};
|
|
2
2
|
//# sourceMappingURL=useSideViewLogic.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSideViewLogic.js","sources":["../../../../src/components/SideView/hooks/useSideViewLogic.ts"],"sourcesContent":["import { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport { useDispatch, useSelector } from 'react-redux'\nimport { Dispatch, RootState, store } from '../../../store'\nimport { getAvailableDevices } from '../../../utils/deviceUtils'\nimport JanusLib from '../../../lib/webrtc/janus.js'\nimport { isFromTrunk } from '../../../lib/user/extensions'\nimport { checkWebCamPermission } from '../../../lib/devices/devices'\nimport { eventDispatch } from '../../../utils'\n\nexport interface UseSideViewLogicResult {\n userInformation: RootState['currentUser']\n availableDevices: any[]\n videoInputDevices: any[]\n isVideoCallButtonVisible: boolean\n isUrlButtonEnabled: boolean\n hasValidUrl: boolean\n isTranscriptionEnabled: boolean\n canRecord: boolean\n canShareScreen: boolean\n canSwitchDevice: boolean\n goToVideoCall: () => Promise<void>\n goToScreenSharing: () => void\n closeSideViewAndLaunchEvent: (viewType: any) => void\n openTranscriptionView: () => void\n}\n\nexport const useSideViewLogic = (uaType?: string): UseSideViewLogicResult => {\n const dispatch = useDispatch<Dispatch>()\n const userInformation = useSelector((state: RootState) => state.currentUser)\n const allUsersInformation = useSelector((state: RootState) => state.users)\n const paramUrlData = useSelector((state: RootState) => state.paramUrl)\n const videoInputDevices = store.select.mediaDevices.videoInputDevices(store.getState())\n const janus = useRef<any>(JanusLib)\n const conversations = useSelector((state: RootState) => state.currentUser.conversations)\n\n const [availableDevices, setAvailableDevices] = useState<any[]>([])\n const [isVideoCallButtonVisible, setIsVideoCallButtonVisible] = useState(true)\n\n const getActiveConversationData = useCallback(() => {\n const activeConversation = Object.values(conversations).find((conv) => Object.keys(conv).length > 0)\n return activeConversation ? (Object.values(activeConversation)[0] as any) : null\n }, [conversations])\n\n const closeSideViewAndLaunchEvent = useCallback(\n (viewType: any) => {\n dispatch.island.toggleSideViewVisible(false)\n if (viewType === 'openUrl') {\n const activeConversation = Object.values(conversations).find(\n (conv) => Object.keys(conv).length > 0,\n )\n const conversationData = activeConversation ? Object.values(activeConversation)[0] : null\n\n if (conversationData?.connected && conversationData?.direction === 'in') {\n const eventData = {\n counterpartNum: conversationData.counterpartNum,\n counterpartName: conversationData.counterpartName,\n owner: conversationData.owner,\n uniqueId: conversationData.uniqueId,\n linkedId: conversationData.linkedId,\n throughQueue: conversationData.throughQueue,\n throughTrunk: conversationData.throughTrunk,\n direction: conversationData.direction,\n connected: conversationData.connected,\n }\n eventDispatch('phone-island-url-parameter-opened', eventData)\n }\n } else if (viewType !== null) {\n dispatch.island.setIslandView(viewType)\n }\n },\n [dispatch.island, conversations],\n )\n\n const checkCameraPermission = useCallback(async () => {\n if (videoInputDevices.length > 0) {\n const isWebCamAccepted = await checkWebCamPermission()\n setIsVideoCallButtonVisible(isWebCamAccepted)\n return isWebCamAccepted\n } else {\n setIsVideoCallButtonVisible(false)\n return false\n }\n }, [videoInputDevices.length])\n\n const goToVideoCall = useCallback(async () => {\n const cameraPermission = await checkCameraPermission()\n if (cameraPermission) {\n closeSideViewAndLaunchEvent('video')\n store.dispatch.currentCall.updateCurrentCall({\n isLocalVideoEnabled: true,\n isStartingVideoCall: true,\n })\n }\n }, [checkCameraPermission, closeSideViewAndLaunchEvent])\n\n const goToScreenSharing = useCallback(async () => {\n // Pick the screen before anything else: the picker opens right away and, if the\n // user cancels, the island stays on the call view with nothing to undo\n if (store.getState().screenShare.active) {\n closeSideViewAndLaunchEvent('video')\n return\n }\n let pendingScreenStream: MediaStream\n try {\n pendingScreenStream = await navigator.mediaDevices.getDisplayMedia({ video: true })\n } catch (error) {\n console.warn('Screen share not started:', error)\n return\n }\n if (!store.getState().currentCall.accepted || store.getState().screenShare.active) {\n pendingScreenStream.getTracks().forEach((track) => track.stop())\n return\n }\n store.dispatch.screenShare.update({\n pendingScreenStream,\n isStartingScreenShare: true,\n })\n closeSideViewAndLaunchEvent('video')\n }, [closeSideViewAndLaunchEvent])\n\n const permissions = useMemo(\n () => userInformation?.profile?.macro_permissions || {},\n [userInformation?.profile?.macro_permissions],\n )\n\n const userCapabilities = useMemo(\n () => ({\n canRecord: permissions?.settings?.permissions?.recording?.value || false,\n canShareScreen:\n janus?.current?.webRTCAdapter?.browserDetails?.browser !== 'safari' &&\n (permissions?.nethvoice_cti?.permissions?.screen_sharing?.value || false),\n canSwitchDevice: availableDevices?.length > 0,\n }),\n [\n permissions?.settings?.permissions?.recording?.value,\n permissions?.nethvoice_cti?.permissions?.screen_sharing?.value,\n availableDevices?.length,\n userInformation?.default_device?.type,\n uaType,\n ],\n )\n\n const isUrlButtonEnabled = useMemo(() => {\n const conversationData = getActiveConversationData()\n\n // If param url type is 'never', return false\n if (paramUrlData.openParamUrlType === 'never') {\n return false\n }\n\n if (!conversationData?.connected || conversationData?.direction !== 'in') {\n return false\n }\n\n // open param url type is set to 'button'\n if (paramUrlData.openParamUrlType === 'button') {\n if (paramUrlData.onlyQueues && conversationData?.throughQueue) {\n return true\n } else if (\n !paramUrlData.onlyQueues &&\n (isFromTrunk(conversationData.counterpartNum) || conversationData?.throughQueue)\n ) {\n return true\n }\n }\n\n return false\n }, [getActiveConversationData, paramUrlData.onlyQueues, paramUrlData.openParamUrlType])\n\n useEffect(() => {\n if (userInformation && allUsersInformation) {\n const devices = getAvailableDevices(userInformation, allUsersInformation)\n setAvailableDevices(devices)\n }\n }, [userInformation, allUsersInformation])\n\n const openTranscriptionView = useCallback(() => {\n const conversationData = getActiveConversationData()\n const linkedId = conversationData?.linkedId || conversationData?.linkedid\n const uniqueId = conversationData?.uniqueId || conversationData?.uniqueid\n\n if (!linkedId && !uniqueId) {\n return\n }\n\n // Close SideView, collapse actions, and open TranscriptionView\n dispatch.island.toggleSideViewVisible(false)\n eventDispatch('phone-island-transcription-open', {\n linkedid: linkedId,\n uniqueid: uniqueId,\n })\n }, [dispatch.island, getActiveConversationData])\n\n const isTranscriptionEnabled = useMemo(\n () => userInformation?.call_transcription_enabled || false,\n [userInformation?.call_transcription_enabled],\n )\n\n return {\n userInformation,\n availableDevices,\n videoInputDevices,\n isVideoCallButtonVisible,\n isUrlButtonEnabled,\n hasValidUrl: paramUrlData.hasValidUrl,\n isTranscriptionEnabled,\n ...userCapabilities,\n goToVideoCall,\n goToScreenSharing,\n closeSideViewAndLaunchEvent,\n openTranscriptionView,\n }\n}\n"],"names":["uaType","dispatch","useDispatch","userInformation","useSelector","state","currentUser","allUsersInformation","users","paramUrlData","paramUrl","videoInputDevices","store","select","mediaDevices","getState","janus","useRef","JanusLib","conversations","_j","useState","availableDevices","setAvailableDevices","_k","isVideoCallButtonVisible","setIsVideoCallButtonVisible","getActiveConversationData","useCallback","activeConversation","Object","values","find","conv","keys","length","closeSideViewAndLaunchEvent","viewType","island","toggleSideViewVisible","conversationData","connected","direction","eventData","counterpartNum","counterpartName","owner","uniqueId","linkedId","throughQueue","throughTrunk","eventDispatch","setIslandView","checkCameraPermission","__awaiter","checkWebCamPermission","isWebCamAccepted","_a","sent","goToVideoCall","currentCall","updateCurrentCall","isLocalVideoEnabled","isStartingVideoCall","goToScreenSharing","screenShare","active","navigator","getDisplayMedia","video","pendingScreenStream","console","warn","error_1","accepted","getTracks","forEach","track","stop","update","isStartingScreenShare","permissions","useMemo","profile","macro_permissions","userCapabilities","canRecord","_c","settings","_b","recording","value","canShareScreen","_f","_d","current","webRTCAdapter","_e","browserDetails","browser","_h","nethvoice_cti","_g","screen_sharing","canSwitchDevice","default_device","type","isUrlButtonEnabled","openParamUrlType","onlyQueues","isFromTrunk","useEffect","devices","getAvailableDevices","openTranscriptionView","linkedid","uniqueid","isTranscriptionEnabled","call_transcription_enabled","__assign","hasValidUrl"],"mappings":"moBA0BgC,SAACA,uBACzBC,EAAWC,EAAAA,cACXC,EAAkBC,EAAWA,YAAC,SAACC,GAAqB,OAAAA,EAAMC,WAAN,GACpDC,EAAsBH,EAAWA,YAAC,SAACC,GAAqB,OAAAA,EAAMG,KAAN,GACxDC,EAAeL,EAAWA,YAAC,SAACC,GAAqB,OAAAA,EAAMK,QAAN,GACjDC,EAAoBC,EAAKA,MAACC,OAAOC,aAAaH,kBAAkBC,EAAKA,MAACG,YACtEC,EAAQC,SAAYC,EAAAA,SAC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AO,CACT,EAAG,CAACtB,EAA2BlB,EAAaoG,WAAYpG,EAAamG,mBAErEG,EAAAA,UAAU,WACR,GAAI5G,GAAmBI,EAAqB,CAC1C,IAAMyG,EAAUC,EAAAA,oBAAoB9G,EAAiBI,GACrDgB,EAAoByF,EACrB,CACH,EAAG,CAAC7G,EAAiBI,IAErB,IAAM2G,EAAwBtF,EAAAA,YAAY,WACxC,IAAMY,EAAmBb,IACnBqB,GAAWR,eAAAA,EAAkBQ,YAAYR,aAAgB,EAAhBA,EAAkB2E,UAC3DpE,GAAWP,eAAAA,EAAkBO,YAAYP,aAAgB,EAAhBA,EAAkB4E,WAE5DpE,GAAaD,KAKlB9C,EAASqC,OAAOC,uBAAsB,GACtCY,EAAAA,cAAc,kCAAmC,CAC/CgE,SAAUnE,EACVoE,SAAUrE,IAEb,EAAE,CAAC9C,EAASqC,OAAQX,IAEf0F,EAAyBnC,EAAAA,QAC7B,WAAM,OAAA/E,aAAA,EAAAA,EAAiBmH,8BAA8B,CAAK,EAC1D,CAACnH,aAAe,EAAfA,EAAiBmH,6BAGpB,OAAAC,EAAAA,SAAAA,EAAAA,SAAA,CACEpH,gBAAeA,EACfmB,iBAAgBA,EAChBX,kBAAiBA,EACjBc,2BACAkF,mBAAkBA,EAClBa,YAAa/G,EAAa+G,YAC1BH,uBAAsBA,GACnBhC,IACH1B,cAAaA,EACbK,oBACA5B,8BACA8E,yBAEJ"}
|
|
1
|
+
{"version":3,"file":"useSideViewLogic.js","sources":["../../../../src/components/SideView/hooks/useSideViewLogic.ts"],"sourcesContent":["import { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport { useDispatch, useSelector } from 'react-redux'\nimport { Dispatch, RootState, store } from '../../../store'\nimport { getAvailableDevices } from '../../../utils/deviceUtils'\nimport JanusLib from '../../../lib/webrtc/janus.js'\nimport { isFromTrunk } from '../../../lib/user/extensions'\nimport { checkWebCamPermission } from '../../../lib/devices/devices'\nimport { eventDispatch } from '../../../utils'\n\nexport interface UseSideViewLogicResult {\n userInformation: RootState['currentUser']\n availableDevices: any[]\n videoInputDevices: any[]\n isVideoCallButtonVisible: boolean\n isUrlButtonEnabled: boolean\n hasValidUrl: boolean\n isTranscriptionEnabled: boolean\n canRecord: boolean\n canShareScreen: boolean\n canSwitchDevice: boolean\n goToVideoCall: () => Promise<void>\n goToScreenSharing: () => void\n closeSideViewAndLaunchEvent: (viewType: any) => void\n openTranscriptionView: () => void\n}\n\nexport const useSideViewLogic = (uaType?: string): UseSideViewLogicResult => {\n const dispatch = useDispatch<Dispatch>()\n const userInformation = useSelector((state: RootState) => state.currentUser)\n const allUsersInformation = useSelector((state: RootState) => state.users)\n const paramUrlData = useSelector((state: RootState) => state.paramUrl)\n const videoInputDevices = store.select.mediaDevices.videoInputDevices(store.getState())\n const janus = useRef<any>(JanusLib)\n const conversations = useSelector((state: RootState) => state.currentUser.conversations)\n\n const [availableDevices, setAvailableDevices] = useState<any[]>([])\n const [isVideoCallButtonVisible, setIsVideoCallButtonVisible] = useState(true)\n\n const getActiveConversationData = useCallback(() => {\n const activeConversation = Object.values(conversations).find((conv) => Object.keys(conv).length > 0)\n return activeConversation ? (Object.values(activeConversation)[0] as any) : null\n }, [conversations])\n\n const closeSideViewAndLaunchEvent = useCallback(\n (viewType: any) => {\n dispatch.island.toggleSideViewVisible(false)\n if (viewType === 'openUrl') {\n const activeConversation = Object.values(conversations).find(\n (conv) => Object.keys(conv).length > 0,\n )\n const conversationData = activeConversation ? Object.values(activeConversation)[0] : null\n\n if (conversationData?.connected && conversationData?.direction === 'in') {\n const eventData = {\n counterpartNum: conversationData.counterpartNum,\n counterpartName: conversationData.counterpartName,\n owner: conversationData.owner,\n uniqueId: conversationData.uniqueId,\n linkedId: conversationData.linkedId,\n throughQueue: conversationData.throughQueue,\n throughTrunk: conversationData.throughTrunk,\n direction: conversationData.direction,\n connected: conversationData.connected,\n }\n eventDispatch('phone-island-url-parameter-opened', eventData)\n }\n } else if (viewType !== null) {\n dispatch.island.setIslandView(viewType)\n }\n },\n [dispatch.island, conversations],\n )\n\n const checkCameraPermission = useCallback(async () => {\n if (videoInputDevices.length > 0) {\n const isWebCamAccepted = await checkWebCamPermission()\n setIsVideoCallButtonVisible(isWebCamAccepted)\n return isWebCamAccepted\n } else {\n setIsVideoCallButtonVisible(false)\n return false\n }\n }, [videoInputDevices.length])\n\n const goToVideoCall = useCallback(async () => {\n const cameraPermission = await checkCameraPermission()\n if (cameraPermission) {\n closeSideViewAndLaunchEvent('video')\n store.dispatch.currentCall.updateCurrentCall({\n isLocalVideoEnabled: true,\n isStartingVideoCall: true,\n })\n }\n }, [checkCameraPermission, closeSideViewAndLaunchEvent])\n\n const goToScreenSharing = useCallback(async () => {\n // Pick the screen before anything else: the picker opens right away and, if the\n // user cancels, the island stays on the call view with nothing to undo\n if (store.getState().screenShare.active) {\n closeSideViewAndLaunchEvent('video')\n return\n }\n let pendingScreenStream: MediaStream\n try {\n pendingScreenStream = await navigator.mediaDevices.getDisplayMedia({ video: true })\n } catch (error) {\n console.warn('Screen share not started:', error)\n return\n }\n if (!store.getState().currentCall.accepted || store.getState().screenShare.active) {\n pendingScreenStream.getTracks().forEach((track) => track.stop())\n return\n }\n store.dispatch.screenShare.update({\n pendingScreenStream,\n isStartingScreenShare: true,\n })\n closeSideViewAndLaunchEvent('video')\n }, [closeSideViewAndLaunchEvent])\n\n const permissions = useMemo(\n () => userInformation?.profile?.macro_permissions || {},\n [userInformation?.profile?.macro_permissions],\n )\n\n const userCapabilities = useMemo(\n () => ({\n canRecord: permissions?.settings?.permissions?.recording?.value || false,\n canShareScreen:\n janus?.current?.webRTCAdapter?.browserDetails?.browser !== 'safari' &&\n (permissions?.nethvoice_cti?.permissions?.screen_sharing?.value || false),\n canSwitchDevice: availableDevices?.length > 0,\n }),\n [\n permissions?.settings?.permissions?.recording?.value,\n permissions?.nethvoice_cti?.permissions?.screen_sharing?.value,\n availableDevices?.length,\n userInformation?.default_device?.type,\n uaType,\n ],\n )\n\n const isUrlButtonEnabled = useMemo(() => {\n const conversationData = getActiveConversationData()\n\n // If param url type is 'never', return false\n if (paramUrlData.openParamUrlType === 'never') {\n return false\n }\n\n if (!conversationData?.connected || conversationData?.direction !== 'in') {\n return false\n }\n\n // open param url type is set to 'button'\n if (paramUrlData.openParamUrlType === 'button') {\n if (paramUrlData.onlyQueues && conversationData?.throughQueue) {\n return true\n } else if (\n !paramUrlData.onlyQueues &&\n (isFromTrunk(conversationData.counterpartNum) || conversationData?.throughQueue)\n ) {\n return true\n }\n }\n\n return false\n }, [getActiveConversationData, paramUrlData.onlyQueues, paramUrlData.openParamUrlType])\n\n useEffect(() => {\n if (userInformation && allUsersInformation) {\n const devices = getAvailableDevices(userInformation, allUsersInformation)\n setAvailableDevices(devices)\n }\n }, [userInformation, allUsersInformation])\n\n const openTranscriptionView = useCallback(() => {\n const conversationData = getActiveConversationData()\n const linkedId = conversationData?.linkedId || conversationData?.linkedid\n const uniqueId = conversationData?.uniqueId || conversationData?.uniqueid\n\n if (!linkedId && !uniqueId) {\n return\n }\n\n // Close SideView, collapse actions, and open TranscriptionView\n dispatch.island.toggleSideViewVisible(false)\n eventDispatch('phone-island-transcription-open', {\n linkedid: linkedId,\n uniqueid: uniqueId,\n })\n }, [dispatch.island, getActiveConversationData])\n\n const isTranscriptionEnabled = useMemo(\n () => userInformation?.call_transcription_enabled || false,\n [userInformation?.call_transcription_enabled],\n )\n\n return {\n userInformation,\n availableDevices,\n videoInputDevices,\n isVideoCallButtonVisible,\n isUrlButtonEnabled,\n hasValidUrl: paramUrlData.hasValidUrl,\n isTranscriptionEnabled,\n ...userCapabilities,\n goToVideoCall,\n goToScreenSharing,\n closeSideViewAndLaunchEvent,\n openTranscriptionView,\n }\n}\n"],"names":["uaType","dispatch","useDispatch","userInformation","useSelector","state","currentUser","allUsersInformation","users","paramUrlData","paramUrl","videoInputDevices","store","select","mediaDevices","getState","janus","useRef","JanusLib","conversations","_j","useState","availableDevices","setAvailableDevices","_k","isVideoCallButtonVisible","setIsVideoCallButtonVisible","getActiveConversationData","useCallback","activeConversation","Object","values","find","conv","keys","length","closeSideViewAndLaunchEvent","viewType","island","toggleSideViewVisible","conversationData","connected","direction","eventData","counterpartNum","counterpartName","owner","uniqueId","linkedId","throughQueue","throughTrunk","eventDispatch","setIslandView","checkCameraPermission","__awaiter","checkWebCamPermission","isWebCamAccepted","_a","sent","goToVideoCall","currentCall","updateCurrentCall","isLocalVideoEnabled","isStartingVideoCall","goToScreenSharing","screenShare","active","navigator","getDisplayMedia","video","pendingScreenStream","console","warn","error_1","accepted","getTracks","forEach","track","stop","update","isStartingScreenShare","permissions","useMemo","profile","macro_permissions","userCapabilities","canRecord","_c","settings","_b","recording","value","canShareScreen","_f","_d","current","webRTCAdapter","_e","browserDetails","browser","_h","nethvoice_cti","_g","screen_sharing","canSwitchDevice","default_device","type","isUrlButtonEnabled","openParamUrlType","onlyQueues","isFromTrunk","useEffect","devices","getAvailableDevices","openTranscriptionView","linkedid","uniqueid","isTranscriptionEnabled","call_transcription_enabled","__assign","hasValidUrl"],"mappings":"4qBA0BgC,SAACA,uBACzBC,EAAWC,EAAAA,cACXC,EAAkBC,EAAWA,YAAC,SAACC,GAAqB,OAAAA,EAAMC,WAAN,GACpDC,EAAsBH,EAAWA,YAAC,SAACC,GAAqB,OAAAA,EAAMG,KAAN,GACxDC,EAAeL,EAAWA,YAAC,SAACC,GAAqB,OAAAA,EAAMK,QAAN,GACjDC,EAAoBC,EAAKA,MAACC,OAAOC,aAAaH,kBAAkBC,EAAKA,MAACG,YACtEC,EAAQC,SAAYC,EAAAA,SACpBC,EAAgBf,cAAY,SAACC,GAAqB,OAAAA,EAAMC,YAAYa,aAAlB,GAElDC,EAA0CC,EAAAA,SAAgB,IAAzDC,EAAgBF,EAAA,GAAEG,EAAmBH,EAAA,GACtCI,EAA0DH,EAAAA,UAAS,GAAlEI,EAAwBD,EAAA,GAAEE,EAA2BF,EAAA,GAEtDG,EAA4BC,EAAAA,YAAY,WAC5C,IAAMC,E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