"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),i=require("../utils/customHooks/useEventListener.js"),r=require("../utils/genericFunctions/eventDispatch.js");require("../node_modules/tslib/tslib.es6.js"),require("../store/index.js");var t=require("../lib/player/audio.js");require("../node_modules/react-redux/es/index.js");var a=require("../node_modules/react-redux/es/hooks/useDispatch.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("../node_modules/react-redux/es/components/Context.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 s=n(e);exports.PlayerEvents=function(){var e=a.useDispatch();return i.useEventListener("phone-island-audio-player-start",(function(i){if(i.type){if("ringtone_preview"===i.type)return void(i.base64_audio_file&&(e.island.setIslandView("player"),e.player.setAudioPlayerType("ringtone_preview"),e.player.updateStartAudioPlayer({src:i.base64_audio_file,useRingtoneOutput:!0}),i.description&&e.player.setAudioPlayerTrackName(i.description)));if(!i.id)return void console.error("phone-island-audio-player-start: when a type is provided, the id is required");"announcement"===i.type?(t.getAnnouncementName(null==i?void 0:i.id),t.playAnnouncement(null==i?void 0:i.id)):"call_recording"===(null==i?void 0:i.type)?(t.getRecordingName(null==i?void 0:i.id),t.playCallRecording(null==i?void 0:i.id)):"voicemail"===(null==i?void 0:i.type)&&(t.getVoicemailName(null==i?void 0:i.id),t.playVoicemail(null==i?void 0:i.id))}else i.base64_audio_file&&(e.island.setIslandView("player"),e.player.resetAudioPlayerType(),e.player.updateStartAudioPlayer({src:i.base64_audio_file})),i.description&&e.player.setAudioPlayerTrackName(i.description)})),s.default.createElement(s.default.Fragment,null)},exports.dispatchAudioPlayerStarted=function(){r.eventDispatch("phone-island-audio-player-started",{})};
//# sourceMappingURL=PlayerEvents.js.map
