UNPKG

@nethesis/phone-island

Version:
3 lines (2 loc) 4.59 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");require("../node_modules/react-redux/es/index.js");var i=require("../utils/genericFunctions/eventDispatch.js");require("../store/index.js");var t=require("../node_modules/framer-motion/dist/es/render/components/motion/proxy.mjs.js"),d=require("../node_modules/react-redux/es/hooks/useSelector.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=n(e),h=function(n){var h=n.children,r=d.useSelector((function(e){return e.currentCall})),c=r.incoming,s=r.outgoing,o=r.accepted,l=r.transferring,g=r.incomingWebRTC,p=r.incomingSocket,w=r.conferencing,u=d.useSelector((function(e){return e.listen})).isListen,x=d.useSelector((function(e){return e.island})),f=x.view,m=x.isOpen,v=x.actionsExpanded,_=x.sideViewIsVisible,b=x.isFromStreaming,k=x.isExtraLarge,S=d.useSelector((function(e){return e.alerts.status})).activeAlertsCount,y=d.useSelector((function(e){return e.motions})),A=y.variants,C=y.border_radius_collapsed,j=y.border_radius_expanded,E=y.border_radius_collapsed_conference,q=y.padding_x_collapsed,D=y.padding_y_collapsed,L=y.padding_expanded,I=y.alert_padding_expanded,M=d.useSelector((function(e){return e.conference})).isActive,O=e.useMemo((function(){var e={width:0,height:0,padding:L};switch(f){case"call":m?o&&l&&w?e=v?{width:A.call.expanded.transfer.actionsExpanded.width,height:A.call.expanded.transfer.actionsExpanded.height}:{width:A.call.expanded.transfer.width,height:A.call.expanded.transfer.height}:o&&v?e={width:A.call.expanded.accepted.actionsExpanded.width,height:A.call.expanded.accepted.actionsExpanded.height}:o&&!u?e={width:A.call.expanded.accepted.width,height:A.call.expanded.accepted.height}:o&&u?e={width:A.call.expanded.listening.width,height:A.call.expanded.listening.height}:c&&!b?e={width:A.call.expanded.incoming.width,height:A.call.expanded.incoming.height}:c&&b?e={width:A.call.expanded.incomingStreaming.width,height:A.call.expanded.incomingStreaming.height}:s&&!b?e={width:A.call.expanded.outgoing.width,height:A.call.expanded.outgoing.height}:s&&b&&(e={width:A.call.expanded.outgoingStreaming.width,height:A.call.expanded.outgoingStreaming.height}):e={width:A.call.collapsed.width,height:A.call.collapsed.height};break;case"keypad":e=m?{width:A.keypad.expanded.width,height:A.keypad.expanded.height}:{width:A.transfer.collapsed.width,height:A.transfer.collapsed.height};break;case"video":e=m?{width:A.video.expanded.width,height:A.video.expanded.height,padding:A.video.expanded.padding}:{width:A.video.collapsed.width,height:A.video.collapsed.height};break;case"transfer":case"player":case"recorder":case"physicalPhoneRecorder":case"settings":case"conference":e=m?{width:A[f].expanded.width,height:A[f].expanded.height}:{width:A[f].collapsed.width,height:A[f].collapsed.height};break;case"switchDevice":e=m?{width:A.switchDevice.expanded.width,height:A.switchDevice.expanded.height}:{width:A.video.collapsed.width,height:A.video.collapsed.height};break;case"waitingConference":e=m?{width:A.waitingConference.expanded.width,height:A.waitingConference.expanded.height}:{width:A.waitingConference.collapsed.width,height:A.waitingConference.collapsed.height};break;case"streamingAnswer":e=m?k?{width:A.streamingAnswer.extraLarge.width,height:A.streamingAnswer.extraLarge.height,padding:A.streamingAnswer.extraLarge.padding}:{width:A.streamingAnswer.expanded.width,height:A.streamingAnswer.expanded.height,padding:A.streamingAnswer.expanded.padding}:{width:A.streamingAnswer.collapsed.width,height:A.streamingAnswer.collapsed.height}}var i=S>0;return{width:"".concat(0===e.width&&i?A.alerts.width:e.width,"px"),height:"".concat(i&&m?A.alerts.height+(0===e.height?2*I:I):e.height,"px"),borderRadius:"".concat(m?j:M&&"waitingConference"===f?E:C,"px"),padding:m?null!=e.padding?"".concat(e.padding,"px"):"".concat(L,"px"):"".concat(q,"px ").concat(D,"px")}}),[f,m,o,l,v,u,c,s,S,A,C,j,q,D,L,I,g,p,M,b,k]);return e.useEffect((function(){var e={};e.width=null==O?void 0:O.width,e.height=null==O?void 0:O.height,i.eventDispatch("phone-island-size-change",{sizeInformation:e})}),[O,f,m,o,l,v,u,c,s,S,A,C,j,q,D,L,I,_,p,g,M,k]),a.default.createElement(t.motion.div,{className:"".concat(m?"pi-cursor-grab":"pi-cursor-pointer"," pi-pointer-events-auto pi-overflow-hidden dark:pi-bg-gray-950 pi-bg-gray-50 pi-text-xs dark:pi-text-white pi-text-gray-900 hover:pi-shadow-2xl pi-rounded-3xl pi-transition-shadow"),animate:O,transition:{duration:.15,ease:"easeOut"}},h)};exports.IslandMotion=h,exports.default=h; //# sourceMappingURL=IslandMotion.js.map