@nethesis/phone-island 0.7.59 → 0.7.60
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/CallView/Actions.js +1 -1
- package/dist/components/CallView/Actions.js.map +1 -1
- package/dist/components/Island.js +1 -1
- package/dist/components/Island.js.map +1 -1
- package/dist/components/KeypadView/Actions.js.map +1 -0
- package/dist/components/KeypadView/index.d.ts +5 -1
- package/dist/components/KeypadView/index.js +1 -1
- package/dist/components/KeypadView/index.js.map +1 -1
- package/dist/models/animations.js +1 -1
- package/dist/models/animations.js.map +1 -1
- package/dist/models/currentCall.d.ts +8 -8
- package/dist/models/currentCall.js +1 -1
- package/dist/models/currentCall.js.map +1 -1
- package/dist/models/island.d.ts +1 -1
- package/dist/models/island.js.map +1 -1
- package/dist/static/icons/{PhoneKeyboardLight.js → PhoneKeypadLight.js} +1 -1
- package/dist/static/icons/PhoneKeypadLight.js.map +1 -0
- package/dist/static/icons/{PhoneKeyboardSolid.js → PhoneKeypadSolid.js} +1 -1
- package/dist/static/icons/PhoneKeypadSolid.js.map +1 -0
- package/package.json +1 -1
- package/dist/components/KeyboardView/Actions.js.map +0 -1
- package/dist/components/KeyboardView/index.d.ts +0 -5
- package/dist/components/KeyboardView/index.js +0 -2
- package/dist/components/KeyboardView/index.js.map +0 -1
- package/dist/static/icons/PhoneKeyboardLight.js.map +0 -1
- package/dist/static/icons/PhoneKeyboardSolid.js.map +0 -1
- /package/dist/components/{KeyboardView → KeypadView}/Actions.d.ts +0 -0
- /package/dist/components/{KeyboardView → KeypadView}/Actions.js +0 -0
- /package/dist/static/icons/{PhoneKeyboardLight.d.ts → PhoneKeypadLight.d.ts} +0 -0
- /package/dist/static/icons/{PhoneKeyboardSolid.d.ts → PhoneKeypadSolid.d.ts} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("../../node_modules/@nethesis/nethesis-light-svg-icons/index.mjs.js"),r=require("../../lib/phone/call.js"),n=require("../../static/icons/
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("../../node_modules/@nethesis/nethesis-light-svg-icons/index.mjs.js"),r=require("../../lib/phone/call.js"),n=require("../../static/icons/PhoneKeypadLight.js"),s=require("../../static/icons/PhoneKeypadSolid.js");require("../../node_modules/react-redux/es/index.js"),require("../../node_modules/socket.io-client/build/esm/index.js"),require("../../store/index.js"),require("../../node_modules/webrtc-adapter/src/js/adapter_core.js"),require("../../lib/webrtc/janus.js"),require("../../node_modules/mic-check/lib/index.js"),require("../Island.js");var a=require("../Button.js");require("../AudioBars.js");var u=require("../../node_modules/@fortawesome/react-fontawesome/index.es.js"),i=require("../../node_modules/@nethesis/nethesis-solid-svg-icons/index.mjs.js"),l=require("../../node_modules/react-redux/es/hooks/useSelector.js"),o=require("../../node_modules/react-redux/es/hooks/useDispatch.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=c(e);exports.default=function(){var e=l.useSelector((function(e){return e.currentCall})),c=e.paused,f=e.muted,m=l.useSelector((function(e){return e.island})).view,j=o.useDispatch();return d.default.createElement("div",{className:"grid grid-cols-4 auto-cols-max gap-y-5 justify-items-center place-items-center justify-center"},d.default.createElement(a.Button,{variant:"default",active:!!c,onClick:function(){return c?r.unpauseCurrentCall():r.pauseCurrentCall()}},c?d.default.createElement(u.FontAwesomeIcon,{size:"xl",icon:i.faPlay}):d.default.createElement(u.FontAwesomeIcon,{size:"xl",icon:t.faPause})),d.default.createElement(a.Button,{variant:"default",active:!!f,onClick:function(){return f?r.unmuteCurrentCall():r.muteCurrentCall()}},f?d.default.createElement(u.FontAwesomeIcon,{size:"xl",icon:i.faMicrophoneSlash}):d.default.createElement(u.FontAwesomeIcon,{size:"xl",icon:t.faMicrophone})),d.default.createElement(a.Button,{variant:"default"},d.default.createElement(u.FontAwesomeIcon,{size:"xl",icon:t.faRightLeft})),d.default.createElement(a.Button,{variant:"default",onClick:function(){j.island.setIslandView("keypad"!==m?"keypad":"call")}},"keypad"===m?d.default.createElement(s.default,null):d.default.createElement(n.default,null)))};
|
|
2
2
|
//# sourceMappingURL=Actions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Actions.js","sources":["../../../src/components/CallView/Actions.tsx"],"sourcesContent":["// Copyright (C) 2022 Nethesis S.r.l.\n// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport React, { type FC } from 'react'\nimport {\n faPause as faPauseRegular,\n faMicrophone as faMicrophoneRegular,\n faRightLeft as faRightLeftRegualar,\n} from '@nethesis/nethesis-light-svg-icons'\nimport {\n muteCurrentCall,\n unmuteCurrentCall,\n pauseCurrentCall,\n unpauseCurrentCall,\n} from '../../lib/phone/call'\nimport
|
|
1
|
+
{"version":3,"file":"Actions.js","sources":["../../../src/components/CallView/Actions.tsx"],"sourcesContent":["// Copyright (C) 2022 Nethesis S.r.l.\n// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport React, { type FC } from 'react'\nimport {\n faPause as faPauseRegular,\n faMicrophone as faMicrophoneRegular,\n faRightLeft as faRightLeftRegualar,\n} from '@nethesis/nethesis-light-svg-icons'\nimport {\n muteCurrentCall,\n unmuteCurrentCall,\n pauseCurrentCall,\n unpauseCurrentCall,\n} from '../../lib/phone/call'\nimport PhoneKeypadLight from '../../static/icons/PhoneKeypadLight'\nimport PhoneKeypadSolid from '../../static/icons/PhoneKeypadSolid'\nimport { Button } from '../'\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\nimport { faMicrophoneSlash, faPlay } from '@nethesis/nethesis-solid-svg-icons'\nimport { RootState, Dispatch } from '../../store'\nimport { useSelector, useDispatch } from 'react-redux'\n\nconst Actions: FC = () => {\n // Get multiple values from currentCall store\n const { paused, muted } = useSelector((state: RootState) => state.currentCall)\n\n // Get isOpen and view from island store\n const { view } = useSelector((state: RootState) => state.island)\n\n const dispatch = useDispatch<Dispatch>()\n\n function openKeypad() {\n dispatch.island.setIslandView(view !== 'keypad' ? 'keypad' : 'call')\n }\n\n return (\n <div className='grid grid-cols-4 auto-cols-max gap-y-5 justify-items-center place-items-center justify-center'>\n <Button\n variant='default'\n active={paused ? true : false}\n onClick={() => (paused ? unpauseCurrentCall() : pauseCurrentCall())}\n >\n {paused ? (\n <FontAwesomeIcon size='xl' icon={faPlay} />\n ) : (\n <FontAwesomeIcon size='xl' icon={faPauseRegular} />\n )}\n </Button>\n <Button\n variant='default'\n active={muted ? true : false}\n onClick={() => (muted ? unmuteCurrentCall() : muteCurrentCall())}\n >\n {muted ? (\n <FontAwesomeIcon size='xl' icon={faMicrophoneSlash} />\n ) : (\n <FontAwesomeIcon size='xl' icon={faMicrophoneRegular} />\n )}\n </Button>\n <Button variant='default'>\n <FontAwesomeIcon size='xl' icon={faRightLeftRegualar} />\n </Button>\n <Button variant='default' onClick={openKeypad}>\n {view === 'keypad' ? <PhoneKeypadSolid /> : <PhoneKeypadLight />}\n </Button>\n </div>\n )\n}\n\nexport default Actions\n"],"names":["_a","useSelector","state","currentCall","paused","muted","view","island","dispatch","useDispatch","React","createElement","className","Button","variant","active","onClick","unpauseCurrentCall","pauseCurrentCall","FontAwesomeIcon","size","icon","faPlay","faPauseRegular","unmuteCurrentCall","muteCurrentCall","faMicrophoneSlash","faMicrophoneRegular","faRightLeftRegualar","faRightLeft","setIslandView","PhoneKeypadSolid","PhoneKeypadLight"],"mappings":"ykCAuBoB,WAEZ,IAAAA,EAAoBC,EAAAA,aAAY,SAACC,GAAqB,OAAAA,EAAMC,WAAW,IAArEC,WAAQC,UAGRC,EAASL,eAAY,SAACC,GAAqB,OAAAA,EAAMK,eAEnDC,EAAWC,EAAAA,cAMjB,OACEC,EAAA,QAAAC,cAAA,MAAA,CAAKC,UAAU,iGACbF,EAAA,QAAAC,cAACE,SAAM,CACLC,QAAQ,UACRC,SAAQX,EACRY,QAAS,WAAM,OAACZ,EAASa,EAAAA,qBAAuBC,EAAAA,qBAE/Cd,EACCM,EAAA,QAAAC,cAACQ,kBAAe,CAACC,KAAK,KAAKC,KAAMC,EAAAA,SAEjCZ,EAAA,QAAAC,cAACQ,EAAeA,gBAAC,CAAAC,KAAK,KAAKC,KAAME,EAAAA,WAGrCb,EAAA,QAAAC,cAACE,SAAM,CACLC,QAAQ,UACRC,SAAQV,EACRW,QAAS,WAAM,OAACX,EAAQmB,EAAAA,oBAAsBC,EAAAA,oBAE7CpB,EACCK,EAAA,QAAAC,cAACQ,kBAAe,CAACC,KAAK,KAAKC,KAAMK,EAAAA,oBAEjChB,EAAA,QAAAC,cAACQ,EAAeA,gBAAC,CAAAC,KAAK,KAAKC,KAAMM,EAAAA,gBAGrCjB,EAAAA,QAAAC,cAACE,EAAAA,OAAM,CAACC,QAAQ,WACdJ,UAACC,cAAAQ,EAAAA,gBAAgB,CAAAC,KAAK,KAAKC,KAAMO,EAAmBC,eAEtDnB,UAAAC,cAACE,EAAAA,OAAM,CAACC,QAAQ,UAAUE,QA/B9B,WACER,EAASD,OAAOuB,cAAuB,WAATxB,EAAoB,SAAW,OAC9D,GA8Be,WAATA,EAAoBI,EAAAA,QAACC,cAAAoB,UAAmB,MAAGrB,EAAAA,QAACC,cAAAqB,EAAgB,QAAG,OAIxE"}
|
|
@@ -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");require("../node_modules/react-redux/es/index.js");var r=require("../utils/customHooks/useIsomorphicLayoutEffect.js"),n=require("../utils/customHooks/useLocalStorage.js"),a=require("../utils/customHooks/useLongPress.js"),l=require("../utils/genericFunctions/styleTransformValues.js");require("../node_modules/framer-motion/dist/framer-motion.js");var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../node_modules/tslib/tslib.es6.js"),t=require("react");require("../node_modules/react-redux/es/index.js");var r=require("../utils/customHooks/useIsomorphicLayoutEffect.js"),n=require("../utils/customHooks/useLocalStorage.js"),a=require("../utils/customHooks/useLongPress.js"),l=require("../utils/genericFunctions/styleTransformValues.js");require("../node_modules/framer-motion/dist/framer-motion.js");var u=require("./CallView/index.js"),o=require("./KeypadView/index.js"),i=require("../lib/island/island.js"),s=require("./AlertGuard.js"),d=require("./CallView/BackCall.js"),c=require("./ViewsTransition.js"),f=require("../_virtual/framer-motion.js"),m=require("../node_modules/react-redux/es/hooks/useSelector.js"),p=require("../node_modules/react-redux/es/hooks/useDispatch.js");function y(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var x=y(t),v=function(y){var v=y.showAlways,w=m.useSelector((function(e){return e.currentCall})),g=w.incoming,E=w.accepted,h=w.outgoing,V=m.useSelector((function(e){return e.island})),j=V.isOpen,q=V.startPosition,k=V.view,P=m.useSelector((function(e){return e.alerts.status})).activeAlertsCount,A=m.useSelector((function(e){return e.animations})).variants,S=m.useSelector((function(e){return e.player})).audioPlayerLoop,b=f.framerMotion.exports.useDragControls(),_=n.useLocalStorage("phone-island",null),C=_[0],I=_[1],D=t.useRef(null),L=t.useRef(null),R=t.useState(C&&C.position?C.position:null),M=R[0],N=R[1],T=t.useState(!1),W=T[0],F=T[1],H=p.useDispatch();var O=a.useLongPress((function(){}),(function(){H.island.toggleIsOpen()}),W,(function(){return F(!1)}),{shouldPreventDefault:!0,delay:250}),G=t.useRef(null),z=t.useRef(null),B=t.useRef(null),K=t.useRef(null),J=t.useRef(null);r.useIsomorphicLayoutEffect((function(){H.player.updatePlayer({audioPlayer:G.current,localAudio:z.current,localVideo:K.current,remoteVideo:J.current,remoteAudio:B.current})}),[]),t.useEffect((function(){(g||h)&&H.island.setIslandView("call")}),[g,h]);var Q=t.useState(""),U=Q[0],X=Q[1];return t.useEffect((function(){setTimeout((function(){X(k)}),200)}),[k]),x.default.createElement("div",{ref:L,className:"absolute min-w-full min-h-full left-0 top-0 overflow-hidden pointer-events-none flex items-center justify-center content-center phone-island-container z-1000"},(g||h||E||v||P>0)&&x.default.createElement(x.default.Fragment,null,x.default.createElement(f.framerMotion.exports.motion.div,e.__assign({drag:!0,onPointerDown:function(e){b.start(e)},onDragStart:function(){F(!0)},dragTransition:{power:0},initial:{x:(null==M?void 0:M.x)||q.x,y:(null==M?void 0:M.y)||q.y},dragControls:b,dragConstraints:L,onDragEnd:function(){var e=l.styleTransformValues(D.current),t=e.x,r=e.y;t=i.xPosition(Math.round(t),D.current,L.current),r=i.yPosition(Math.round(r),D.current,L.current),I({position:{x:t,y:r}}),N({x:t,y:r})},ref:D},O,{className:"absolute"}),x.default.createElement(d.default,{isVisible:"keypad"===k}),x.default.createElement(f.framerMotion.exports.motion.div,{className:"font-sans pointer-events-auto overflow-hidden bg-black text-xs cursor-pointer text-white",animate:"call"===k?j&&(g||h)&&!E?P>0?A.callView.expandedIncomingWithAlerts:A.callView.expandedIncoming:j&&E?P>0?A.callView.expandedAcceptedWithAlerts:A.callView.expandedAccepted:P>0?A.expandedWithAlerts:A.callView.collapsed:"keypad"===k?j&&P>0?A.keypadView.expandedWithAlerts:j&&0===P?A.keypadView.expanded:j?"":A.keypadView.collapsed:""},x.default.createElement(s.AlertGuard,null,"call"===U?x.default.createElement(c.default,{forView:"call"},x.default.createElement(u.default,null)):"keypad"===U?x.default.createElement(c.default,{forView:"keypad"},x.default.createElement(o.default,null)):x.default.createElement(x.default.Fragment,null))))),x.default.createElement("div",{className:"hidden"},x.default.createElement("audio",{loop:S,ref:G}),x.default.createElement("audio",{muted:!0,ref:z}),x.default.createElement("audio",{autoPlay:!0,ref:B}),x.default.createElement("video",{muted:!0,autoPlay:!0,ref:K}),x.default.createElement("video",{autoPlay:!0,ref:J})))};v.displayName="Island",exports.Island=v;
|
|
2
2
|
//# sourceMappingURL=Island.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Island.js","sources":["../../src/components/Island.tsx"],"sourcesContent":["// Copyright (C) 2022 Nethesis S.r.l.\n// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport React, { useState, useRef, useEffect, type FC } from 'react'\nimport { useSelector, useDispatch } from 'react-redux'\nimport { RootState, Dispatch } from '../store'\nimport {\n useLongPress,\n useIsomorphicLayoutEffect,\n useLocalStorage,\n styleTransformValues,\n} from '../utils'\nimport { motion, useDragControls } from 'framer-motion/dist/framer-motion'\nimport CallView from './CallView'\nimport KeyboardView from './KeyboardView'\nimport { xPosition, yPosition } from '../lib/island/island'\nimport { AlertGuard } from './AlertGuard'\nimport BackCall from './CallView/BackCall'\nimport ViewsTransition from './ViewsTransition'\n\n/**\n * Provides the Island logic\n *\n * @param showAlways Sets the Island ever visible\n *\n */\nexport const Island: FC<IslandProps> = ({ showAlways }) => {\n // Get the currentCall info\n const { incoming, accepted, outgoing } = useSelector((state: RootState) => state.currentCall)\n // Get isOpen from island store\n const { isOpen, startPosition, view } = useSelector((state: RootState) => state.island)\n // Get activeAlertsCount from island store\n const { activeAlertsCount } = useSelector((state: RootState) => state.alerts.status)\n // Get variants from animations store\n const { variants } = useSelector((state: RootState) => state.animations)\n // Get audioPlayerLoop value from player store\n const { audioPlayerLoop } = useSelector((state: RootState) => state.player)\n\n // Initialize Island drag controls\n const controls = useDragControls()\n\n // Initialize Island storage\n const [phoneIslandStorage, setPhoneIslandStorage] =\n useLocalStorage<PhoneIslandStorageTypes | null>('phone-island', null)\n\n // The Island reference\n const islandRef = useRef<any>(null)\n // The Container reference\n const islandContainerRef = useRef<any>(null)\n\n // Initialize position or get from storage\n const [position, setPosition] = useState<PositionTypes | null>(\n phoneIslandStorage && phoneIslandStorage.position ? phoneIslandStorage.position : null,\n )\n\n // Initialize the moved property\n const [moved, setMoved] = useState<boolean>(false)\n // Initialize useDispatch\n const dispatch = useDispatch<Dispatch>()\n\n // Handles the drag started event\n function handleStartDrag(event) {\n controls.start(event)\n }\n // Handles log press event\n const handleLongPress = () => {}\n\n // Handle Island click\n const handleIslandClick = () => {\n dispatch.island.toggleIsOpen()\n }\n\n // Handles drag end event\n const handleDragEnd = () => {\n // Get initial transform values\n let { x, y }: any = styleTransformValues(islandRef.current)\n // Round position\n x = xPosition(Math.round(x), islandRef.current, islandContainerRef.current)\n y = yPosition(Math.round(y), islandRef.current, islandContainerRef.current)\n // Save the new position to localstorage\n setPhoneIslandStorage({\n position: {\n x,\n y,\n },\n })\n // Set position to variable\n setPosition({\n x,\n y,\n })\n }\n\n // Handles drag started event\n function handleDragStarted() {\n setMoved(true)\n }\n\n // Initialize the longPressEvent object\n const longPressEvent = useLongPress(\n handleLongPress,\n handleIslandClick,\n moved,\n () => setMoved(false),\n {\n shouldPreventDefault: true,\n delay: 250,\n },\n )\n\n const audioPlayer = useRef<HTMLAudioElement>(null)\n const localAudio = useRef<HTMLAudioElement>(null)\n const remoteAudio = useRef<HTMLAudioElement>(null)\n const localVideo = useRef<HTMLVideoElement>(null)\n const remoteVideo = useRef<HTMLVideoElement>(null)\n\n useIsomorphicLayoutEffect(() => {\n dispatch.player.updatePlayer({\n audioPlayer: audioPlayer.current,\n localAudio: localAudio.current,\n localVideo: localVideo.current,\n remoteVideo: remoteVideo.current,\n remoteAudio: remoteAudio.current,\n })\n }, [])\n\n // Handle and apply view switch logic\n useEffect(() => {\n if (incoming || outgoing) {\n dispatch.island.setIslandView('call')\n }\n }, [incoming, outgoing])\n\n const [currentView, setCurrentView] = useState<any>('')\n\n useEffect(() => {\n setTimeout(() => {\n setCurrentView(view)\n }, 200)\n }, [view])\n\n return (\n <div\n ref={islandContainerRef}\n className='absolute min-w-full min-h-full left-0 top-0 overflow-hidden pointer-events-none flex items-center justify-center content-center phone-island-container z-1000'\n >\n {(incoming || outgoing || accepted || showAlways || activeAlertsCount > 0) && (\n <>\n <motion.div\n drag\n onPointerDown={handleStartDrag}\n onDragStart={handleDragStarted}\n dragTransition={{\n power: 0,\n }}\n initial={{\n x: position?.x || startPosition.x,\n y: position?.y || startPosition.y,\n }}\n dragControls={controls}\n dragConstraints={islandContainerRef}\n onDragEnd={handleDragEnd}\n ref={islandRef}\n {...longPressEvent}\n className='absolute'\n >\n {/* Add background call visibility logic */}\n <BackCall isVisible={view === 'keyboard'} />\n <motion.div\n className='font-sans pointer-events-auto overflow-hidden bg-black text-xs cursor-pointer text-white'\n animate={\n view === 'call'\n ? isOpen && (incoming || outgoing) && !accepted\n ? // The call is incoming or outgoing\n activeAlertsCount > 0\n ? variants.callView.expandedIncomingWithAlerts\n : variants.callView.expandedIncoming\n : isOpen && accepted\n ? // The call is accepted and the island is expanded\n activeAlertsCount > 0\n ? variants.callView.expandedAcceptedWithAlerts\n : variants.callView.expandedAccepted\n : activeAlertsCount > 0\n ? variants.expandedWithAlerts\n : variants.callView.collapsed\n : view === 'keyboard'\n ? isOpen && activeAlertsCount > 0\n ? variants.keyboardView.expandedWithAlerts\n : isOpen && activeAlertsCount === 0\n ? variants.keyboardView.expanded\n : !isOpen\n ? variants.keyboardView.collapsed\n : ''\n : ''\n }\n >\n {/* The views logic */}\n <AlertGuard>\n {currentView === 'call' ? (\n <ViewsTransition forView='call'>\n <CallView />\n </ViewsTransition>\n ) : currentView === 'keyboard' ? (\n <ViewsTransition forView='keyboard'>\n <KeyboardView />\n </ViewsTransition>\n ) : (\n <></>\n )}\n </AlertGuard>\n </motion.div>\n </motion.div>\n </>\n )}\n <div className='hidden'>\n <audio loop={audioPlayerLoop} ref={audioPlayer}></audio>\n <audio muted={true} ref={localAudio}></audio>\n <audio autoPlay ref={remoteAudio}></audio>\n <video muted={true} autoPlay ref={localVideo}></video>\n <video autoPlay ref={remoteVideo}></video>\n </div>\n </div>\n )\n}\n\nIsland.displayName = 'Island'\n\ninterface IslandProps {\n showAlways?: boolean\n}\n\ninterface PositionTypes {\n x: number\n y: number\n}\n\ninterface PhoneIslandStorageTypes {\n position: PositionTypes\n}\n"],"names":["Island","_a","showAlways","_b","useSelector","state","currentCall","incoming","accepted","outgoing","_c","island","isOpen","startPosition","view","activeAlertsCount","alerts","status","variants","animations","audioPlayerLoop","player","controls","useDragControls","_d","useLocalStorage","phoneIslandStorage","setPhoneIslandStorage","islandRef","useRef","islandContainerRef","_e","useState","position","setPosition","_f","moved","setMoved","dispatch","useDispatch","longPressEvent","useLongPress","toggleIsOpen","shouldPreventDefault","delay","audioPlayer","localAudio","remoteAudio","localVideo","remoteVideo","useIsomorphicLayoutEffect","updatePlayer","current","useEffect","setIslandView","_g","currentView","setCurrentView","setTimeout","React","ref","className","createElement","Fragment","motion","div","__assign","drag","onPointerDown","event","start","onDragStart","dragTransition","power","initial","x","y","dragControls","dragConstraints","onDragEnd","styleTransformValues","xPosition","Math","round","yPosition","BackCall","isVisible","animate","callView","expandedIncomingWithAlerts","expandedIncoming","expandedAcceptedWithAlerts","expandedAccepted","expandedWithAlerts","collapsed","keyboardView","expanded","AlertGuard","ViewsTransition","forView","CallView","KeyboardView","loop","muted","autoPlay","displayName"],"mappings":"u7BA0BaA,EAA0B,SAACC,GAAE,IAAAC,EAAUD,EAAAC,WAE5CC,EAAmCC,EAAAA,aAAY,SAACC,GAAqB,OAAAA,EAAMC,eAAzEC,EAAQJ,EAAAI,SAAEC,EAAQL,EAAAK,SAAEC,EAAQN,EAAAM,SAE9BC,EAAkCN,EAAAA,aAAY,SAACC,GAAqB,OAAAA,EAAMM,UAAxEC,EAAMF,EAAAE,OAAEC,EAAaH,EAAAG,cAAEC,EAAIJ,EAAAI,KAE3BC,EAAsBX,EAAAA,aAAY,SAACC,GAAqB,OAAAA,EAAMW,OAAOC,4BAErEC,EAAad,eAAY,SAACC,GAAqB,OAAAA,EAAMc,uBAErDC,EAAoBhB,eAAY,SAACC,GAAqB,OAAAA,EAAMgB,0BAG9DC,EAAWC,EAAAA,aAAAA,QAAAA,kBAGXC,EACJC,EAAAA,gBAAgD,eAAgB,MAD3DC,EAAkBF,EAAA,GAAEG,OAIrBC,EAAYC,SAAY,MAExBC,EAAqBD,SAAY,MAGjCE,EAA0BC,EAAAA,SAC9BN,GAAsBA,EAAmBO,SAAWP,EAAmBO,SAAW,MAD7EA,EAAQF,EAAA,GAAEG,EAAWH,EA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,QAAAG,cAAAH,EAAAA,QAAAI,SAAA,UAOZJ,EAAAA,QAAKG,cAAA,MAAA,CAAAD,UAAU,UACbF,EAAA,QAAAG,cAAA,QAAA,CAAOwC,KAAMlF,EAAiBwC,IAAKf,IACnCc,EAAA,QAAAG,cAAA,QAAA,CAAOyC,OAAO,EAAM3C,IAAKd,IACzBa,EAAA,QAAAG,cAAA,QAAA,CAAO0C,UAAQ,EAAC5C,IAAKb,IACrBY,UAAOG,cAAA,QAAA,CAAAyC,OAAO,EAAMC,UAAS,EAAA5C,IAAKZ,IAClCW,UAAOG,cAAA,QAAA,CAAA0C,YAAS5C,IAAKX,KAI7B,EAEAjD,EAAOyG,YAAc"}
|
|
1
|
+
{"version":3,"file":"Island.js","sources":["../../src/components/Island.tsx"],"sourcesContent":["// Copyright (C) 2022 Nethesis S.r.l.\n// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport React, { useState, useRef, useEffect, type FC } from 'react'\nimport { useSelector, useDispatch } from 'react-redux'\nimport { RootState, Dispatch } from '../store'\nimport {\n useLongPress,\n useIsomorphicLayoutEffect,\n useLocalStorage,\n styleTransformValues,\n} from '../utils'\nimport { motion, useDragControls } from 'framer-motion/dist/framer-motion'\nimport CallView from './CallView'\nimport KeyboardView from './KeypadView'\nimport { xPosition, yPosition } from '../lib/island/island'\nimport { AlertGuard } from './AlertGuard'\nimport BackCall from './CallView/BackCall'\nimport ViewsTransition from './ViewsTransition'\n\n/**\n * Provides the Island logic\n *\n * @param showAlways Sets the Island ever visible\n *\n */\nexport const Island: FC<IslandProps> = ({ showAlways }) => {\n // Get the currentCall info\n const { incoming, accepted, outgoing } = useSelector((state: RootState) => state.currentCall)\n // Get isOpen from island store\n const { isOpen, startPosition, view } = useSelector((state: RootState) => state.island)\n // Get activeAlertsCount from island store\n const { activeAlertsCount } = useSelector((state: RootState) => state.alerts.status)\n // Get variants from animations store\n const { variants } = useSelector((state: RootState) => state.animations)\n // Get audioPlayerLoop value from player store\n const { audioPlayerLoop } = useSelector((state: RootState) => state.player)\n\n // Initialize Island drag controls\n const controls = useDragControls()\n\n // Initialize Island storage\n const [phoneIslandStorage, setPhoneIslandStorage] =\n useLocalStorage<PhoneIslandStorageTypes | null>('phone-island', null)\n\n // The Island reference\n const islandRef = useRef<any>(null)\n // The Container reference\n const islandContainerRef = useRef<any>(null)\n\n // Initialize position or get from storage\n const [position, setPosition] = useState<PositionTypes | null>(\n phoneIslandStorage && phoneIslandStorage.position ? phoneIslandStorage.position : null,\n )\n\n // Initialize the moved property\n const [moved, setMoved] = useState<boolean>(false)\n // Initialize useDispatch\n const dispatch = useDispatch<Dispatch>()\n\n // Handles the drag started event\n function handleStartDrag(event) {\n controls.start(event)\n }\n // Handles log press event\n const handleLongPress = () => {}\n\n // Handle Island click\n const handleIslandClick = () => {\n dispatch.island.toggleIsOpen()\n }\n\n // Handles drag end event\n const handleDragEnd = () => {\n // Get initial transform values\n let { x, y }: any = styleTransformValues(islandRef.current)\n // Round position\n x = xPosition(Math.round(x), islandRef.current, islandContainerRef.current)\n y = yPosition(Math.round(y), islandRef.current, islandContainerRef.current)\n // Save the new position to localstorage\n setPhoneIslandStorage({\n position: {\n x,\n y,\n },\n })\n // Set position to variable\n setPosition({\n x,\n y,\n })\n }\n\n // Handles drag started event\n function handleDragStarted() {\n setMoved(true)\n }\n\n // Initialize the longPressEvent object\n const longPressEvent = useLongPress(\n handleLongPress,\n handleIslandClick,\n moved,\n () => setMoved(false),\n {\n shouldPreventDefault: true,\n delay: 250,\n },\n )\n\n const audioPlayer = useRef<HTMLAudioElement>(null)\n const localAudio = useRef<HTMLAudioElement>(null)\n const remoteAudio = useRef<HTMLAudioElement>(null)\n const localVideo = useRef<HTMLVideoElement>(null)\n const remoteVideo = useRef<HTMLVideoElement>(null)\n\n useIsomorphicLayoutEffect(() => {\n dispatch.player.updatePlayer({\n audioPlayer: audioPlayer.current,\n localAudio: localAudio.current,\n localVideo: localVideo.current,\n remoteVideo: remoteVideo.current,\n remoteAudio: remoteAudio.current,\n })\n }, [])\n\n // Handle and apply view switch logic\n useEffect(() => {\n if (incoming || outgoing) {\n dispatch.island.setIslandView('call')\n }\n }, [incoming, outgoing])\n\n const [currentView, setCurrentView] = useState<any>('')\n\n useEffect(() => {\n setTimeout(() => {\n setCurrentView(view)\n }, 200)\n }, [view])\n\n return (\n <div\n ref={islandContainerRef}\n className='absolute min-w-full min-h-full left-0 top-0 overflow-hidden pointer-events-none flex items-center justify-center content-center phone-island-container z-1000'\n >\n {(incoming || outgoing || accepted || showAlways || activeAlertsCount > 0) && (\n <>\n <motion.div\n drag\n onPointerDown={handleStartDrag}\n onDragStart={handleDragStarted}\n dragTransition={{\n power: 0,\n }}\n initial={{\n x: position?.x || startPosition.x,\n y: position?.y || startPosition.y,\n }}\n dragControls={controls}\n dragConstraints={islandContainerRef}\n onDragEnd={handleDragEnd}\n ref={islandRef}\n {...longPressEvent}\n className='absolute'\n >\n {/* Add background call visibility logic */}\n <BackCall isVisible={view === 'keypad'} />\n <motion.div\n className='font-sans pointer-events-auto overflow-hidden bg-black text-xs cursor-pointer text-white'\n animate={\n view === 'call'\n ? isOpen && (incoming || outgoing) && !accepted\n ? // The call is incoming or outgoing\n activeAlertsCount > 0\n ? variants.callView.expandedIncomingWithAlerts\n : variants.callView.expandedIncoming\n : isOpen && accepted\n ? // The call is accepted and the island is expanded\n activeAlertsCount > 0\n ? variants.callView.expandedAcceptedWithAlerts\n : variants.callView.expandedAccepted\n : activeAlertsCount > 0\n ? variants.expandedWithAlerts\n : variants.callView.collapsed\n : view === 'keypad'\n ? isOpen && activeAlertsCount > 0\n ? variants.keypadView.expandedWithAlerts\n : isOpen && activeAlertsCount === 0\n ? variants.keypadView.expanded\n : !isOpen\n ? variants.keypadView.collapsed\n : ''\n : ''\n }\n >\n {/* The views logic */}\n <AlertGuard>\n {currentView === 'call' ? (\n <ViewsTransition forView='call'>\n <CallView />\n </ViewsTransition>\n ) : currentView === 'keypad' ? (\n <ViewsTransition forView='keypad'>\n <KeyboardView />\n </ViewsTransition>\n ) : (\n <></>\n )}\n </AlertGuard>\n </motion.div>\n </motion.div>\n </>\n )}\n <div className='hidden'>\n <audio loop={audioPlayerLoop} ref={audioPlayer}></audio>\n <audio muted={true} ref={localAudio}></audio>\n <audio autoPlay ref={remoteAudio}></audio>\n <video muted={true} autoPlay ref={localVideo}></video>\n <video autoPlay ref={remoteVideo}></video>\n </div>\n </div>\n )\n}\n\nIsland.displayName = 'Island'\n\ninterface IslandProps {\n showAlways?: boolean\n}\n\ninterface PositionTypes {\n x: number\n y: number\n}\n\ninterface PhoneIslandStorageTypes {\n position: PositionTypes\n}\n"],"names":["Island","_a","showAlways","_b","useSelector","state","currentCall","incoming","accepted","outgoing","_c","island","isOpen","startPosition","view","activeAlertsCount","alerts","status","variants","animations","audioPlayerLoop","player","controls","useDragControls","_d","useLocalStorage","phoneIslandStorage","setPhoneIslandStorage","islandRef","useRef","islandContainerRef","_e","useState","position","setPosition","_f","moved","setMoved","dispatch","useDispatch","longPressEvent","useLongPress","toggleIsOpen","shouldPreventDefault","delay","audioPlayer","localAudio","remoteAudio","localVideo","remoteVideo","useIsomorphicLayoutEffect","updatePlayer","current","useEffect","setIslandView","_g","currentView","setCurrentView","setTimeout","React","ref","className","createElement","Fragment","motion","div","__assign","drag","onPointerDown","event","start","onDragStart","dragTransition","power","initial","x","y","dragControls","dragConstraints","onDragEnd","styleTransformValues","xPosition","Math","round","yPosition","BackCall","isVisible","animate","callView","expandedIncomingWithAlerts","expandedIncoming","expandedAcceptedWithAlerts","expandedAccepted","expandedWithAlerts","collapsed","keypadView","expanded","AlertGuard","ViewsTransition","forView","CallView","KeyboardView","loop","muted","autoPlay","displayName"],"mappings":"q7BA0BaA,EAA0B,SAACC,GAAE,IAAAC,EAAUD,EAAAC,WAE5CC,EAAmCC,EAAAA,aAAY,SAACC,GAAqB,OAAAA,EAAMC,eAAzEC,EAAQJ,EAAAI,SAAEC,EAAQL,EAAAK,SAAEC,EAAQN,EAAAM,S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B9E,GAAUJ,EAEVO,EAAoB,EAClBG,EAASsE,SAASG,2BAClBzE,EAASsE,SAASI,iBACpB7E,EAAoB,EACpBG,EAAS2E,mBACT3E,EAASsE,SAASM,UACX,WAAThF,EACAF,GAAUG,EAAoB,EAC5BG,EAAS6E,WAAWF,mBACpBjF,GAAgC,IAAtBG,EACVG,EAAS6E,WAAWC,SACnBpF,EAED,GADAM,EAAS6E,WAAWD,UAEtB,IAINnC,EAAAA,QAAAG,cAACmC,aAAU,KACQ,SAAhBzC,EACCG,EAAC,QAAAG,cAAAoC,EAAAA,QAAgB,CAAAC,QAAQ,QACvBxC,EAAAA,QAAAG,cAACsC,EAAAA,QAAW,OAEI,WAAhB5C,EACFG,EAAAA,QAAAG,cAACoC,EAAAA,QAAgB,CAAAC,QAAQ,UACvBxC,EAAAA,QAAAG,cAACuC,EAAAA,QAAY,OAGf1C,EAAA,QAAAG,cAAAH,EAAAA,QAAAI,SAAA,UAOZJ,EAAAA,QAAKG,cAAA,MAAA,CAAAD,UAAU,UACbF,EAAA,QAAAG,cAAA,QAAA,CAAOwC,KAAMlF,EAAiBwC,IAAKf,IACnCc,EAAA,QAAAG,cAAA,QAAA,CAAOyC,OAAO,EAAM3C,IAAKd,IACzBa,EAAA,QAAAG,cAAA,QAAA,CAAO0C,UAAQ,EAAC5C,IAAKb,IACrBY,UAAOG,cAAA,QAAA,CAAAyC,OAAO,EAAMC,UAAS,EAAA5C,IAAKZ,IAClCW,UAAOG,cAAA,QAAA,CAAA0C,YAAS5C,IAAKX,KAI7B,EAEAjD,EAAOyG,YAAc"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Actions.js","sources":["../../../src/components/KeypadView/Actions.tsx"],"sourcesContent":["// Copyright (C) 2022 Nethesis S.r.l.\n// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport React, { type FC } from 'react'\nimport { Button } from '..'\n\nconst keys = Array.from(Array(9).keys())\n\nconst bottomKeys = ['*', '0', '#']\n\nconst Actions: FC<ActionsTypes> = ({ keyCallback }) => {\n return (\n <div className='grid grid-cols-3 auto-cols-max gap-y-6 justify-items-center place-items-center justify-center px-3'>\n {keys.map((key) => (\n <Button\n key={key + 1}\n onClick={() => keyCallback(key + 1)}\n variant='default'\n className={'text-2xl'}\n >\n {key + 1}\n </Button>\n ))}\n {bottomKeys.map((bottomKey) => (\n <Button\n key={bottomKey + 1}\n onClick={() => keyCallback(bottomKey)}\n variant='default'\n className={'text-2xl'}\n >\n {bottomKey}\n </Button>\n ))}\n </div>\n )\n}\n\nexport default Actions\n\ninterface ActionsTypes {\n keyCallback: any\n}\n"],"names":["keys","Array","from","bottomKeys","_a","keyCallback","React","createElement","className","map","key","Button","onClick","variant","bottomKey"],"mappings":"8nBAMMA,EAAOC,MAAMC,KAAKD,MAAM,GAAGD,QAE3BG,EAAa,CAAC,IAAK,IAAK,qBAEI,SAACC,GAAE,IAAAC,EAAWD,EAAAC,YAC9C,OACEC,EAAA,QAAAC,cAAA,MAAA,CAAKC,UAAU,sGACZR,EAAKS,KAAI,SAACC,GAAQ,OACjBJ,EAAC,QAAAC,cAAAI,EAAAA,QACCD,IAAKA,EAAM,EACXE,QAAS,WAAM,OAAAP,EAAYK,EAAM,EAAE,EACnCG,QAAQ,UACRL,UAAW,YAEVE,EAAM,EAPQ,IAUlBP,EAAWM,KAAI,SAACK,GAAc,OAC7BR,EAAC,QAAAC,cAAAI,EAAAA,QACCD,IAAKI,EAAY,EACjBF,QAAS,WAAM,OAAAP,EAAYS,IAC3BD,QAAQ,UACRL,UAAW,YAEVM,EAEJ,IAGP"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("../Button.js");require("../../node_modules/react-redux/es/index.js");var n=require("../../node_modules/@nethesis/nethesis-light-svg-icons/index.mjs.js"),r=require("../../node_modules/@fortawesome/react-fontawesome/index.es.js"),a=require("./Actions.js"),s=require("../../lib/phone/call.js"),u=require("../../node_modules/@nethesis/nethesis-solid-svg-icons/index.mjs.js"),l=require("../../static/dtmf/index.js"),o=require("../../lib/webrtc/messages.js"),c=require("../../node_modules/react-redux/es/hooks/useDispatch.js"),d=require("../../node_modules/react-redux/es/hooks/useSelector.js");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=i(e),m=["0","1","2","3","4","5","6","7","8","9","*","#"];exports.default=function(){var i=c.useDispatch(),x=d.useSelector((function(e){return e.currentCall})).keypadValue,p=d.useSelector((function(e){return e.island})).isOpen,v=e.useRef(x);function y(e){i.currentCall.updateKeypadValue("".concat(v.current).concat(e)),v.current="".concat(v.current).concat(e),function(e){"*"===e&&(e="star"),"#"===e&&(e="pound"),i.player.updateAndPlayAudioPlayer({src:l.default["dtmf_".concat(e)]})}(e),o.sendDTMF(e)}return e.useEffect((function(){function e(e){m.includes(e.key)&&y(e.key)}return window.addEventListener("keydown",e),function(){return window.removeEventListener("keydown",e)}}),[]),f.default.createElement(f.default.Fragment,null,p?f.default.createElement("div",{className:"flex flex-col gap-7"},f.default.createElement("div",{className:"flex gap-4"},f.default.createElement(t.Button,{variant:"transparent",onClick:function(){i.island.setIslandView("call")}},f.default.createElement(r.FontAwesomeIcon,{size:"xl",icon:n.faArrowLeft})),f.default.createElement("input",{type:"text",readOnly:!0,value:x,autoFocus:!0,className:"w-full rounded-xl bg-black border border-gray-300 text-white font-sans font-light text-xl text-center px-2"})),f.default.createElement(a.default,{keyCallback:y}),f.default.createElement("div",{className:"flex justify-center"},f.default.createElement(t.Button,{onClick:s.hangupCurrentCall,variant:"red"},f.default.createElement(r.FontAwesomeIcon,{className:"rotate-135 w-6 h-6",icon:u.faPhone})))):f.default.createElement("div",{className:"font-medium text-base"},"Keypad"))};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/KeypadView/index.tsx"],"sourcesContent":["// Copyright (C) 2022 Nethesis S.r.l.\n// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport React, { type FC, useEffect, useRef } from 'react'\nimport { Button } from '../Button'\nimport { useDispatch, useSelector } from 'react-redux'\nimport { Dispatch, RootState } from '../../store'\nimport { faArrowLeft } from '@nethesis/nethesis-light-svg-icons'\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\nimport Actions from './Actions'\nimport { hangupCurrentCall } from '../../lib/phone/call'\nimport { faPhone } from '@nethesis/nethesis-solid-svg-icons'\nimport dtmfAudios from '../../static/dtmf'\nimport { sendDTMF } from '../../lib/webrtc/messages'\n\nconst DTMF_KEYS = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '*', '#']\n\nconst KeypadView: FC<KeypadViewTypes> = () => {\n const dispatch = useDispatch<Dispatch>()\n const { keypadValue } = useSelector((state: RootState) => state.currentCall)\n const { isOpen } = useSelector((state: RootState) => state.island)\n const keypadValueRef = useRef<typeof keypadValue>(keypadValue)\n\n function backToCallView() {\n dispatch.island.setIslandView('call')\n }\n\n function playDtmfAudio(key: string) {\n if (key === '*') key = 'star'\n if (key === '#') key = 'pound'\n dispatch.player.updateAndPlayAudioPlayer({ src: dtmfAudios[`dtmf_${key}`] })\n }\n\n function sendKey(key: string) {\n dispatch.currentCall.updateKeypadValue(`${keypadValueRef.current}${key}`)\n keypadValueRef.current = `${keypadValueRef.current}${key}`\n playDtmfAudio(key)\n sendDTMF(key)\n }\n\n useEffect(() => {\n function handlePhysicalKeydown(event) {\n if (DTMF_KEYS.includes(event.key)) {\n sendKey(event.key)\n }\n }\n window.addEventListener('keydown', handlePhysicalKeydown)\n return () => window.removeEventListener('keydown', handlePhysicalKeydown)\n }, [])\n\n return (\n <>\n {isOpen ? (\n <div className='flex flex-col gap-7'>\n <div className='flex gap-4'>\n <Button variant='transparent' onClick={backToCallView}>\n <FontAwesomeIcon size='xl' icon={faArrowLeft} />\n </Button>\n <input\n type='text'\n readOnly\n value={keypadValue}\n autoFocus\n className='w-full rounded-xl bg-black border border-gray-300 text-white font-sans font-light text-xl text-center px-2'\n />\n </div>\n <Actions keyCallback={sendKey} />\n <div className='flex justify-center'>\n {/* The button to hangup the currentCall */}\n <Button onClick={hangupCurrentCall} variant='red'>\n <FontAwesomeIcon className='rotate-135 w-6 h-6' icon={faPhone} />\n </Button>\n </div>\n </div>\n ) : (\n <div className='font-medium text-base'>Keypad</div>\n )}\n </>\n )\n}\n\nexport default KeypadView\n\nexport interface KeypadViewTypes {}\n"],"names":["DTMF_KEYS","dispatch","useDispatch","keypadValue","useSelector","state","currentCall","isOpen","island","keypadValueRef","useRef","sendKey","key","updateKeypadValue","concat","current","player","updateAndPlayAudioPlayer","src","dtmfAudios","playDtmfAudio","sendDTMF","useEffect","handlePhysicalKeydown","event","includes","window","addEventListener","removeEventListener","React","createElement","Fragment","className","Button","variant","onClick","setIslandView","FontAwesomeIcon","size","icon","faArrowLeft","type","readOnly","value","autoFocus","Actions","keyCallback","hangupCurrentCall","faPhone"],"mappings":"swBAeMA,EAAY,CAAC,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,qBAElC,WACtC,IAAMC,EAAWC,EAAAA,cACTC,EAAgBC,eAAY,SAACC,GAAqB,OAAAA,EAAMC,2BACxDC,EAAWH,eAAY,SAACC,GAAqB,OAAAA,EAAMG,iBACrDC,EAAiBC,SAA2BP,GAYlD,SAASQ,EAAQC,GACfX,EAASK,YAAYO,kBAAkB,GAAAC,OAAGL,EAAeM,SAAOD,OAAGF,IACnEH,EAAeM,QAAU,GAAGD,OAAAL,EAAeM,SAAOD,OAAGF,GARvD,SAAuBA,GACT,MAARA,IAAaA,EAAM,QACX,MAARA,IAAaA,EAAM,SACvBX,EAASe,OAAOC,yBAAyB,CAAEC,IAAKC,EAAAA,QAAW,eAAQP,KACpE,CAKCQ,CAAcR,GACdS,EAAQA,SAACT,EACV,CAYD,OAVAU,EAAAA,WAAU,WACR,SAASC,EAAsBC,GACzBxB,EAAUyB,SAASD,EAAMZ,MAC3BD,EAAQa,EAAMZ,IAEjB,CAED,OADAc,OAAOC,iBAAiB,UAAWJ,GAC5B,WAAM,OAAAG,OAAOE,oBAAoB,UAAWL,GACpD,GAAE,IAGDM,UACGC,cAAAD,EAAA,QAAAE,SAAA,KAAAxB,EACCsB,EAAAA,QAAAC,cAAA,MAAA,CAAKE,UAAU,uBACbH,EAAAA,QAAKC,cAAA,MAAA,CAAAE,UAAU,cACbH,EAAC,QAAAC,cAAAG,UAAOC,QAAQ,cAAcC,QAhCxC,WACElC,EAASO,OAAO4B,cAAc,OAC/B,GA+BWP,UAACC,cAAAO,EAAAA,gBAAgB,CAAAC,KAAK,KAAKC,KAAMC,EAAWA,eAE9CX,EAAA,QAAAC,cAAA,QAAA,CACEW,KAAK,OACLC,YACAC,MAAOxC,EACPyC,WACA,EAAAZ,UAAU,gHAGdH,EAAAA,QAAAC,cAACe,EAAAA,QAAO,CAACC,YAAanC,IACtBkB,EAAAA,QAAKC,cAAA,MAAA,CAAAE,UAAU,uBAEbH,EAAC,QAAAC,cAAAG,UAAOE,QAASY,EAAiBA,kBAAEb,QAAQ,OAC1CL,UAACC,cAAAO,EAAAA,gBAAgB,CAAAL,UAAU,qBAAqBO,KAAMS,EAAOA,aAKnEnB,UAAKC,cAAA,MAAA,CAAAE,UAAU,yBAAoC,UAI3D"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var d={variants:{callView:{expandedIncoming:{width:"418px",height:"96px",borderRadius:"20px",padding:"24px"},expandedIncomingWithAlerts:{width:"418px",height:"224px",borderRadius:"20px",padding:"24px"},expandedAccepted:{width:"348px",height:"236px",borderRadius:"20px",padding:"24px"},expandedAcceptedWithAlerts:{width:"348px",height:"364px",borderRadius:"20px",padding:"24px"},collapsed:{width:"168px",height:"40px",borderRadius:"99px",padding:"8px 16px"}},
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var d={variants:{callView:{expandedIncoming:{width:"418px",height:"96px",borderRadius:"20px",padding:"24px"},expandedIncomingWithAlerts:{width:"418px",height:"224px",borderRadius:"20px",padding:"24px"},expandedAccepted:{width:"348px",height:"236px",borderRadius:"20px",padding:"24px"},expandedAcceptedWithAlerts:{width:"348px",height:"364px",borderRadius:"20px",padding:"24px"},collapsed:{width:"168px",height:"40px",borderRadius:"99px",padding:"8px 16px"}},keypadView:{expanded:{width:"338px",height:"462px",borderRadius:"20px",padding:"24px"},collapsed:{width:"168px",height:"40px",borderRadius:"99px",padding:"8px 16px"}},expandedWithAlerts:{width:"418px",height:"152px",borderRadius:"20px",padding:"24px"}}},e=require("../node_modules/@rematch/core/dist/core.esm.js").createModel()({state:d});exports.animations=e;
|
|
2
2
|
//# sourceMappingURL=animations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animations.js","sources":["../../src/models/animations.ts"],"sourcesContent":["// Copyright (C) 2022 Nethesis S.r.l.\n// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport { createModel } from '@rematch/core'\nimport type { RootModel } from '.'\n\nconst EXPANDED_PADDING = '24px'\nconst COLLAPSED_PADDING = '8px 16px'\nconst BORDER_RADIUS_EXPANDED = '20px'\nconst BORDER_RADIUS_COLLAPSED = '99px'\n\nconst defaultState: AnimationsTypes = {\n variants: {\n // The animation variants for CallView\n callView: {\n // When there is and incoming call and the island is expanded\n expandedIncoming: {\n width: '418px',\n height: '96px',\n borderRadius: BORDER_RADIUS_EXPANDED,\n padding: EXPANDED_PADDING,\n },\n // When there is and incoming call and the island is expanded\n expandedIncomingWithAlerts: {\n width: '418px',\n height: '224px',\n borderRadius: BORDER_RADIUS_EXPANDED,\n padding: EXPANDED_PADDING,\n },\n // When there is an accepted call and the island is expanded\n expandedAccepted: {\n width: '348px',\n height: '236px',\n borderRadius: BORDER_RADIUS_EXPANDED,\n padding: EXPANDED_PADDING,\n },\n // When there is an accepted call and the island is expanded\n expandedAcceptedWithAlerts: {\n width: '348px',\n height: '364px',\n borderRadius: BORDER_RADIUS_EXPANDED,\n padding: EXPANDED_PADDING,\n },\n // When the island is collapsed\n collapsed: {\n width: '168px',\n height: '40px',\n borderRadius: BORDER_RADIUS_COLLAPSED,\n padding: COLLAPSED_PADDING,\n },\n },\n // The animation variant for
|
|
1
|
+
{"version":3,"file":"animations.js","sources":["../../src/models/animations.ts"],"sourcesContent":["// Copyright (C) 2022 Nethesis S.r.l.\n// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport { createModel } from '@rematch/core'\nimport type { RootModel } from '.'\n\nconst EXPANDED_PADDING = '24px'\nconst COLLAPSED_PADDING = '8px 16px'\nconst BORDER_RADIUS_EXPANDED = '20px'\nconst BORDER_RADIUS_COLLAPSED = '99px'\n\nconst defaultState: AnimationsTypes = {\n variants: {\n // The animation variants for CallView\n callView: {\n // When there is and incoming call and the island is expanded\n expandedIncoming: {\n width: '418px',\n height: '96px',\n borderRadius: BORDER_RADIUS_EXPANDED,\n padding: EXPANDED_PADDING,\n },\n // When there is and incoming call and the island is expanded\n expandedIncomingWithAlerts: {\n width: '418px',\n height: '224px',\n borderRadius: BORDER_RADIUS_EXPANDED,\n padding: EXPANDED_PADDING,\n },\n // When there is an accepted call and the island is expanded\n expandedAccepted: {\n width: '348px',\n height: '236px',\n borderRadius: BORDER_RADIUS_EXPANDED,\n padding: EXPANDED_PADDING,\n },\n // When there is an accepted call and the island is expanded\n expandedAcceptedWithAlerts: {\n width: '348px',\n height: '364px',\n borderRadius: BORDER_RADIUS_EXPANDED,\n padding: EXPANDED_PADDING,\n },\n // When the island is collapsed\n collapsed: {\n width: '168px',\n height: '40px',\n borderRadius: BORDER_RADIUS_COLLAPSED,\n padding: COLLAPSED_PADDING,\n },\n },\n // The animation variant for keypadView\n keypadView: {\n expanded: {\n width: '338px',\n height: '462px',\n borderRadius: BORDER_RADIUS_EXPANDED,\n padding: EXPANDED_PADDING,\n },\n collapsed: {\n width: '168px',\n height: '40px',\n borderRadius: BORDER_RADIUS_COLLAPSED,\n padding: COLLAPSED_PADDING,\n }\n },\n // When theare aren't calls but there are alerts\n expandedWithAlerts: {\n width: '418px',\n height: '152px',\n borderRadius: BORDER_RADIUS_EXPANDED,\n padding: EXPANDED_PADDING,\n },\n },\n}\n\nexport const animations = createModel<RootModel>()({\n state: defaultState,\n})\n\nexport interface AnimationsTypes {\n variants: {\n [key: string]: {\n [key: string]:\n | {\n [key: string]: string\n }\n | string\n }\n }\n}\n"],"names":["defaultState","variants","callView","expandedIncoming","width","height","borderRadius","padding","expandedIncomingWithAlerts","expandedAccepted","expandedAcceptedWithAlerts","collapsed","keypadView","expanded","expandedWithAlerts","animations","createModel","state"],"mappings":"wEAWMA,EAAgC,CACpCC,SAAU,CAERC,SAAU,CAERC,iBAAkB,CAChBC,MAAO,QACPC,OAAQ,OACRC,aAXuB,OAYvBC,QAdiB,QAiBnBC,2BAA4B,CAC1BJ,MAAO,QACPC,OAAQ,QACRC,aAlBuB,OAmBvBC,QArBiB,QAwBnBE,iBAAkB,CAChBL,MAAO,QACPC,OAAQ,QACRC,aAzBuB,OA0BvBC,QA5BiB,QA+BnBG,2BAA4B,CAC1BN,MAAO,QACPC,OAAQ,QACRC,aAhCuB,OAiCvBC,QAnCiB,QAsCnBI,UAAW,CACTP,MAAO,QACPC,OAAQ,OACRC,aAtCwB,OAuCxBC,QAzCkB,aA6CtBK,WAAY,CACVC,SAAU,CACRT,MAAO,QACPC,OAAQ,QACRC,aAhDuB,OAiDvBC,QAnDiB,QAqDnBI,UAAW,CACTP,MAAO,QACPC,OAAQ,OACRC,aArDwB,OAsDxBC,QAxDkB,aA4DtBO,mBAAoB,CAClBV,MAAO,QACPC,OAAQ,QACRC,aA9DyB,OA+DzBC,QAjEmB,UAsEZQ,4DAAwBC,aAAXA,CAAyB,CACjDC,MAAOjB"}
|
|
@@ -17,7 +17,7 @@ export declare const currentCall: {
|
|
|
17
17
|
startTime: string;
|
|
18
18
|
muted: boolean;
|
|
19
19
|
paused: boolean;
|
|
20
|
-
|
|
20
|
+
keypadValue: string;
|
|
21
21
|
};
|
|
22
22
|
} & {
|
|
23
23
|
effects: (dispatch: import("@rematch/core").RematchDispatch<RootModel>) => {
|
|
@@ -43,7 +43,7 @@ export declare const currentCall: {
|
|
|
43
43
|
startTime: string;
|
|
44
44
|
muted: boolean;
|
|
45
45
|
paused: boolean;
|
|
46
|
-
|
|
46
|
+
keypadValue: string;
|
|
47
47
|
}, payload: CurrentCallTypes) => {
|
|
48
48
|
displayName: string;
|
|
49
49
|
username: string;
|
|
@@ -60,9 +60,9 @@ export declare const currentCall: {
|
|
|
60
60
|
startTime: string;
|
|
61
61
|
muted: boolean;
|
|
62
62
|
paused: boolean;
|
|
63
|
-
|
|
63
|
+
keypadValue: string;
|
|
64
64
|
};
|
|
65
|
-
|
|
65
|
+
updateKeypadValue: (state: {
|
|
66
66
|
displayName: string;
|
|
67
67
|
username: string;
|
|
68
68
|
number: string;
|
|
@@ -78,9 +78,9 @@ export declare const currentCall: {
|
|
|
78
78
|
startTime: string;
|
|
79
79
|
muted: boolean;
|
|
80
80
|
paused: boolean;
|
|
81
|
-
|
|
81
|
+
keypadValue: string;
|
|
82
82
|
}, payload: string) => {
|
|
83
|
-
|
|
83
|
+
keypadValue: string;
|
|
84
84
|
displayName: string;
|
|
85
85
|
username: string;
|
|
86
86
|
number: string;
|
|
@@ -113,7 +113,7 @@ export declare const currentCall: {
|
|
|
113
113
|
startTime: string;
|
|
114
114
|
muted: boolean;
|
|
115
115
|
paused: boolean;
|
|
116
|
-
|
|
116
|
+
keypadValue: string;
|
|
117
117
|
};
|
|
118
118
|
};
|
|
119
119
|
} & ({} | {
|
|
@@ -133,7 +133,7 @@ export declare const currentCall: {
|
|
|
133
133
|
startTime: string;
|
|
134
134
|
muted: boolean;
|
|
135
135
|
paused: boolean;
|
|
136
|
-
|
|
136
|
+
keypadValue: string;
|
|
137
137
|
}, import("redux").AnyAction>;
|
|
138
138
|
});
|
|
139
139
|
export interface CurrentCallTypes {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../node_modules/tslib/tslib.es6.js"),t=require("../node_modules/@rematch/core/dist/core.esm.js"),r=require("../static/incoming_ringtone.js"),n=require("../static/outgoing_ringtone.js"),c=require("../events/CallEvents.js");require("react");var a={displayName:"",username:"",number:"",incomingSocket:!1,incomingWebRTC:!1,incoming:!1,acceptedSocket:!1,acceptedWebRTC:!1,accepted:!1,outgoingSocket:!1,outgoingWebRTC:!1,outgoing:!1,startTime:"",muted:!1,paused:!1,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../node_modules/tslib/tslib.es6.js"),t=require("../node_modules/@rematch/core/dist/core.esm.js"),r=require("../static/incoming_ringtone.js"),n=require("../static/outgoing_ringtone.js"),c=require("../events/CallEvents.js");require("react");var a={displayName:"",username:"",number:"",incomingSocket:!1,incomingWebRTC:!1,incoming:!1,acceptedSocket:!1,acceptedWebRTC:!1,accepted:!1,outgoingSocket:!1,outgoingWebRTC:!1,outgoing:!1,startTime:"",muted:!1,paused:!1,keypadValue:""},i=t.createModel()({state:a,reducers:{updateCurrentCall:function(t,r){return e.__assign(e.__assign({},t),r)},updateKeypadValue:function(t,r){return e.__assign(e.__assign({},t),{keypadValue:r})},reset:function(){return a}},effects:function(t){return{checkIncomingUpdateAndPlay:function(n,c){var a,i;("webrtc"===(null===(a=c.currentUser.default_device)||void 0===a?void 0:a.type)&&(c.currentCall.incomingWebRTC||n.incomingWebRTC)||"physical"===(null===(i=c.currentUser.default_device)||void 0===i?void 0:i.type)&&(c.currentCall.incomingSocket||n.incomingSocket))&&(n.incoming=!0,t.player.updateAndPlayAudioPlayer({src:r.default,loop:!0})),t.currentCall.updateCurrentCall(e.__assign({},n))},checkOutgoingUpdateAndPlay:function(r,a){var i,u;("webrtc"===(null===(i=a.currentUser.default_device)||void 0===i?void 0:i.type)&&(a.currentCall.outgoingWebRTC||r.outgoingWebRTC)||"physical"===(null===(u=a.currentUser.default_device)||void 0===u?void 0:u.type)&&(a.currentCall.outgoingSocket||r.outgoingSocket))&&(r.outgoing=!0,t.player.updateAndPlayAudioPlayer({src:n.default,loop:!0}),c.dispatchOutgoingCallStarted(r.displayName,r.number)),t.currentCall.updateCurrentCall(e.__assign({},r))},checkAcceptedUpdate:function(r,n){var c,a;("webrtc"===(null===(c=n.currentUser.default_device)||void 0===c?void 0:c.type)&&(n.currentCall.acceptedWebRTC||r.acceptedWebRTC)||"physical"===(null===(a=n.currentUser.default_device)||void 0===a?void 0:a.type)&&(n.currentCall.acceptedSocket||r.acceptedSocket))&&(r.accepted=!0),t.currentCall.updateCurrentCall(e.__assign({},r))}}}});exports.currentCall=i;
|
|
2
2
|
//# sourceMappingURL=currentCall.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"currentCall.js","sources":["../../src/models/currentCall.ts"],"sourcesContent":["// Copyright (C) 2022 Nethesis S.r.l.\n// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport { createModel } from '@rematch/core'\nimport type { RootModel } from '.'\nimport incomingRingtone from '../static/incoming_ringtone'\nimport outgoingRingtone from '../static/outgoing_ringtone'\nimport { dispatchOutgoingCallStarted } from '../events/index'\n\nconst defaultState = {\n displayName: '',\n username: '',\n number: '',\n incomingSocket: false,\n incomingWebRTC: false,\n incoming: false,\n acceptedSocket: false,\n acceptedWebRTC: false,\n accepted: false,\n outgoingSocket: false,\n outgoingWebRTC: false,\n outgoing: false,\n startTime: '',\n muted: false,\n paused: false,\n
|
|
1
|
+
{"version":3,"file":"currentCall.js","sources":["../../src/models/currentCall.ts"],"sourcesContent":["// Copyright (C) 2022 Nethesis S.r.l.\n// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport { createModel } from '@rematch/core'\nimport type { RootModel } from '.'\nimport incomingRingtone from '../static/incoming_ringtone'\nimport outgoingRingtone from '../static/outgoing_ringtone'\nimport { dispatchOutgoingCallStarted } from '../events/index'\n\nconst defaultState = {\n displayName: '',\n username: '',\n number: '',\n incomingSocket: false,\n incomingWebRTC: false,\n incoming: false,\n acceptedSocket: false,\n acceptedWebRTC: false,\n accepted: false,\n outgoingSocket: false,\n outgoingWebRTC: false,\n outgoing: false,\n startTime: '',\n muted: false,\n paused: false,\n keypadValue: '',\n}\n\nexport const currentCall = createModel<RootModel>()({\n state: defaultState,\n reducers: {\n updateCurrentCall: (state, payload: CurrentCallTypes) => {\n return {\n ...state,\n ...payload,\n }\n },\n updateKeypadValue: (state, payload: string) => {\n return {\n ...state,\n keypadValue: payload,\n }\n },\n reset: () => {\n return defaultState\n },\n },\n effects: (dispatch) => ({\n checkIncomingUpdateAndPlay: (payload: CurrentCallTypes, rootState) => {\n // Check call type and incoming confirmation source\n if (\n (rootState.currentUser.default_device?.type === 'webrtc' &&\n (rootState.currentCall.incomingWebRTC || payload.incomingWebRTC)) ||\n (rootState.currentUser.default_device?.type === 'physical' &&\n (rootState.currentCall.incomingSocket || payload.incomingSocket))\n ) {\n payload.incoming = true\n\n // Update local player and play the audio\n dispatch.player.updateAndPlayAudioPlayer({ src: incomingRingtone, loop: true })\n }\n // Update the current call values and set incoming\n dispatch.currentCall.updateCurrentCall({\n ...payload,\n })\n },\n checkOutgoingUpdateAndPlay: (payload: CurrentCallTypes, rootState) => {\n // Check call type and outgoing confirmation source\n if (\n (rootState.currentUser.default_device?.type === 'webrtc' &&\n (rootState.currentCall.outgoingWebRTC || payload.outgoingWebRTC)) ||\n (rootState.currentUser.default_device?.type === 'physical' &&\n (rootState.currentCall.outgoingSocket || payload.outgoingSocket))\n ) {\n payload.outgoing = true\n // Update local player and play audio\n dispatch.player.updateAndPlayAudioPlayer({ src: outgoingRingtone, loop: true })\n // Dispatch an event for outgoing call\n dispatchOutgoingCallStarted(payload.displayName, payload.number)\n }\n // Update the current call values and set outgoing\n dispatch.currentCall.updateCurrentCall({\n ...payload,\n })\n },\n checkAcceptedUpdate: (payload: CurrentCallTypes, rootState) => {\n // Check call type and accepted confirmation source\n if (\n (rootState.currentUser.default_device?.type === 'webrtc' &&\n (rootState.currentCall.acceptedWebRTC || payload.acceptedWebRTC)) ||\n (rootState.currentUser.default_device?.type === 'physical' &&\n (rootState.currentCall.acceptedSocket || payload.acceptedSocket))\n ) {\n payload.accepted = true\n // TODO - add accepted event\n }\n // Update the current call values\n dispatch.currentCall.updateCurrentCall({\n ...payload,\n })\n },\n }),\n})\n\nexport interface CurrentCallTypes {\n displayName?: string\n username?: string\n number?: string\n incomingSocket?: boolean\n incomingWebRTC?: boolean\n incoming?: boolean\n acceptedSocket?: boolean\n acceptedWebRTC?: boolean\n accepted?: boolean\n outgoingSocket?: boolean\n outgoingWebRTC?: boolean\n outgoing?: boolean\n startTime?: string\n muted?: boolean\n paused?: boolean\n}\n"],"names":["defaultState","displayName","username","number","incomingSocket","incomingWebRTC","incoming","acceptedSocket","acceptedWebRTC","accepted","outgoingSocket","outgoingWebRTC","outgoing","startTime","muted","paused","keypadValue","currentCall","createModel","state","reducers","updateCurrentCall","payload","__assign","updateKeypadValue","reset","effects","dispatch","checkIncomingUpdateAndPlay","rootState","_a","currentUser","default_device","type","_b","player","updateAndPlayAudioPlayer","src","incomingRingtone","loop","checkOutgoingUpdateAndPlay","outgoingRingtone","dispatchOutgoingCallStarted","checkAcceptedUpdate"],"mappings":"kUASA,IAAMA,EAAe,CACnBC,YAAa,GACbC,SAAU,GACVC,OAAQ,GACRC,gBAAgB,EAChBC,gBAAgB,EAChBC,UAAU,EACVC,gBAAgB,EAChBC,gBAAgB,EAChBC,UAAU,EACVC,gBAAgB,EAChBC,gBAAgB,EAChBC,UAAU,EACVC,UAAW,GACXC,OAAO,EACPC,QAAQ,EACRC,YAAa,IAGFC,EAAcC,EAAWA,aAAXA,CAAyB,CAClDC,MAAOnB,EACPoB,SAAU,CACRC,kBAAmB,S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AA,EAAAA,EAAEG,QACpCJ,EAAUZ,YAAYT,gBAAkBc,EAAQd,iBACH,cAAX,QAApC0B,EAAAL,EAAUE,YAAYC,sBAAc,IAAAE,OAAA,EAAAA,EAAED,QACpCJ,EAAUZ,YAAYV,gBAAkBe,EAAQf,mBAEnDe,EAAQb,UAAW,GAIrBkB,EAASV,YAAYI,kBAChBE,EAAAA,SAAA,CAAA,EAAAD,GAEN,EACD"}
|
package/dist/models/island.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export declare const island: {
|
|
|
28
28
|
} & ({} | {
|
|
29
29
|
baseReducer: import("redux").Reducer<IslandTypes, import("redux").AnyAction>;
|
|
30
30
|
});
|
|
31
|
-
type IslandViewType = 'call' | '
|
|
31
|
+
type IslandViewType = 'call' | 'keypad' | 'player';
|
|
32
32
|
interface IslandTypes {
|
|
33
33
|
view?: IslandViewType | null;
|
|
34
34
|
isOpen: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"island.js","sources":["../../src/models/island.ts"],"sourcesContent":["// Copyright (C) 2022 Nethesis S.r.l.\n// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport { createModel } from '@rematch/core'\nimport type { RootModel } from '.'\n\nconst defaultState: IslandTypes = {\n view: null,\n isOpen: true,\n startPosition: {\n x: 0,\n y: 0,\n },\n}\n\nexport const island = createModel<RootModel>()({\n state: defaultState,\n reducers: {\n setIslandView: (state, payload: IslandViewType) => {\n return {\n ...state,\n view: payload,\n }\n },\n toggleIsOpen: (state) => {\n return {\n ...state,\n isOpen: !state.isOpen,\n }\n },\n },\n})\n\ntype IslandViewType = 'call' | '
|
|
1
|
+
{"version":3,"file":"island.js","sources":["../../src/models/island.ts"],"sourcesContent":["// Copyright (C) 2022 Nethesis S.r.l.\n// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport { createModel } from '@rematch/core'\nimport type { RootModel } from '.'\n\nconst defaultState: IslandTypes = {\n view: null,\n isOpen: true,\n startPosition: {\n x: 0,\n y: 0,\n },\n}\n\nexport const island = createModel<RootModel>()({\n state: defaultState,\n reducers: {\n setIslandView: (state, payload: IslandViewType) => {\n return {\n ...state,\n view: payload,\n }\n },\n toggleIsOpen: (state) => {\n return {\n ...state,\n isOpen: !state.isOpen,\n }\n },\n },\n})\n\ntype IslandViewType = 'call' | 'keypad' | 'player'\n\ninterface IslandTypes {\n view?: IslandViewType | null\n isOpen: boolean\n startPosition: {\n x: number\n y: number\n }\n}\n"],"names":["island","createModel","state","view","isOpen","startPosition","x","y","reducers","setIslandView","payload","__assign","toggleIsOpen"],"mappings":"wHAeaA,4DAAoBC,aAAXA,CAAyB,CAC7CC,MAVgC,CAChCC,KAAM,KACNC,QAAQ,EACRC,cAAe,CACbC,EAAG,EACHC,EAAG,IAMLC,SAAU,CACRC,cAAe,SAACP,EAAOQ,GACrB,OAAAC,EAAAA,SAAAA,EAAAA,SAAA,GACKT,GAAK,CACRC,KAAMO,GAET,EACDE,aAAc,SAACV,GACb,OACKS,EAAAA,SAAAA,WAAA,CAAA,EAAAT,IACHE,QAASF,EAAME,QAElB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/tslib/tslib.es6.js");function t(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(a){if("default"!==a){var r=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,r.get?r:{enumerable:!0,get:function(){return e[a]}})}})),t.default=e,Object.freeze(t)}var a=t(require("react"));exports.default=function(t){return a.createElement("svg",e.__assign({"aria-hidden":"true",focusable:"false",width:22,height:22,fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),a.createElement("g",{clipPath:"url(#a)",fillRule:"evenodd",clipRule:"evenodd",fill:"#fff"},a.createElement("path",{d:"M3 6a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm0-1a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM3 14a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm0-1a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM11 14a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm0-1a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM19 14a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm0-1a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM3 22a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm0-1a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM11 22a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm0-1a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM19 22a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm0-1a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM11 6a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm0-1a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM19 6a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm0-1a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z"})))};
|
|
2
|
-
//# sourceMappingURL=
|
|
2
|
+
//# sourceMappingURL=PhoneKeypadLight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PhoneKeypadLight.js","sources":["../../../src/static/icons/PhoneKeypadLight.tsx"],"sourcesContent":["import * as React from 'react'\n\nconst PhoneKeyboardLight = (props) => (\n <svg aria-hidden=\"true\" focusable=\"false\" width={22} height={22} fill='none' xmlns='http://www.w3.org/2000/svg' {...props}>\n <g clipPath='url(#a)' fillRule='evenodd' clipRule='evenodd' fill='#fff'>\n <path d='M3 6a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm0-1a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM3 14a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm0-1a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM11 14a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm0-1a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM19 14a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm0-1a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM3 22a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm0-1a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM11 22a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm0-1a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM19 22a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm0-1a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM11 6a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm0-1a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM19 6a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm0-1a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z' />\n </g>\n </svg>\n)\n\nexport default PhoneKeyboardLight\n"],"names":["props","React","createElement","__assign","focusable","width","height","fill","xmlns","clipPath","fillRule","clipRule","d"],"mappings":"ocAE2B,SAACA,GAAU,OACpCC,EAAAC,cAAA,MAAAC,EAAAA,SAAA,CAAA,cAAiB,OAAOC,UAAU,QAAQC,MAAO,GAAIC,OAAQ,GAAIC,KAAK,OAAOC,MAAM,8BAAiCR,GAClHC,EAAAC,cAAA,IAAA,CAAGO,SAAS,UAAUC,SAAS,UAAUC,SAAS,UAAUJ,KAAK,QAC/DN,EAAMC,cAAA,OAAA,CAAAU,EAAE,omBAHwB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/tslib/tslib.es6.js");function r(e){if(e&&e.__esModule)return e;var r=Object.create(null);return e&&Object.keys(e).forEach((function(c){if("default"!==c){var t=Object.getOwnPropertyDescriptor(e,c);Object.defineProperty(r,c,t.get?t:{enumerable:!0,get:function(){return e[c]}})}})),r.default=e,Object.freeze(r)}var c=r(require("react"));exports.default=function(r){return c.createElement("svg",e.__assign({"aria-hidden":"true",focusable:"false",width:22,height:22,fill:"none",xmlns:"http://www.w3.org/2000/svg"},r),c.createElement("g",{clipPath:"url(#a)",fill:"#fff"},c.createElement("circle",{cx:3,cy:3,r:3}),c.createElement("circle",{cx:19,cy:3,r:3}),c.createElement("circle",{cx:11,cy:3,r:3}),c.createElement("circle",{cx:3,cy:11,r:3}),c.createElement("circle",{cx:19,cy:11,r:3}),c.createElement("circle",{cx:11,cy:11,r:3}),c.createElement("circle",{cx:3,cy:19,r:3}),c.createElement("circle",{cx:19,cy:19,r:3}),c.createElement("circle",{cx:11,cy:19,r:3})))};
|
|
2
|
-
//# sourceMappingURL=
|
|
2
|
+
//# sourceMappingURL=PhoneKeypadSolid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PhoneKeypadSolid.js","sources":["../../../src/static/icons/PhoneKeypadSolid.tsx"],"sourcesContent":["import * as React from 'react'\n\nconst PhoneKeyboardSolid = (props) => (\n <svg aria-hidden=\"true\" focusable=\"false\" width={22} height={22} fill='none' xmlns='http://www.w3.org/2000/svg' {...props}>\n <g clipPath='url(#a)' fill='#fff'>\n <circle cx={3} cy={3} r={3} />\n <circle cx={19} cy={3} r={3} />\n <circle cx={11} cy={3} r={3} />\n <circle cx={3} cy={11} r={3} />\n <circle cx={19} cy={11} r={3} />\n <circle cx={11} cy={11} r={3} />\n <circle cx={3} cy={19} r={3} />\n <circle cx={19} cy={19} r={3} />\n <circle cx={11} cy={19} r={3} />\n </g>\n </svg>\n)\n\nexport default PhoneKeyboardSolid\n"],"names":["props","React","createElement","__assign","focusable","width","height","fill","xmlns","clipPath","cx","cy","r"],"mappings":"ocAE2B,SAACA,GAAU,OACpCC,EAAAC,cAAA,MAAAC,EAAAA,SAAA,CAAA,cAAiB,OAAOC,UAAU,QAAQC,MAAO,GAAIC,OAAQ,GAAIC,KAAK,OAAOC,MAAM,8BAAiCR,GAClHC,EAAAC,cAAA,IAAA,CAAGO,SAAS,UAAUF,KAAK,QACzBN,EAAQC,cAAA,SAAA,CAAAQ,GAAI,EAAGC,GAAI,EAAGC,EAAG,IACzBX,EAAQC,cAAA,SAAA,CAAAQ,GAAI,GAAIC,GAAI,EAAGC,EAAG,IAC1BX,EAAQC,cAAA,SAAA,CAAAQ,GAAI,GAAIC,GAAI,EAAGC,EAAG,IAC1BX,EAAQC,cAAA,SAAA,CAAAQ,GAAI,EAAGC,GAAI,GAAIC,EAAG,IAC1BX,EAAQC,cAAA,SAAA,CAAAQ,GAAI,GAAIC,GAAI,GAAIC,EAAG,IAC3BX,EAAQC,cAAA,SAAA,CAAAQ,GAAI,GAAIC,GAAI,GAAIC,EAAG,IAC3BX,EAAQC,cAAA,SAAA,CAAAQ,GAAI,EAAGC,GAAI,GAAIC,EAAG,IAC1BX,EAAQC,cAAA,SAAA,CAAAQ,GAAI,GAAIC,GAAI,GAAIC,EAAG,IAC3BX,EAAAC,cAAA,SAAA,CAAQQ,GAAI,GAAIC,GAAI,GAAIC,EAAG,KAGhC"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Actions.js","sources":["../../../src/components/KeyboardView/Actions.tsx"],"sourcesContent":["// Copyright (C) 2022 Nethesis S.r.l.\n// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport React, { type FC } from 'react'\nimport { Button } from '../'\n\nconst keys = Array.from(Array(9).keys())\n\nconst bottomKeys = ['*', '0', '#']\n\nconst Actions: FC<ActionsTypes> = ({ keyCallback }) => {\n return (\n <div className='grid grid-cols-3 auto-cols-max gap-y-6 justify-items-center place-items-center justify-center px-3'>\n {keys.map((key) => (\n <Button\n key={key + 1}\n onClick={() => keyCallback(key + 1)}\n variant='default'\n className={'text-2xl'}\n >\n {key + 1}\n </Button>\n ))}\n {bottomKeys.map((bottomKey) => (\n <Button\n key={bottomKey + 1}\n onClick={() => keyCallback(bottomKey)}\n variant='default'\n className={'text-2xl'}\n >\n {bottomKey}\n </Button>\n ))}\n </div>\n )\n}\n\nexport default Actions\n\ninterface ActionsTypes {\n keyCallback: any\n}\n"],"names":["keys","Array","from","bottomKeys","_a","keyCallback","React","createElement","className","map","key","Button","onClick","variant","bottomKey"],"mappings":"8nBAMMA,EAAOC,MAAMC,KAAKD,MAAM,GAAGD,QAE3BG,EAAa,CAAC,IAAK,IAAK,qBAEI,SAACC,GAAE,IAAAC,EAAWD,EAAAC,YAC9C,OACEC,EAAA,QAAAC,cAAA,MAAA,CAAKC,UAAU,sGACZR,EAAKS,KAAI,SAACC,GAAQ,OACjBJ,EAAC,QAAAC,cAAAI,EAAAA,QACCD,IAAKA,EAAM,EACXE,QAAS,WAAM,OAAAP,EAAYK,EAAM,EAAE,EACnCG,QAAQ,UACRL,UAAW,YAEVE,EAAM,EAPQ,IAUlBP,EAAWM,KAAI,SAACK,GAAc,OAC7BR,EAAC,QAAAC,cAAAI,EAAAA,QACCD,IAAKI,EAAY,EACjBF,QAAS,WAAM,OAAAP,EAAYS,IAC3BD,QAAQ,UACRL,UAAW,YAEVM,EAEJ,IAGP"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("../Button.js");require("../../node_modules/react-redux/es/index.js");var n=require("../../node_modules/@nethesis/nethesis-light-svg-icons/index.mjs.js"),r=require("../../node_modules/@fortawesome/react-fontawesome/index.es.js"),a=require("./Actions.js"),s=require("../../lib/phone/call.js"),u=require("../../node_modules/@nethesis/nethesis-solid-svg-icons/index.mjs.js"),l=require("../../static/dtmf/index.js"),o=require("../../lib/webrtc/messages.js"),c=require("../../node_modules/react-redux/es/hooks/useDispatch.js"),d=require("../../node_modules/react-redux/es/hooks/useSelector.js");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=i(e),m=["0","1","2","3","4","5","6","7","8","9","*","#"];exports.default=function(){var i=c.useDispatch(),x=d.useSelector((function(e){return e.currentCall})).keyboardValue,p=d.useSelector((function(e){return e.island})).isOpen,v=e.useRef(x);function y(e){i.currentCall.updateKeyboardValue("".concat(v.current).concat(e)),v.current="".concat(v.current).concat(e),function(e){"*"===e&&(e="star"),"#"===e&&(e="pound"),i.player.updateAndPlayAudioPlayer({src:l.default["dtmf_".concat(e)]})}(e),o.sendDTMF(e)}return e.useEffect((function(){function e(e){m.includes(e.key)&&y(e.key)}return window.addEventListener("keydown",e),function(){return window.removeEventListener("keydown",e)}}),[]),f.default.createElement(f.default.Fragment,null,p?f.default.createElement("div",{className:"flex flex-col gap-7"},f.default.createElement("div",{className:"flex gap-4"},f.default.createElement(t.Button,{variant:"transparent",onClick:function(){i.island.setIslandView("call")}},f.default.createElement(r.FontAwesomeIcon,{size:"xl",icon:n.faArrowLeft})),f.default.createElement("input",{type:"text",readOnly:!0,value:x,autoFocus:!0,className:"w-full rounded-xl bg-black border border-gray-300 text-white font-sans font-light text-xl text-center px-2"})),f.default.createElement(a.default,{keyCallback:y}),f.default.createElement("div",{className:"flex justify-center"},f.default.createElement(t.Button,{onClick:s.hangupCurrentCall,variant:"red"},f.default.createElement(r.FontAwesomeIcon,{className:"rotate-135 w-6 h-6",icon:u.faPhone})))):f.default.createElement("div",{className:"font-medium text-base"},"Keyboard"))};
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/KeyboardView/index.tsx"],"sourcesContent":["// Copyright (C) 2022 Nethesis S.r.l.\n// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport React, { type FC, useEffect, useRef } from 'react'\nimport { Button } from '../Button'\nimport { useDispatch, useSelector } from 'react-redux'\nimport { Dispatch, RootState } from '../../store'\nimport { faArrowLeft } from '@nethesis/nethesis-light-svg-icons'\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\nimport Actions from './Actions'\nimport { hangupCurrentCall } from '../../lib/phone/call'\nimport { faPhone } from '@nethesis/nethesis-solid-svg-icons'\nimport dtmfAudios from '../../static/dtmf'\nimport { sendDTMF } from '../../lib/webrtc/messages'\n\nconst DTMF_KEYS = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '*', '#']\n\nconst KeyboardView: FC<KeyboardViewTypes> = () => {\n const dispatch = useDispatch<Dispatch>()\n const { keyboardValue } = useSelector((state: RootState) => state.currentCall)\n const { isOpen } = useSelector((state: RootState) => state.island)\n const keyboardValueRef = useRef<typeof keyboardValue>(keyboardValue)\n\n function backToCallView() {\n dispatch.island.setIslandView('call')\n }\n\n function playDtmfAudio(key: string) {\n if (key === '*') key = 'star'\n if (key === '#') key = 'pound'\n dispatch.player.updateAndPlayAudioPlayer({ src: dtmfAudios[`dtmf_${key}`] })\n }\n\n function sendKey(key: string) {\n dispatch.currentCall.updateKeyboardValue(`${keyboardValueRef.current}${key}`)\n keyboardValueRef.current = `${keyboardValueRef.current}${key}`\n playDtmfAudio(key)\n sendDTMF(key)\n }\n\n useEffect(() => {\n function handlePhysicalKeydown(event) {\n if (DTMF_KEYS.includes(event.key)) {\n sendKey(event.key)\n }\n }\n window.addEventListener('keydown', handlePhysicalKeydown)\n return () => window.removeEventListener('keydown', handlePhysicalKeydown)\n }, [])\n\n return (\n <>\n {isOpen ? (\n <div className='flex flex-col gap-7'>\n <div className='flex gap-4'>\n <Button variant='transparent' onClick={backToCallView}>\n <FontAwesomeIcon size='xl' icon={faArrowLeft} />\n </Button>\n <input\n type='text'\n readOnly\n value={keyboardValue}\n autoFocus\n className='w-full rounded-xl bg-black border border-gray-300 text-white font-sans font-light text-xl text-center px-2'\n />\n </div>\n <Actions keyCallback={sendKey} />\n <div className='flex justify-center'>\n {/* The button to hangup the currentCall */}\n <Button onClick={hangupCurrentCall} variant='red'>\n <FontAwesomeIcon className='rotate-135 w-6 h-6' icon={faPhone} />\n </Button>\n </div>\n </div>\n ) : (\n <div className='font-medium text-base'>Keyboard</div>\n )}\n </>\n )\n}\n\nexport default KeyboardView\n\nexport interface KeyboardViewTypes {}\n"],"names":["DTMF_KEYS","dispatch","useDispatch","keyboardValue","useSelector","state","currentCall","isOpen","island","keyboardValueRef","useRef","sendKey","key","updateKeyboardValue","concat","current","player","updateAndPlayAudioPlayer","src","dtmfAudios","playDtmfAudio","sendDTMF","useEffect","handlePhysicalKeydown","event","includes","window","addEventListener","removeEventListener","React","createElement","Fragment","className","Button","variant","onClick","setIslandView","FontAwesomeIcon","size","icon","faArrowLeft","type","readOnly","value","autoFocus","Actions","keyCallback","hangupCurrentCall","faPhone"],"mappings":"swBAeMA,EAAY,CAAC,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,IAAK,qBAE9B,WAC1C,IAAMC,EAAWC,EAAAA,cACTC,EAAkBC,eAAY,SAACC,GAAqB,OAAAA,EAAMC,6BAC1DC,EAAWH,eAAY,SAACC,GAAqB,OAAAA,EAAMG,iBACrDC,EAAmBC,SAA6BP,GAYtD,SAASQ,EAAQC,GACfX,EAASK,YAAYO,oBAAoB,GAAAC,OAAGL,EAAiBM,SAAOD,OAAGF,IACvEH,EAAiBM,QAAU,GAAGD,OAAAL,EAAiBM,SAAOD,OAAGF,GAR3D,SAAuBA,GACT,MAARA,IAAaA,EAAM,QACX,MAARA,IAAaA,EAAM,SACvBX,EAASe,OAAOC,yBAAyB,CAAEC,IAAKC,EAAAA,QAAW,eAAQP,KACpE,CAKCQ,CAAcR,GACdS,EAAQA,SAACT,EACV,CAYD,OAVAU,EAAAA,WAAU,WACR,SAASC,EAAsBC,GACzBxB,EAAUyB,SAASD,EAAMZ,MAC3BD,EAAQa,EAAMZ,IAEjB,CAED,OADAc,OAAOC,iBAAiB,UAAWJ,GAC5B,WAAM,OAAAG,OAAOE,oBAAoB,UAAWL,GACpD,GAAE,IAGDM,UACGC,cAAAD,EAAA,QAAAE,SAAA,KAAAxB,EACCsB,EAAAA,QAAAC,cAAA,MAAA,CAAKE,UAAU,uBACbH,EAAAA,QAAKC,cAAA,MAAA,CAAAE,UAAU,cACbH,EAAC,QAAAC,cAAAG,UAAOC,QAAQ,cAAcC,QAhCxC,WACElC,EAASO,OAAO4B,cAAc,OAC/B,GA+BWP,UAACC,cAAAO,EAAAA,gBAAgB,CAAAC,KAAK,KAAKC,KAAMC,EAAWA,eAE9CX,EAAA,QAAAC,cAAA,QAAA,CACEW,KAAK,OACLC,YACAC,MAAOxC,EACPyC,WACA,EAAAZ,UAAU,gHAGdH,EAAAA,QAAAC,cAACe,EAAAA,QAAO,CAACC,YAAanC,IACtBkB,EAAAA,QAAKC,cAAA,MAAA,CAAAE,UAAU,uBAEbH,EAAC,QAAAC,cAAAG,UAAOE,QAASY,EAAiBA,kBAAEb,QAAQ,OAC1CL,UAACC,cAAAO,EAAAA,gBAAgB,CAAAL,UAAU,qBAAqBO,KAAMS,EAAOA,aAKnEnB,UAAKC,cAAA,MAAA,CAAAE,UAAU,yBAAsC,YAI7D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PhoneKeyboardLight.js","sources":["../../../src/static/icons/PhoneKeyboardLight.tsx"],"sourcesContent":["import * as React from 'react'\n\nconst PhoneKeyboardLight = (props) => (\n <svg aria-hidden=\"true\" focusable=\"false\" width={22} height={22} fill='none' xmlns='http://www.w3.org/2000/svg' {...props}>\n <g clipPath='url(#a)' fillRule='evenodd' clipRule='evenodd' fill='#fff'>\n <path d='M3 6a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm0-1a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM3 14a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm0-1a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM11 14a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm0-1a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM19 14a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm0-1a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM3 22a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm0-1a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM11 22a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm0-1a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM19 22a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm0-1a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM11 6a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm0-1a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM19 6a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm0-1a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z' />\n </g>\n </svg>\n)\n\nexport default PhoneKeyboardLight\n"],"names":["props","React","createElement","__assign","focusable","width","height","fill","xmlns","clipPath","fillRule","clipRule","d"],"mappings":"ocAE2B,SAACA,GAAU,OACpCC,EAAAC,cAAA,MAAAC,EAAAA,SAAA,CAAA,cAAiB,OAAOC,UAAU,QAAQC,MAAO,GAAIC,OAAQ,GAAIC,KAAK,OAAOC,MAAM,8BAAiCR,GAClHC,EAAAC,cAAA,IAAA,CAAGO,SAAS,UAAUC,SAAS,UAAUC,SAAS,UAAUJ,KAAK,QAC/DN,EAAMC,cAAA,OAAA,CAAAU,EAAE,omBAHwB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PhoneKeyboardSolid.js","sources":["../../../src/static/icons/PhoneKeyboardSolid.tsx"],"sourcesContent":["import * as React from 'react'\n\nconst PhoneKeyboardSolid = (props) => (\n <svg aria-hidden=\"true\" focusable=\"false\" width={22} height={22} fill='none' xmlns='http://www.w3.org/2000/svg' {...props}>\n <g clipPath='url(#a)' fill='#fff'>\n <circle cx={3} cy={3} r={3} />\n <circle cx={19} cy={3} r={3} />\n <circle cx={11} cy={3} r={3} />\n <circle cx={3} cy={11} r={3} />\n <circle cx={19} cy={11} r={3} />\n <circle cx={11} cy={11} r={3} />\n <circle cx={3} cy={19} r={3} />\n <circle cx={19} cy={19} r={3} />\n <circle cx={11} cy={19} r={3} />\n </g>\n </svg>\n)\n\nexport default PhoneKeyboardSolid\n"],"names":["props","React","createElement","__assign","focusable","width","height","fill","xmlns","clipPath","cx","cy","r"],"mappings":"ocAE2B,SAACA,GAAU,OACpCC,EAAAC,cAAA,MAAAC,EAAAA,SAAA,CAAA,cAAiB,OAAOC,UAAU,QAAQC,MAAO,GAAIC,OAAQ,GAAIC,KAAK,OAAOC,MAAM,8BAAiCR,GAClHC,EAAAC,cAAA,IAAA,CAAGO,SAAS,UAAUF,KAAK,QACzBN,EAAQC,cAAA,SAAA,CAAAQ,GAAI,EAAGC,GAAI,EAAGC,EAAG,IACzBX,EAAQC,cAAA,SAAA,CAAAQ,GAAI,GAAIC,GAAI,EAAGC,EAAG,IAC1BX,EAAQC,cAAA,SAAA,CAAAQ,GAAI,GAAIC,GAAI,EAAGC,EAAG,IAC1BX,EAAQC,cAAA,SAAA,CAAAQ,GAAI,EAAGC,GAAI,GAAIC,EAAG,IAC1BX,EAAQC,cAAA,SAAA,CAAAQ,GAAI,GAAIC,GAAI,GAAIC,EAAG,IAC3BX,EAAQC,cAAA,SAAA,CAAAQ,GAAI,GAAIC,GAAI,GAAIC,EAAG,IAC3BX,EAAQC,cAAA,SAAA,CAAAQ,GAAI,EAAGC,GAAI,GAAIC,EAAG,IAC1BX,EAAQC,cAAA,SAAA,CAAAQ,GAAI,GAAIC,GAAI,GAAIC,EAAG,IAC3BX,EAAAC,cAAA,SAAA,CAAQQ,GAAI,GAAIC,GAAI,GAAIC,EAAG,KAGhC"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|