@nethesis/phone-island 0.9.0 → 0.10.0

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/App.js CHANGED
@@ -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"),t=require("./components/Events.js"),s=require("./components/Socket.js"),i=require("./components/WebRTC.js"),o=require("./components/Island.js"),a=require("./components/RestAPI.js"),r=require("./utils/customHooks/useEventListener.js"),c=require("./utils/genericFunctions/eventDispatch.js"),u=require("./utils/genericFunctions/localStorage.js");require("./node_modules/react-redux/es/index.js");var d=require("./store/index.js");require("./node_modules/@fortawesome/react-fontawesome/index.es.js"),require("./node_modules/i18next/dist/esm/i18next.js"),require("./node_modules/react-tooltip/dist/react-tooltip.min.mjs.js");var l=require("./node_modules/js-base64/base64.mjs.js"),p=require("./workers/wake_up.js"),h=require("./lib/i18n.js");require("./node_modules/react-tooltip/dist/react-tooltip.min.css.js");var v=require("./lib/webrtc/messages.js"),f=require("./lib/darkTheme.js"),m=require("./services/user.js"),g=require("./utils/genericFunctions/isEmpty.js"),E=require("./utils/genericFunctions/checkConnection.js"),j=require("./utils/genericFunctions/isBackCallVisible.js"),I=require("./node_modules/react-redux/es/components/Provider.js");function b(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}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"),require("./node_modules/react-redux/es/components/Context.js");var q=b(n),w=function(b){var w=b.dataConfig,D=b.showAlways,L=void 0!==D&&D,S=b.uaType,y=l.Base64.atob(w||"").split(":"),k=y[0],x=y[1],_=y[2],C=y[3],P=y[4],T=y[5],V=y[6],A=n.useState(!1),O=A[0],N=A[1],U=n.useState(!1),z=U[0],F=U[1],R=n.useState(!1),W=R[0],B=R[1];n.useEffect((function(){var e=new Worker(p.default,{type:"module"});return e.onmessage=function(e){"wakeup"===e.data&&N(!0)},function(){e.terminate()}}),[]),n.useEffect((function(){W&&z&&(N(!1),F(!1),B(!1))}),[W,z]),r.useEventListener("phone-island-expand",(function(){d.store.dispatch.island.toggleIsOpen(!0),c.eventDispatch("phone-island-expanded",{})})),r.useEventListener("phone-island-compress",(function(){d.store.dispatch.island.toggleIsOpen(!1),c.eventDispatch("phone-island-compressed",{})})),r.useEventListener("phone-island-call-keypad-close",(function(){d.store.dispatch.island.setIslandView("call"),c.eventDispatch("phone-island-call-keypad-closed",{})})),r.useEventListener("phone-island-call-transfer-close",(function(){d.store.dispatch.island.setIslandView("call"),c.eventDispatch("phone-island-call-transfer-closed",{})})),r.useEventListener("phone-island-recording-close",(function(){d.store.dispatch.island.setIslandView(null),c.eventDispatch("phone-island-recording-closed",{})})),r.useEventListener("phone-island-audio-player-close",(function(){d.store.dispatch.island.setIslandView(null),c.eventDispatch("phone-island-audio-player-closed",{})})),r.useEventListener("phone-island-detach",(function(e){v.detach(),c.eventDispatch("phone-island-detached",{})})),r.useEventListener("phone-island-audio-input-change",(function(e){u.setJSONItem("phone-island-audio-input-device",{deviceId:e.deviceId}),c.eventDispatch("phone-island-audio-input-changed",{})})),r.useEventListener("phone-island-audio-output-change",(function(e){var n=d.store.getState().player.remoteAudio;null==n||n.current.setSinkId(e.deviceId).then((function(){console.info("Default audio output device change with success!"),u.setJSONItem("phone-island-audio-output-device",{deviceId:e.deviceId}),c.eventDispatch("phone-island-audio-output-changed",{})})).catch((function(e){console.error("Default audio output device change error:",e)}))})),r.useEventListener("phone-island-presence-change",(function(e){m.changeOperatorStatus(e),c.eventDispatch("phone-island-presence-changed",{})})),r.useEventListener("phone-island-view-changed",(function(e){var n=null==e?void 0:e.viewType;d.store.dispatch.island.setIslandView(n)}));var H=n.useState(!0),J=H[0],M=H[1],G=n.useState(!0),K=G[0],Q=G[1];n.useEffect((function(){J&&(h.initI18n(),M(!1))}),[J]);var X=d.store.getState().player.remoteAudio;return n.useEffect((function(){var e;if(K&&X){var n=null===(e=u.getJSONItem("phone-island-audio-output-device"))||void 0===e?void 0:e.deviceId;c.eventDispatch("phone-island-audio-output-change",{deviceId:n}),Q(!1)}}),[K,X]),n.useEffect((function(){f.checkDarkTheme()}),[]),r.useEventListener("phone-island-theme-change",(function(e){f.setTheme(null==e?void 0:e.selectedTheme)})),r.useEventListener("phone-island-default-device-change",(function(e){d.store.dispatch.currentUser.updateCurrentDefaultDevice(null==e?void 0:e.deviceInformationObject),c.eventDispatch("phone-island-default-device-changed",{})})),r.useEventListener("phone-island-alert",(function(e){d.store.dispatch.alerts.setAlert(e.toString())})),r.useEventListener("phone-island-check-connection",(function(){E.checkInternetConnection().then((function(e){e?c.eventDispatch("phone-island-internet-connected",{}):c.eventDispatch("phone-island-internet-disconnected",{})}))})),n.useEffect((function(){var e=setInterval((function(){E.checkInternetConnection().then((function(e){e?c.eventDispatch("phone-island-internet-connected",{}):c.eventDispatch("phone-island-internet-disconnected",{})}))}),5e3);return function(){return clearInterval(e)}}),[]),r.useEventListener("phone-island-main-presence",(function(e){var n,t,s,i,o=null===(n=d.store.getState().currentUser)||void 0===n?void 0:n.username,a=d.store.getState().currentUser,r=null==a?void 0:a.mainPresence;if(void 0!==o&&""!==o&&!g.isEmpty(e[o])&&void 0!==(null===(t=e[o])||void 0===t?void 0:t.mainPresence)){var u=null===(s=e[o])||void 0===s?void 0:s.mainPresence;d.store.dispatch.currentUser.updateMainPresence(null===(i=e[o])||void 0===i?void 0:i.mainPresence),"online"===u&&"online"!==r&&c.eventDispatch("phone-island-call-ended",{})}})),r.useEventListener("phone-island-call-status",(function(){var e=d.store.getState().currentCall;console.log("Call status debug informations: ",e)})),r.useEventListener("phone-island-user-status",(function(){var e=d.store.getState().currentUser;console.log("User status debug informations: ",e)})),r.useEventListener("phone-island-all-users-status",(function(){var e=d.store.getState().users;console.log("Users status debug informations: ",e)})),r.useEventListener("phone-island-status",(function(){var e=d.store.getState().island;console.log("Phone island status debug informations: ",e)})),r.useEventListener("phone-island-webrtc-status",(function(){var e=d.store.getState().webrtc;console.log("Webrtc status debug informations: ",e)})),r.useEventListener("phone-island-player-status",(function(){var e=d.store.getState().player;console.log("Player status debug informations: ",e)})),r.useEventListener("phone-island-player-force-stop",(function(){d.store.dispatch.player.reset(),console.log("Audio player is interrupted")})),r.useEventListener("phone-island-sideview-open",(function(){d.store.dispatch.island.toggleSideViewVisible(!0),c.eventDispatch("phone-island-sideview-opened",{})})),r.useEventListener("phone-island-sideview-close",(function(){d.store.dispatch.island.toggleSideViewVisible(!1),c.eventDispatch("phone-island-sideview-closed",{})})),r.useEventListener("phone-island-size-change",(function(n){var t=d.store.getState().island.sideViewIsVisible,s=n.sizeInformation,i={right:"".concat(t?42:0,"px"),top:"".concat(j.isBackCallActive()?40:0,"px")},o=e.__assign(e.__assign({},s),{extraDimension:i});c.eventDispatch("phone-island-size-changed",{sizes:o})})),r.useEventListener("phone-island-call-ended",(function(){c.eventDispatch("phone-island-size-change",{sizeInformation:{width:"0px",height:"0px"}})})),q.default.createElement(q.default.Fragment,null,q.default.createElement(I.default,{store:d.store},q.default.createElement(i.WebRTC,{hostName:k,sipExten:C,sipSecret:P,sipHost:T,sipPort:V,reload:O,reloadedCallback:function(){return F(!0)},uaType:S},q.default.createElement(a.RestAPI,{hostName:k,username:x,authToken:_},q.default.createElement(s.Socket,{hostName:k,username:x,authToken:_,reload:O,reloadedCallback:function(){return B(!0)},uaType:S},q.default.createElement(t.Events,{sipHost:T},q.default.createElement(o.Island,{showAlways:L})))))))};w.displayName="PhoneIsland",exports.PhoneIsland=w;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./node_modules/tslib/tslib.es6.js"),n=require("react"),t=require("./components/Events.js"),s=require("./components/Socket.js"),i=require("./components/WebRTC.js"),o=require("./components/Island.js"),a=require("./components/RestAPI.js"),r=require("./utils/customHooks/useEventListener.js"),c=require("./utils/genericFunctions/eventDispatch.js"),u=require("./utils/genericFunctions/localStorage.js");require("./node_modules/react-redux/es/index.js");var d=require("./store/index.js");require("./node_modules/@fortawesome/react-fontawesome/index.es.js"),require("./node_modules/i18next/dist/esm/i18next.js"),require("./node_modules/react-tooltip/dist/react-tooltip.min.mjs.js");var l=require("./node_modules/js-base64/base64.mjs.js"),p=require("./workers/wake_up.js"),h=require("./lib/i18n.js");require("./node_modules/react-tooltip/dist/react-tooltip.min.css.js");var v=require("./lib/webrtc/messages.js"),f=require("./lib/darkTheme.js"),m=require("./services/user.js"),g=require("./utils/genericFunctions/isEmpty.js"),E=require("./utils/genericFunctions/checkConnection.js"),j=require("./utils/genericFunctions/isBackCallVisible.js"),I=require("./node_modules/react-redux/es/components/Provider.js");function b(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}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"),require("./node_modules/react-redux/es/components/Context.js");var q=b(n),w=function(b){var w=b.dataConfig,L=b.showAlways,S=void 0!==L&&L,D=b.uaType,y=l.Base64.atob(w||"").split(":"),k=y[0],x=y[1],_=y[2],C=y[3],P=y[4],T=y[5],V=y[6],A=n.useState(!1),O=A[0],N=A[1],U=n.useState(!1),z=U[0],F=U[1],R=n.useState(!1),W=R[0],B=R[1];n.useEffect((function(){var e=new Worker(p.default,{type:"module"});return e.onmessage=function(e){"wakeup"===e.data&&N(!0)},function(){e.terminate()}}),[]),n.useEffect((function(){W&&z&&(N(!1),F(!1),B(!1))}),[W,z]),r.useEventListener("phone-island-expand",(function(){d.store.dispatch.island.toggleIsOpen(!0),c.eventDispatch("phone-island-expanded",{})})),r.useEventListener("phone-island-compress",(function(){d.store.dispatch.island.toggleIsOpen(!1),c.eventDispatch("phone-island-compressed",{})})),r.useEventListener("phone-island-call-keypad-close",(function(){d.store.dispatch.island.setIslandView("call"),c.eventDispatch("phone-island-call-keypad-closed",{})})),r.useEventListener("phone-island-call-transfer-close",(function(){d.store.dispatch.island.setIslandView("call"),c.eventDispatch("phone-island-call-transfer-closed",{})})),r.useEventListener("phone-island-recording-close",(function(){d.store.dispatch.island.setIslandView(null),c.eventDispatch("phone-island-recording-closed",{})})),r.useEventListener("phone-island-audio-player-close",(function(){d.store.dispatch.island.setIslandView(null),c.eventDispatch("phone-island-audio-player-closed",{})})),r.useEventListener("phone-island-detach",(function(e){v.detach(),c.eventDispatch("phone-island-detached",{})})),r.useEventListener("phone-island-audio-input-change",(function(e){u.setJSONItem("phone-island-audio-input-device",{deviceId:e.deviceId}),c.eventDispatch("phone-island-audio-input-changed",{})})),r.useEventListener("phone-island-audio-output-change",(function(e){var n=d.store.getState().player.remoteAudio;null==n||n.current.setSinkId(e.deviceId).then((function(){console.info("Default audio output device change with success!"),u.setJSONItem("phone-island-audio-output-device",{deviceId:e.deviceId}),c.eventDispatch("phone-island-audio-output-changed",{})})).catch((function(e){console.error("Default audio output device change error:",e)}))})),r.useEventListener("phone-island-presence-change",(function(e){m.changeOperatorStatus(e),c.eventDispatch("phone-island-presence-changed",{})})),r.useEventListener("phone-island-view-changed",(function(e){var n=null==e?void 0:e.viewType;d.store.dispatch.island.setIslandView(n)}));var H=n.useState(!0),J=H[0],M=H[1],G=n.useState(!0),K=G[0],Q=G[1];n.useEffect((function(){J&&(h.initI18n(),M(!1))}),[J]);var X=d.store.getState().player.remoteAudio;return n.useEffect((function(){var e;if(K&&X){var n=null===(e=u.getJSONItem("phone-island-audio-output-device"))||void 0===e?void 0:e.deviceId;c.eventDispatch("phone-island-audio-output-change",{deviceId:n}),Q(!1)}}),[K,X]),n.useEffect((function(){f.checkDarkTheme()}),[]),r.useEventListener("phone-island-theme-change",(function(e){f.setTheme(null==e?void 0:e.selectedTheme)})),r.useEventListener("phone-island-default-device-change",(function(e){d.store.dispatch.currentUser.updateCurrentDefaultDevice(null==e?void 0:e.deviceInformationObject),c.eventDispatch("phone-island-default-device-changed",{})})),r.useEventListener("phone-island-alert",(function(e){d.store.dispatch.alerts.setAlert(e.toString())})),r.useEventListener("phone-island-check-connection",(function(){E.checkInternetConnection().then((function(e){e?c.eventDispatch("phone-island-internet-connected",{}):c.eventDispatch("phone-island-internet-disconnected",{})}))})),n.useEffect((function(){var e=setInterval((function(){E.checkInternetConnection().then((function(e){e?c.eventDispatch("phone-island-internet-connected",{}):c.eventDispatch("phone-island-internet-disconnected",{})}))}),5e3);return function(){return clearInterval(e)}}),[]),r.useEventListener("phone-island-main-presence",(function(e){var n,t,s,i,o=null===(n=d.store.getState().currentUser)||void 0===n?void 0:n.username,a=d.store.getState().currentUser,r=null==a?void 0:a.mainPresence;if(void 0!==o&&""!==o&&!g.isEmpty(e[o])&&void 0!==(null===(t=e[o])||void 0===t?void 0:t.mainPresence)){var u=null===(s=e[o])||void 0===s?void 0:s.mainPresence;d.store.dispatch.currentUser.updateMainPresence(null===(i=e[o])||void 0===i?void 0:i.mainPresence),"online"===u&&"online"!==r&&c.eventDispatch("phone-island-call-ended",{})}})),r.useEventListener("phone-island-call-status",(function(){var e=d.store.getState().currentCall;console.log("Call status debug informations: ",e)})),r.useEventListener("phone-island-user-status",(function(){var e=d.store.getState().currentUser;console.log("User status debug informations: ",e)})),r.useEventListener("phone-island-all-users-status",(function(){var e=d.store.getState().users;console.log("Users status debug informations: ",e)})),r.useEventListener("phone-island-status",(function(){var e=d.store.getState().island;console.log("Phone island status debug informations: ",e)})),r.useEventListener("phone-island-webrtc-status",(function(){var e=d.store.getState().webrtc;console.log("Webrtc status debug informations: ",e)})),r.useEventListener("phone-island-player-status",(function(){var e=d.store.getState().player;console.log("Player status debug informations: ",e)})),r.useEventListener("phone-island-player-force-stop",(function(){d.store.dispatch.player.reset(),console.log("Audio player is interrupted")})),r.useEventListener("phone-island-sideview-open",(function(){d.store.dispatch.island.toggleSideViewVisible(!0),c.eventDispatch("phone-island-sideview-opened",{})})),r.useEventListener("phone-island-sideview-close",(function(){d.store.dispatch.island.toggleSideViewVisible(!1),c.eventDispatch("phone-island-sideview-closed",{})})),r.useEventListener("phone-island-size-change",(function(n){var t=d.store.getState().island.sideViewIsVisible,s=n.sizeInformation,i=e.__assign(e.__assign({},s),{right:t?"42px":"0px",top:j.isBackCallActive()?"40px":"0px"});c.eventDispatch("phone-island-size-changed",{sizes:i})})),r.useEventListener("phone-island-call-ended",(function(){c.eventDispatch("phone-island-size-change",{sizeInformation:{width:"0px",height:"0px"}})})),q.default.createElement(q.default.Fragment,null,q.default.createElement(I.default,{store:d.store},q.default.createElement(i.WebRTC,{hostName:k,sipExten:C,sipSecret:P,sipHost:T,sipPort:V,reload:O,reloadedCallback:function(){return F(!0)},uaType:D},q.default.createElement(a.RestAPI,{hostName:k,username:x,authToken:_},q.default.createElement(s.Socket,{hostName:k,username:x,authToken:_,reload:O,reloadedCallback:function(){return B(!0)},uaType:D},q.default.createElement(t.Events,{sipHost:T},q.default.createElement(o.Island,{showAlways:S})))))))};w.displayName="PhoneIsland",exports.PhoneIsland=w;
2
2
  //# sourceMappingURL=App.js.map
package/dist/App.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"App.js","sources":["../src/App.tsx"],"sourcesContent":["import React, { type FC, useState, useEffect } from 'react'\nimport { Events, Socket, WebRTC, Island, RestAPI } from './components'\nimport { Provider } from 'react-redux'\nimport { store } from './store'\nimport { Base64 } from 'js-base64'\nimport wakeUpWorker from './workers/wake_up'\nimport { initI18n } from './lib/i18n'\n\nimport 'react-tooltip/dist/react-tooltip.css'\nimport { useEventListener, eventDispatch, setJSONItem, getJSONItem } from './utils'\nimport { detach } from './lib/webrtc/messages'\nimport { checkDarkTheme, setTheme } from './lib/darkTheme'\nimport { changeOperatorStatus } from './services/user'\nimport { isEmpty } from './utils/genericFunctions/isEmpty'\nimport { checkInternetConnection } from './utils/genericFunctions/checkConnection'\nimport { isBackCallActive } from './utils/genericFunctions/isBackCallVisible'\n\ninterface PhoneIslandProps {\n dataConfig: string\n showAlways?: boolean\n uaType: string\n}\n\ninterface DeviceInputOutputTypes {\n deviceId: string\n}\n\nexport const PhoneIsland: FC<PhoneIslandProps> = ({\n dataConfig,\n showAlways = false,\n uaType,\n}: PhoneIslandProps) => {\n const CONFIG: string[] = Base64.atob(dataConfig || '').split(':')\n const HOST_NAME: string = CONFIG[0]\n const USERNAME: string = CONFIG[1]\n const AUTH_TOKEN: string = CONFIG[2]\n const SIP_EXTEN: string = CONFIG[3]\n const SIP_SECRET: string = CONFIG[4]\n const SIP_HOST: string = CONFIG[5]\n const SIP_PORT: string = CONFIG[6]\n\n // Initialize the state to manage the reload events\n const [reload, setReload] = useState<boolean>(false)\n const [reloadedWebRTC, setReloadedWebRTC] = useState<boolean>(false)\n const [reloadedSocket, setReloadedSocket] = useState<boolean>(false)\n\n useEffect(() => {\n const worker = new Worker(wakeUpWorker, { type: 'module' })\n worker.onmessage = (event: MessageEvent<string>) => {\n // Handle wakeup message\n if (event.data === 'wakeup') {\n setReload(true)\n }\n }\n\n return () => {\n worker.terminate()\n }\n }, [])\n\n useEffect(() => {\n if (reloadedSocket && reloadedWebRTC) {\n setReload(false)\n setReloadedWebRTC(false)\n setReloadedSocket(false)\n }\n }, [reloadedSocket, reloadedWebRTC])\n\n useEventListener('phone-island-expand', () => {\n store.dispatch.island.toggleIsOpen(true)\n eventDispatch('phone-island-expanded', {})\n })\n useEventListener('phone-island-compress', () => {\n store.dispatch.island.toggleIsOpen(false)\n eventDispatch('phone-island-compressed', {})\n })\n\n useEventListener('phone-island-call-keypad-close', () => {\n store.dispatch.island.setIslandView('call')\n eventDispatch('phone-island-call-keypad-closed', {})\n })\n useEventListener('phone-island-call-transfer-close', () => {\n store.dispatch.island.setIslandView('call')\n eventDispatch('phone-island-call-transfer-closed', {})\n })\n useEventListener('phone-island-recording-close', () => {\n store.dispatch.island.setIslandView(null)\n eventDispatch('phone-island-recording-closed', {})\n })\n useEventListener('phone-island-audio-player-close', () => {\n store.dispatch.island.setIslandView(null)\n eventDispatch('phone-island-audio-player-closed', {})\n })\n\n useEventListener('phone-island-detach', (data) => {\n detach()\n eventDispatch('phone-island-detached', {})\n })\n\n useEventListener('phone-island-audio-input-change', (data: DeviceInputOutputTypes) => {\n setJSONItem('phone-island-audio-input-device', { deviceId: data.deviceId })\n eventDispatch('phone-island-audio-input-changed', {})\n })\n\n useEventListener('phone-island-audio-output-change', (data: DeviceInputOutputTypes) => {\n const remoteAudioElement: any = store.getState().player.remoteAudio\n // set audio output\n remoteAudioElement?.current\n .setSinkId(data.deviceId)\n .then(function () {\n console.info('Default audio output device change with success!')\n // set device to localstorage\n setJSONItem('phone-island-audio-output-device', { deviceId: data.deviceId })\n\n // dispatch event\n eventDispatch('phone-island-audio-output-changed', {})\n })\n .catch(function (err) {\n console.error('Default audio output device change error:', err)\n })\n })\n\n // Listen for the operator status change\n useEventListener('phone-island-presence-change', (data: any) => {\n changeOperatorStatus(data)\n eventDispatch('phone-island-presence-changed', {})\n })\n\n useEventListener('phone-island-view-changed', (data) => {\n const viewType = data?.viewType\n store.dispatch.island.setIslandView(viewType)\n })\n\n const [firstRenderI18n, setFirstRenderI18n] = useState(true)\n const [firstAudioOutputInit, setFirstAudioOutputInit] = useState(true)\n\n //initialize i18n\n useEffect(() => {\n if (firstRenderI18n) {\n initI18n()\n setFirstRenderI18n(false)\n }\n }, [firstRenderI18n])\n\n const remoteAudioElement: any = store.getState().player.remoteAudio\n\n //get output device from localstorage\n useEffect(() => {\n if (firstAudioOutputInit && remoteAudioElement) {\n const defaultAudioOutputDevice: any = getJSONItem(\n `phone-island-audio-output-device`,\n )?.deviceId\n eventDispatch('phone-island-audio-output-change', { deviceId: defaultAudioOutputDevice })\n setFirstAudioOutputInit(false)\n }\n }, [firstAudioOutputInit, remoteAudioElement])\n\n useEffect(() => {\n checkDarkTheme()\n }, [])\n\n useEventListener('phone-island-theme-change', (theme: any) => {\n setTheme(theme?.selectedTheme)\n })\n\n useEventListener('phone-island-default-device-change', (data) => {\n store.dispatch.currentUser.updateCurrentDefaultDevice(data?.deviceInformationObject)\n eventDispatch('phone-island-default-device-changed', {})\n })\n\n useEventListener('phone-island-alert', (alertType: any) => {\n store.dispatch.alerts.setAlert(alertType.toString())\n })\n\n // Manually check if internet connection is enabled or not\n useEventListener('phone-island-check-connection', () => {\n checkInternetConnection().then((internetIsActive) => {\n if (internetIsActive) {\n eventDispatch('phone-island-internet-connected', {})\n } else {\n eventDispatch('phone-island-internet-disconnected', {})\n }\n })\n })\n\n // Check internet connection every 5 seconds\n useEffect(() => {\n const intervalId = setInterval(() => {\n checkInternetConnection().then((internetIsActive) => {\n if (internetIsActive) {\n eventDispatch('phone-island-internet-connected', {})\n } else {\n eventDispatch('phone-island-internet-disconnected', {})\n }\n })\n }, 5000)\n\n return () => clearInterval(intervalId)\n }, [])\n\n useEventListener('phone-island-main-presence', (data: any) => {\n const currentUsernameInformation: any = store.getState().currentUser?.username\n const currentUserObject: any = store.getState().currentUser\n let mainPresenceValueBeforeUpdate = currentUserObject?.mainPresence\n if (\n currentUsernameInformation !== undefined &&\n currentUsernameInformation !== '' &&\n !isEmpty(data[currentUsernameInformation]) &&\n data[currentUsernameInformation]?.mainPresence !== undefined\n ) {\n let newMainPresenceValue = data[currentUsernameInformation]?.mainPresence\n store.dispatch.currentUser.updateMainPresence(data[currentUsernameInformation]?.mainPresence)\n let mainPresenceValueAfterUpdate = newMainPresenceValue\n if (mainPresenceValueAfterUpdate === 'online' && mainPresenceValueBeforeUpdate !== 'online') {\n eventDispatch('phone-island-call-ended', {})\n }\n }\n })\n\n useEventListener('phone-island-call-status', () => {\n const callInformation = store.getState().currentCall\n console.log('Call status debug informations: ', callInformation)\n })\n\n useEventListener('phone-island-user-status', () => {\n const userInformation = store.getState().currentUser\n console.log('User status debug informations: ', userInformation)\n })\n\n useEventListener('phone-island-all-users-status', () => {\n const allUsersInformation = store.getState().users\n console.log('Users status debug informations: ', allUsersInformation)\n })\n\n useEventListener('phone-island-status', () => {\n const phoneIslandInformation = store.getState().island\n console.log('Phone island status debug informations: ', phoneIslandInformation)\n })\n\n useEventListener('phone-island-webrtc-status', () => {\n const webrtcInformation = store.getState().webrtc\n console.log('Webrtc status debug informations: ', webrtcInformation)\n })\n\n useEventListener('phone-island-player-status', () => {\n const playerInformation = store.getState().player\n console.log('Player status debug informations: ', playerInformation)\n })\n\n useEventListener('phone-island-player-force-stop', () => {\n store.dispatch.player.reset()\n console.log('Audio player is interrupted')\n })\n\n useEventListener('phone-island-sideview-open', () => {\n store.dispatch.island.toggleSideViewVisible(true)\n eventDispatch('phone-island-sideview-opened', {})\n })\n\n useEventListener('phone-island-sideview-close', () => {\n store.dispatch.island.toggleSideViewVisible(false)\n eventDispatch('phone-island-sideview-closed', {})\n })\n\n useEventListener('phone-island-size-change', (args: any) => {\n const { sideViewIsVisible } = store.getState().island\n\n // Get current dimensions from args\n const { sizeInformation } = args\n\n // Calculate extra row dimension ( side view and back call )\n const extraDimension = {\n right: `${sideViewIsVisible ? 42 : 0}px`,\n top: `${isBackCallActive() ? 40 : 0}px`,\n }\n\n // Create the resize information object\n const sizes = {\n ...sizeInformation,\n extraDimension,\n }\n\n eventDispatch('phone-island-size-changed', { sizes })\n })\n\n // Listen for the call end event and set the island size to 0\n useEventListener('phone-island-call-ended', () => {\n const sizeInformation: any = {\n width: '0px',\n height: '0px',\n }\n eventDispatch('phone-island-size-change', { sizeInformation })\n })\n\n return (\n <>\n <Provider store={store}>\n <WebRTC\n hostName={HOST_NAME}\n sipExten={SIP_EXTEN}\n sipSecret={SIP_SECRET}\n sipHost={SIP_HOST}\n sipPort={SIP_PORT}\n reload={reload}\n reloadedCallback={() => setReloadedWebRTC(true)}\n uaType={uaType}\n >\n <RestAPI hostName={HOST_NAME} username={USERNAME} authToken={AUTH_TOKEN}>\n <Socket\n hostName={HOST_NAME}\n username={USERNAME}\n authToken={AUTH_TOKEN}\n reload={reload}\n reloadedCallback={() => setReloadedSocket(true)}\n uaType={uaType}\n >\n <Events sipHost={SIP_HOST}>\n <Island showAlways={showAlways} />\n </Events>\n </Socket>\n </RestAPI>\n </WebRTC>\n </Provider>\n </>\n )\n}\n\nPhoneIsland.displayName = 'PhoneIsland'\n"],"names":["PhoneIsland","_a","dataConfig","_b","showAlways","uaType","CONFIG","Base64","atob","split","HOST_NAME","USERNAME","AUTH_TOKEN","SIP_EXTEN","SIP_SECRET","SIP_HOST","SIP_PORT","_c","useState","reload","setReload","_d","reloadedWebRTC","setReloadedWebRTC","_e","reloadedSocket","setReloadedSocket","useEffect","worker","Worker","wakeUpWorker","type","onmessage","event","data","terminate","useEventListener","store","dispatch","island","toggleIsOpen","eventDispatch","setIslandView","detach","setJSONItem","deviceId","remoteAudioElement","getState","player","remoteAudio","current","setSinkId","then","console","info","catch","err","error","changeOperatorStatus","viewType","_f","firstRenderI18n","setFirstRenderI18n","_g","firstAudioOutputInit","setFirstAudioOutputInit","initI18n","defaultAudioOutputDevice","getJSONItem","checkDarkTheme","theme","setTheme","selectedTheme","currentUser","updateCurrentDefaultDevice","deviceInformationObject","alertType","alerts","setAlert","toString","checkInternetConnection","internetIsActive","intervalId","setInterval","clearInterval","currentUsernameInformation","username","currentUserObject","mainPresenceValueBeforeUpdate","mainPresence","undefined","isEmpty","newMainPresenceValue","updateMainPresence","callInformation","currentCall","log","userInformation","allUsersInformation","users","phoneIslandInformation","webrtcInformation","webrtc","playerInformation","reset","toggleSideViewVisible","args","sideViewIsVisible","sizeInformation","extraDimension","right","concat","top","isBackCallActive","sizes","__assign","width","height","React","createElement","Fragment","Provider","WebRTC","hostName","sipExten","sipSecret","sipHost","sipPort","reloadedCallback","RestAPI","authToken","Socket","Events","Island","displayName"],"mappings":"+iDA2BaA,EAAoC,SAACC,OAChDC,EAAUD,EAAAC,WACVC,EAAAF,EAAAG,WAAAA,cAAkBD,EAClBE,EAAMJ,EAAAI,OAEAC,EAAmBC,EAAMA,OAACC,KAAKN,GAAc,IAAIO,MAAM,KACvDC,EAAoBJ,EAAO,GAC3BK,EAAmBL,EAAO,GAC1BM,EAAqBN,EAAO,GAC5BO,EAAoBP,EAAO,GAC3BQ,EAAqBR,EAAO,GAC5BS,EAAmBT,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AO,GAAGC,OAAAJ,EAAoB,GAAK,EAAK,MACxCK,IAAK,GAAAD,OAAGE,EAAAA,mBAAqB,GAAK,EAAK,OAInCC,EACDC,WAAAA,EAAAA,SAAA,CAAA,EAAAP,IACHC,eAAcA,IAGhBpE,EAAAA,cAAc,4BAA6B,CAAEyE,MAAKA,GACpD,IAGA9E,EAAgBA,iBAAC,2BAA2B,WAK1CK,EAAAA,cAAc,2BAA4B,CAAEmE,gBAJf,CAC3BQ,MAAO,MACPC,OAAQ,QAGZ,IAGEC,UAAAC,cAAAD,EAAA,QAAAE,SAAA,KACEF,EAAAA,QAAAC,cAACE,EAAAA,QAAQ,CAACpF,MAAOA,EAAAA,OACfiF,EAAAA,QAAAC,cAACG,SACC,CAAAC,SAAUjH,EACVkH,SAAU/G,EACVgH,UAAW/G,EACXgH,QAAS/G,EACTgH,QAAS/G,EACTG,OAAQA,EACR6G,iBAAkB,WAAM,OAAAzG,GAAkB,IAC1ClB,OAAQA,GAERiH,UAAAC,cAACU,EAAOA,QAAA,CAACN,SAAUjH,EAAW4E,SAAU3E,EAAUuH,UAAWtH,GAC3D0G,UAAAC,cAACY,EAAAA,OAAM,CACLR,SAAUjH,EACV4E,SAAU3E,EACVuH,UAAWtH,EACXO,OAAQA,EACR6G,iBAAkB,WAAM,OAAAtG,GAAkB,EAAlB,EACxBrB,OAAQA,GAERiH,EAAAA,QAAAC,cAACa,EAAAA,OAAM,CAACN,QAAS/G,GACfuG,UAAAC,cAACc,EAAMA,OAAA,CAACjI,WAAYA,SAQpC,EAEAJ,EAAYsI,YAAc"}
1
+ {"version":3,"file":"App.js","sources":["../src/App.tsx"],"sourcesContent":["import React, { type FC, useState, useEffect } from 'react'\nimport { Events, Socket, WebRTC, Island, RestAPI } from './components'\nimport { Provider } from 'react-redux'\nimport { store } from './store'\nimport { Base64 } from 'js-base64'\nimport wakeUpWorker from './workers/wake_up'\nimport { initI18n } from './lib/i18n'\n\nimport 'react-tooltip/dist/react-tooltip.css'\nimport { useEventListener, eventDispatch, setJSONItem, getJSONItem } from './utils'\nimport { detach } from './lib/webrtc/messages'\nimport { checkDarkTheme, setTheme } from './lib/darkTheme'\nimport { changeOperatorStatus } from './services/user'\nimport { isEmpty } from './utils/genericFunctions/isEmpty'\nimport { checkInternetConnection } from './utils/genericFunctions/checkConnection'\nimport { isBackCallActive } from './utils/genericFunctions/isBackCallVisible'\n\ninterface PhoneIslandProps {\n dataConfig: string\n showAlways?: boolean\n uaType: string\n}\n\ninterface DeviceInputOutputTypes {\n deviceId: string\n}\n\nexport const PhoneIsland: FC<PhoneIslandProps> = ({\n dataConfig,\n showAlways = false,\n uaType,\n}: PhoneIslandProps) => {\n const CONFIG: string[] = Base64.atob(dataConfig || '').split(':')\n const HOST_NAME: string = CONFIG[0]\n const USERNAME: string = CONFIG[1]\n const AUTH_TOKEN: string = CONFIG[2]\n const SIP_EXTEN: string = CONFIG[3]\n const SIP_SECRET: string = CONFIG[4]\n const SIP_HOST: string = CONFIG[5]\n const SIP_PORT: string = CONFIG[6]\n\n // Initialize the state to manage the reload events\n const [reload, setReload] = useState<boolean>(false)\n const [reloadedWebRTC, setReloadedWebRTC] = useState<boolean>(false)\n const [reloadedSocket, setReloadedSocket] = useState<boolean>(false)\n\n useEffect(() => {\n const worker = new Worker(wakeUpWorker, { type: 'module' })\n worker.onmessage = (event: MessageEvent<string>) => {\n // Handle wakeup message\n if (event.data === 'wakeup') {\n setReload(true)\n }\n }\n\n return () => {\n worker.terminate()\n }\n }, [])\n\n useEffect(() => {\n if (reloadedSocket && reloadedWebRTC) {\n setReload(false)\n setReloadedWebRTC(false)\n setReloadedSocket(false)\n }\n }, [reloadedSocket, reloadedWebRTC])\n\n useEventListener('phone-island-expand', () => {\n store.dispatch.island.toggleIsOpen(true)\n eventDispatch('phone-island-expanded', {})\n })\n useEventListener('phone-island-compress', () => {\n store.dispatch.island.toggleIsOpen(false)\n eventDispatch('phone-island-compressed', {})\n })\n\n useEventListener('phone-island-call-keypad-close', () => {\n store.dispatch.island.setIslandView('call')\n eventDispatch('phone-island-call-keypad-closed', {})\n })\n useEventListener('phone-island-call-transfer-close', () => {\n store.dispatch.island.setIslandView('call')\n eventDispatch('phone-island-call-transfer-closed', {})\n })\n useEventListener('phone-island-recording-close', () => {\n store.dispatch.island.setIslandView(null)\n eventDispatch('phone-island-recording-closed', {})\n })\n useEventListener('phone-island-audio-player-close', () => {\n store.dispatch.island.setIslandView(null)\n eventDispatch('phone-island-audio-player-closed', {})\n })\n\n useEventListener('phone-island-detach', (data) => {\n detach()\n eventDispatch('phone-island-detached', {})\n })\n\n useEventListener('phone-island-audio-input-change', (data: DeviceInputOutputTypes) => {\n setJSONItem('phone-island-audio-input-device', { deviceId: data.deviceId })\n eventDispatch('phone-island-audio-input-changed', {})\n })\n\n useEventListener('phone-island-audio-output-change', (data: DeviceInputOutputTypes) => {\n const remoteAudioElement: any = store.getState().player.remoteAudio\n // set audio output\n remoteAudioElement?.current\n .setSinkId(data.deviceId)\n .then(function () {\n console.info('Default audio output device change with success!')\n // set device to localstorage\n setJSONItem('phone-island-audio-output-device', { deviceId: data.deviceId })\n\n // dispatch event\n eventDispatch('phone-island-audio-output-changed', {})\n })\n .catch(function (err) {\n console.error('Default audio output device change error:', err)\n })\n })\n\n // Listen for the operator status change\n useEventListener('phone-island-presence-change', (data: any) => {\n changeOperatorStatus(data)\n eventDispatch('phone-island-presence-changed', {})\n })\n\n useEventListener('phone-island-view-changed', (data) => {\n const viewType = data?.viewType\n store.dispatch.island.setIslandView(viewType)\n })\n\n const [firstRenderI18n, setFirstRenderI18n] = useState(true)\n const [firstAudioOutputInit, setFirstAudioOutputInit] = useState(true)\n\n //initialize i18n\n useEffect(() => {\n if (firstRenderI18n) {\n initI18n()\n setFirstRenderI18n(false)\n }\n }, [firstRenderI18n])\n\n const remoteAudioElement: any = store.getState().player.remoteAudio\n\n //get output device from localstorage\n useEffect(() => {\n if (firstAudioOutputInit && remoteAudioElement) {\n const defaultAudioOutputDevice: any = getJSONItem(\n `phone-island-audio-output-device`,\n )?.deviceId\n eventDispatch('phone-island-audio-output-change', { deviceId: defaultAudioOutputDevice })\n setFirstAudioOutputInit(false)\n }\n }, [firstAudioOutputInit, remoteAudioElement])\n\n useEffect(() => {\n checkDarkTheme()\n }, [])\n\n useEventListener('phone-island-theme-change', (theme: any) => {\n setTheme(theme?.selectedTheme)\n })\n\n useEventListener('phone-island-default-device-change', (data) => {\n store.dispatch.currentUser.updateCurrentDefaultDevice(data?.deviceInformationObject)\n eventDispatch('phone-island-default-device-changed', {})\n })\n\n useEventListener('phone-island-alert', (alertType: any) => {\n store.dispatch.alerts.setAlert(alertType.toString())\n })\n\n // Manually check if internet connection is enabled or not\n useEventListener('phone-island-check-connection', () => {\n checkInternetConnection().then((internetIsActive) => {\n if (internetIsActive) {\n eventDispatch('phone-island-internet-connected', {})\n } else {\n eventDispatch('phone-island-internet-disconnected', {})\n }\n })\n })\n\n // Check internet connection every 5 seconds\n useEffect(() => {\n const intervalId = setInterval(() => {\n checkInternetConnection().then((internetIsActive) => {\n if (internetIsActive) {\n eventDispatch('phone-island-internet-connected', {})\n } else {\n eventDispatch('phone-island-internet-disconnected', {})\n }\n })\n }, 5000)\n\n return () => clearInterval(intervalId)\n }, [])\n\n useEventListener('phone-island-main-presence', (data: any) => {\n const currentUsernameInformation: any = store.getState().currentUser?.username\n const currentUserObject: any = store.getState().currentUser\n let mainPresenceValueBeforeUpdate = currentUserObject?.mainPresence\n if (\n currentUsernameInformation !== undefined &&\n currentUsernameInformation !== '' &&\n !isEmpty(data[currentUsernameInformation]) &&\n data[currentUsernameInformation]?.mainPresence !== undefined\n ) {\n let newMainPresenceValue = data[currentUsernameInformation]?.mainPresence\n store.dispatch.currentUser.updateMainPresence(data[currentUsernameInformation]?.mainPresence)\n let mainPresenceValueAfterUpdate = newMainPresenceValue\n if (mainPresenceValueAfterUpdate === 'online' && mainPresenceValueBeforeUpdate !== 'online') {\n eventDispatch('phone-island-call-ended', {})\n }\n }\n })\n\n useEventListener('phone-island-call-status', () => {\n const callInformation = store.getState().currentCall\n console.log('Call status debug informations: ', callInformation)\n })\n\n useEventListener('phone-island-user-status', () => {\n const userInformation = store.getState().currentUser\n console.log('User status debug informations: ', userInformation)\n })\n\n useEventListener('phone-island-all-users-status', () => {\n const allUsersInformation = store.getState().users\n console.log('Users status debug informations: ', allUsersInformation)\n })\n\n useEventListener('phone-island-status', () => {\n const phoneIslandInformation = store.getState().island\n console.log('Phone island status debug informations: ', phoneIslandInformation)\n })\n\n useEventListener('phone-island-webrtc-status', () => {\n const webrtcInformation = store.getState().webrtc\n console.log('Webrtc status debug informations: ', webrtcInformation)\n })\n\n useEventListener('phone-island-player-status', () => {\n const playerInformation = store.getState().player\n console.log('Player status debug informations: ', playerInformation)\n })\n\n useEventListener('phone-island-player-force-stop', () => {\n store.dispatch.player.reset()\n console.log('Audio player is interrupted')\n })\n\n useEventListener('phone-island-sideview-open', () => {\n store.dispatch.island.toggleSideViewVisible(true)\n eventDispatch('phone-island-sideview-opened', {})\n })\n\n useEventListener('phone-island-sideview-close', () => {\n store.dispatch.island.toggleSideViewVisible(false)\n eventDispatch('phone-island-sideview-closed', {})\n })\n\n useEventListener('phone-island-size-change', (args: any) => {\n const { sideViewIsVisible } = store.getState().island\n\n // Get current dimensions from args\n const { sizeInformation } = args\n\n // // Calculate extra row dimension ( side view and back call )\n const updatedSizeInformation = {\n ...sizeInformation,\n right: sideViewIsVisible ? '42px' : '0px',\n top: isBackCallActive() ? '40px' : '0px',\n }\n eventDispatch('phone-island-size-changed', { sizes: updatedSizeInformation })\n })\n\n // Listen for the call end event and set the island size to 0\n useEventListener('phone-island-call-ended', () => {\n const sizeInformation: any = {\n width: '0px',\n height: '0px',\n }\n eventDispatch('phone-island-size-change', { sizeInformation })\n })\n\n return (\n <>\n <Provider store={store}>\n <WebRTC\n hostName={HOST_NAME}\n sipExten={SIP_EXTEN}\n sipSecret={SIP_SECRET}\n sipHost={SIP_HOST}\n sipPort={SIP_PORT}\n reload={reload}\n reloadedCallback={() => setReloadedWebRTC(true)}\n uaType={uaType}\n >\n <RestAPI hostName={HOST_NAME} username={USERNAME} authToken={AUTH_TOKEN}>\n <Socket\n hostName={HOST_NAME}\n username={USERNAME}\n authToken={AUTH_TOKEN}\n reload={reload}\n reloadedCallback={() => setReloadedSocket(true)}\n uaType={uaType}\n >\n <Events sipHost={SIP_HOST}>\n <Island showAlways={showAlways} />\n </Events>\n </Socket>\n </RestAPI>\n </WebRTC>\n </Provider>\n </>\n )\n}\n\nPhoneIsland.displayName = 'PhoneIsland'\n"],"names":["PhoneIsland","_a","dataConfig","_b","showAlways","uaType","CONFIG","Base64","atob","split","HOST_NAME","USERNAME","AUTH_TOKEN","SIP_EXTEN","SIP_SECRET","SIP_HOST","SIP_PORT","_c","useState","reload","setReload","_d","reloadedWebRTC","setReloadedWebRTC","_e","reloadedSocket","setReloadedSocket","useEffect","worker","Worker","wakeUpWorker","type","onmessage","event","data","terminate","useEventListener","store","dispatch","island","toggleIsOpen","eventDispatch","setIslandView","detach","setJSONItem","deviceId","remoteAudioElement","getState","player","remoteAudio","current","setSinkId","then","console","info","catch","err","error","changeOperatorStatus","viewType","_f","firstRenderI18n","setFirstRenderI18n","_g","firstAudioOutputInit","setFirstAudioOutputInit","initI18n","defaultAudioOutputDevice","getJSONItem","checkDarkTheme","theme","setTheme","selectedTheme","currentUser","updateCurrentDefaultDevice","deviceInformationObject","alertType","alerts","setAlert","toString","checkInternetConnection","internetIsActive","intervalId","setInterval","clearInterval","currentUsernameInformation","username","currentUserObject","mainPresenceValueBeforeUpdate","mainPresence","undefined","isEmpty","newMainPresenceValue","updateMainPresence","callInformation","currentCall","log","userInformation","allUsersInformation","users","phoneIslandInformation","webrtcInformation","webrtc","playerInformation","reset","toggleSideViewVisible","args","sideViewIsVisible","sizeInformation","updatedSizeInformation","__assign","right","top","isBackCallActive","sizes","width","height","React","createElement","Fragment","Provider","WebRTC","hostName","sipExten","sipSecret","sipHost","sipPort","reloadedC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AJ,EAAYqI,YAAc"}
@@ -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("../Button.js"),i=require("../../node_modules/@fortawesome/react-fontawesome/index.es.js"),o=require("../../node_modules/@fortawesome/free-solid-svg-icons/index.mjs.js"),r=require("../../node_modules/@nethesis/nethesis-solid-svg-icons/index.mjs.js");require("../../node_modules/@babel/runtime/helpers/defineProperty.js"),require("../../node_modules/@babel/runtime/helpers/objectWithoutProperties.js"),require("../../node_modules/@babel/runtime/helpers/typeof.js"),require("../../node_modules/html-parse-stringify/dist/html-parse-stringify.js"),require("../../node_modules/react-i18next/dist/es/context.js");var s=require("../../node_modules/react-i18next/dist/es/useTranslation.js");require("../../node_modules/@babel/runtime/helpers/slicedToArray.js");var n=require("../../lib/phone/call.js"),l=require("../CustomThemedTooltip.js"),a=require("../../utils/deviceUtils.js"),d=require("../../node_modules/framer-motion/dist/es/components/AnimatePresence/index.mjs.js"),u=require("../../node_modules/framer-motion/dist/es/render/dom/motion.mjs.js"),c=require("../../node_modules/react-redux/es/hooks/useDispatch.js"),p=require("../../node_modules/react-redux/es/hooks/useSelector.js");function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=m(e);exports.default=function(e){var m=e.isVisible,h=c.useDispatch(),x=p.useSelector((function(e){return e.island})).isOpen,j=p.useSelector((function(e){return e.currentCall})).isRecording,v=p.useSelector((function(e){return e.currentUser})),w=p.useSelector((function(e){return e.users})),g=s.useTranslation().t,q=a.getAvailableDevices(v,w);return f.default.createElement(f.default.Fragment,null,f.default.createElement(d.AnimatePresence,null,m&&f.default.createElement(u.motion.div,{className:"pi-absolute pi-h-full pi-bg-gray-700 pi-flex pi-flex-col pi-items-center pi-text-gray-50 dark:pi-text-gray-50 -pi-mr-10 pi-right-0 -pi-z-10 pi-pointer-events-auto ".concat(x?"pi-py-6":"pi-py-4"),style:{borderTopRightRadius:"20px",borderBottomRightRadius:"20px",width:"80px"},initial:{x:0},animate:{x:4},exit:{x:0,transitionEnd:{display:"none"}},transition:{duration:0}},f.default.createElement("div",{className:"pi-flex pi-flex-col pi-items-center pi-gap-3.5 pi-flex-1 pi-ml-9"},f.default.createElement(t.Button,{active:j,"data-stop-propagation":!0,variant:"transparentSideView",onClick:function(){return n.recordCurrentCall(j)},"data-tooltip-id":"tooltip-record","data-tooltip-content":j?g("Tooltip.Stop recording")||"":g("Tooltip.Record")||""},j?f.default.createElement(i.FontAwesomeIcon,{icon:o.faStop,className:"pi-h-5 pi-w-5"}):f.default.createElement(i.FontAwesomeIcon,{className:"pi-h-5 pi-w-5 pi-text-white",icon:r.faRecord})),(null==q?void 0:q.length)>0&&f.default.createElement(t.Button,{variant:"transparentSideView","data-tooltip-id":"tooltip-switch-device","data-tooltip-content":g("Tooltip.Switch device")||"",onClick:function(){return e="switchDevice",h.island.toggleSideViewVisible(!1),void(null!==e&&h.island.setIslandView(e));var e}},f.default.createElement(i.FontAwesomeIcon,{className:"pi-h-5 pi-w-5 pi-text-white",icon:r.faArrowsRepeat}))))),f.default.createElement(l.CustomThemedTooltip,{id:"tooltip-record",place:"left"}),f.default.createElement(l.CustomThemedTooltip,{id:"tooltip-video",place:"left"}),f.default.createElement(l.CustomThemedTooltip,{id:"tooltip-switch-device",place:"left"}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");require("../../node_modules/react-redux/es/index.js");var t=require("../Button.js"),i=require("../../node_modules/@fortawesome/react-fontawesome/index.es.js"),r=require("../../node_modules/@fortawesome/free-solid-svg-icons/index.mjs.js"),o=require("../../node_modules/@nethesis/nethesis-solid-svg-icons/index.mjs.js");require("../../node_modules/@babel/runtime/helpers/defineProperty.js"),require("../../node_modules/@babel/runtime/helpers/objectWithoutProperties.js"),require("../../node_modules/@babel/runtime/helpers/typeof.js"),require("../../node_modules/html-parse-stringify/dist/html-parse-stringify.js"),require("../../node_modules/react-i18next/dist/es/context.js");var s=require("../../node_modules/react-i18next/dist/es/useTranslation.js");require("../../node_modules/@babel/runtime/helpers/slicedToArray.js");var n=require("../../lib/phone/call.js"),l=require("../CustomThemedTooltip.js"),a=require("../../utils/deviceUtils.js"),d=require("../../node_modules/framer-motion/dist/es/components/AnimatePresence/index.mjs.js"),u=require("../../node_modules/framer-motion/dist/es/render/dom/motion.mjs.js"),c=require("../../node_modules/react-redux/es/hooks/useDispatch.js"),p=require("../../node_modules/react-redux/es/hooks/useSelector.js");function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=m(e);exports.default=function(e){var m=e.isVisible,h=c.useDispatch(),x=p.useSelector((function(e){return e.island})).isOpen,j=p.useSelector((function(e){return e.currentCall})).isRecording,v=p.useSelector((function(e){return e.currentUser})),g=p.useSelector((function(e){return e.users})),w=s.useTranslation().t,q=a.getAvailableDevices(v,g);return f.default.createElement(f.default.Fragment,null,f.default.createElement(d.AnimatePresence,null,m&&f.default.createElement(u.motion.div,{className:"pi-absolute pi-h-full pi-bg-gray-700 pi-flex pi-flex-col pi-items-center pi-text-gray-50 dark:pi-text-gray-50 -pi-mr-10 pi-right-0 -pi-z-10 pi-pointer-events-auto ".concat(x?"pi-py-6":"pi-py-4"),style:{borderTopRightRadius:"20px",borderBottomRightRadius:"20px",width:"80px",transformOrigin:"right"},initial:{x:-76},animate:{x:4,transition:{duration:.2,ease:"easeOut"}},exit:{x:-76,transition:{duration:.2,ease:"easeIn"}}},f.default.createElement("div",{className:"pi-flex pi-flex-col pi-items-center pi-gap-3.5 pi-flex-1 pi-ml-9"},f.default.createElement(t.Button,{active:j,"data-stop-propagation":!0,variant:"transparentSideView",onClick:function(){return n.recordCurrentCall(j)},"data-tooltip-id":"tooltip-record","data-tooltip-content":j?w("Tooltip.Stop recording")||"":w("Tooltip.Record")||""},j?f.default.createElement(i.FontAwesomeIcon,{icon:r.faStop,className:"pi-h-5 pi-w-5"}):f.default.createElement(i.FontAwesomeIcon,{className:"pi-h-5 pi-w-5 pi-text-white",icon:o.faRecord})),(null==q?void 0:q.length)>0&&f.default.createElement(t.Button,{variant:"transparentSideView","data-tooltip-id":"tooltip-switch-device","data-tooltip-content":w("Tooltip.Switch device")||"",onClick:function(){return e="switchDevice",h.island.toggleSideViewVisible(!1),void(null!==e&&h.island.setIslandView(e));var e}},f.default.createElement(i.FontAwesomeIcon,{className:"pi-h-5 pi-w-5 pi-text-white",icon:o.faArrowsRepeat}))))),f.default.createElement(l.CustomThemedTooltip,{id:"tooltip-record",place:"left"}),f.default.createElement(l.CustomThemedTooltip,{id:"tooltip-video",place:"left"}),f.default.createElement(l.CustomThemedTooltip,{id:"tooltip-switch-device",place:"left"}))};
2
2
  //# sourceMappingURL=SideView.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SideView.js","sources":["../../../src/components/SideView/SideView.tsx"],"sourcesContent":["import React, { FC } from 'react'\nimport { useDispatch, useSelector } from 'react-redux'\nimport { Dispatch, RootState } from '../../store'\nimport { motion, AnimatePresence } from 'framer-motion'\nimport { Button } from '../Button'\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\nimport {\n faArrowUpRightFromSquare,\n faDisplay,\n faStop,\n faVideo,\n} from '@fortawesome/free-solid-svg-icons'\nimport { faArrowsRepeat, faRecord } from '@nethesis/nethesis-solid-svg-icons'\nimport { useTranslation } from 'react-i18next'\nimport { recordCurrentCall } from '../../lib/phone/call'\nimport { CustomThemedTooltip } from '../CustomThemedTooltip'\nimport { getAvailableDevices } from '../../utils/deviceUtils'\n\nconst SideView: FC<SideViewTypes> = ({ isVisible }) => {\n const dispatch = useDispatch<Dispatch>()\n const { isOpen } = useSelector((state: RootState) => state.island)\n const { isRecording } = useSelector((state: RootState) => state.currentCall)\n const userInformation = useSelector((state: RootState) => state.currentUser)\n const allUsersInformation = useSelector((state: RootState) => state.users)\n const { t } = useTranslation()\n\n const availableDevices = getAvailableDevices(userInformation, allUsersInformation)\n\n const closeSideViewAndLaunchEvent = (viewType: any) => {\n dispatch.island.toggleSideViewVisible(false)\n if (viewType !== null) {\n dispatch.island.setIslandView(viewType)\n }\n }\n\n return (\n <>\n <AnimatePresence>\n {isVisible && (\n <motion.div\n className={`pi-absolute pi-h-full pi-bg-gray-700 pi-flex pi-flex-col pi-items-center pi-text-gray-50 dark:pi-text-gray-50 -pi-mr-10 pi-right-0 -pi-z-10 pi-pointer-events-auto ${\n isOpen ? 'pi-py-6' : 'pi-py-4'\n }`}\n style={{\n borderTopRightRadius: '20px',\n borderBottomRightRadius: '20px',\n width: '80px',\n }}\n initial={{ x: 0 }}\n animate={{ x: 4 }}\n exit={{\n x: 0,\n transitionEnd: {\n display: 'none',\n },\n }}\n transition={{ duration: 0 }}\n >\n <div className='pi-flex pi-flex-col pi-items-center pi-gap-3.5 pi-flex-1 pi-ml-9'>\n {/* Recording button */}\n <Button\n active={isRecording}\n data-stop-propagation={true}\n variant='transparentSideView'\n onClick={() => recordCurrentCall(isRecording)}\n data-tooltip-id='tooltip-record'\n data-tooltip-content={\n isRecording ? t('Tooltip.Stop recording') || '' : t('Tooltip.Record') || ''\n }\n >\n {isRecording ? (\n <FontAwesomeIcon icon={faStop} className='pi-h-5 pi-w-5' />\n ) : (\n <FontAwesomeIcon className='pi-h-5 pi-w-5 pi-text-white' icon={faRecord} />\n )}\n </Button>\n {/* Hidden at the moment waiting for implementation */}\n {/* Video button */}\n {/* <Button\n variant='transparentSideView'\n onClick={() => closeSideViewAndLaunchEvent('video')}\n data-tooltip-id='tooltip-video'\n data-tooltip-content={t('Tooltip.Enable camera') || ''}\n >\n <FontAwesomeIcon className='pi-h-5 pi-w-5 pi-text-white' icon={faVideo} />\n </Button> */}\n {/* Switch device button - show only if there are available devices */}\n {availableDevices?.length > 0 && (\n <Button\n variant='transparentSideView'\n data-tooltip-id='tooltip-switch-device'\n data-tooltip-content={t('Tooltip.Switch device') || ''}\n onClick={() => closeSideViewAndLaunchEvent('switchDevice')}\n >\n <FontAwesomeIcon className='pi-h-5 pi-w-5 pi-text-white' icon={faArrowsRepeat} />\n </Button>\n )}\n {/* Hidden at the moment waiting for implementation */}\n {/* Share button */}\n {/* <Button variant='transparentSideView' disabled>\n <FontAwesomeIcon\n className='pi-h-5 pi-w-5 pi-text-white'\n icon={faArrowUpRightFromSquare}\n />\n </Button>\n <Button variant='transparentSideView' disabled>\n <FontAwesomeIcon className='pi-h-5 pi-w-5 pi-text-white' icon={faDisplay} />\n </Button> */}\n </div>\n </motion.div>\n )}\n </AnimatePresence>\n <CustomThemedTooltip id='tooltip-record' place='left' />\n <CustomThemedTooltip id='tooltip-video' place='left' />\n <CustomThemedTooltip id='tooltip-switch-device' place='left' />\n </>\n )\n}\n\nexport default SideView\n\ninterface SideViewTypes {\n isVisible: boolean\n}\n"],"names":["_a","isVisible","dispatch","useDispatch","isOpen","useSelector","state","island","isRecording","currentCall","userInformation","currentUser","allUsersInformation","users","t","useTranslation","availableDevices","getAvailableDevices","React","createElement","Fragment","AnimatePresence","motion","div","className","style","borderTopRightRadius","borderBottomRightRadius","width","initial","x","animate","exit","transitionEnd","display","transition","duration","Button","active","variant","onClick","recordCurrentCall","FontAwesomeIcon","icon","faStop","faRecord","length","viewType","toggleSideViewVisible","setIslandView","faArrowsRepeat","CustomThemedTooltip","id","place"],"mappings":"g6CAkBoC,SAACA,GAAE,IAAAC,EAASD,EAAAC,UACxCC,EAAWC,EAAAA,cACTC,EAAWC,eAAY,SAACC,GAAqB,OAAAA,EAAMC,iBACnDC,EAAgBH,eAAY,SAACC,GAAqB,OAAAA,EAAMG,2BAC1DC,EAAkBL,EAAWA,aAAC,SAACC,GAAqB,OAAAA,EAAMK,WAAN,IACpDC,EAAsBP,EAAWA,aAAC,SAACC,GAAqB,OAAAA,EAAMO,KAAN,IACtDC,EAAMC,qBAERC,EAAmBC,EAAAA,oBAAoBP,EAAiBE,GAS9D,OACEM,UAAAC,cAAAD,EAAA,QAAAE,SAAA,KACEF,EAAC,QAAAC,cAAAE,kBACE,KAAApB,GACCiB,EAAAA,sBAACI,EAAMA,OAACC,IAAG,CACTC,UAAW,6KACTpB,EAAS,UAAY,WAEvBqB,MAAO,CACLC,qBAAsB,OACtBC,wBAAyB,OACzBC,MAAO,QAETC,QAAS,CAAEC,EAAG,GACdC,QAAS,CAAED,EAAG,GACdE,KAAM,CACJF,EAAG,EACHG,cAAe,CACbC,QAAS,SAGbC,WAAY,CAAEC,SAAU,IAExBlB,EAAAA,QAAKC,cAAA,MAAA,CAAAK,UAAU,oEAEbN,UAAAC,cAACkB,EAAMA,OACL,CAAAC,OAAQ9B,2BACe,EACvB+B,QAAQ,sBACRC,QAAS,WAAM,OAAAC,oBAAkBjC,IAAY,kBAC7B,iBAAgB,uBAE9BA,EAAcM,EAAE,2BAA6B,GAAKA,EAAE,mBAAqB,IAG1EN,EACCU,UAAAC,cAACuB,EAAeA,gBAAC,CAAAC,KAAMC,SAAQpB,UAAU,kBAEzCN,EAAAA,sBAACwB,kBAAe,CAAClB,UAAU,8BAA8BmB,KAAME,eAclE7B,aAAA,EAAAA,EAAkB8B,QAAS,GAC1B5B,EAAC,QAAAC,cAAAkB,EAAMA,OACL,CAAAE,QAAQ,sBAAqB,kBACb,wBAAuB,uBACjBzB,EAAE,0BAA4B,GACpD0B,QAAS,WAAM,OAhEMO,EAgEsB,eA/DzD7C,EAASK,OAAOyC,uBAAsB,QACrB,OAAbD,GACF7C,EAASK,OAAO0C,cAAcF,IAHE,IAACA,IAkErB7B,EAAAA,QAAAC,cAACuB,kBAAe,CAAClB,UAAU,8BAA8BmB,KAAMO,uBAkB3EhC,EAAC,QAAAC,cAAAgC,uBAAoBC,GAAG,iBAAiBC,MAAM,SAC/CnC,EAAC,QAAAC,cAAAgC,uBAAoBC,GAAG,gBAAgBC,MAAM,SAC9CnC,UAAAC,cAACgC,EAAAA,oBAAmB,CAACC,GAAG,wBAAwBC,MAAM,SAG5D"}
1
+ {"version":3,"file":"SideView.js","sources":["../../../src/components/SideView/SideView.tsx"],"sourcesContent":["import React, { FC } from 'react'\nimport { useDispatch, useSelector } from 'react-redux'\nimport { Dispatch, RootState } from '../../store'\nimport { motion, AnimatePresence } from 'framer-motion'\nimport { Button } from '../Button'\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\nimport {\n faArrowUpRightFromSquare,\n faDisplay,\n faStop,\n faVideo,\n} from '@fortawesome/free-solid-svg-icons'\nimport { faArrowsRepeat, faRecord } from '@nethesis/nethesis-solid-svg-icons'\nimport { useTranslation } from 'react-i18next'\nimport { recordCurrentCall } from '../../lib/phone/call'\nimport { CustomThemedTooltip } from '../CustomThemedTooltip'\nimport { getAvailableDevices } from '../../utils/deviceUtils'\n\nconst SideView: FC<SideViewTypes> = ({ isVisible }) => {\n const dispatch = useDispatch<Dispatch>()\n const { isOpen } = useSelector((state: RootState) => state.island)\n const { isRecording } = useSelector((state: RootState) => state.currentCall)\n const userInformation = useSelector((state: RootState) => state.currentUser)\n const allUsersInformation = useSelector((state: RootState) => state.users)\n const { t } = useTranslation()\n\n const availableDevices = getAvailableDevices(userInformation, allUsersInformation)\n\n const closeSideViewAndLaunchEvent = (viewType: any) => {\n dispatch.island.toggleSideViewVisible(false)\n if (viewType !== null) {\n dispatch.island.setIslandView(viewType)\n }\n }\n\n return (\n <>\n <AnimatePresence>\n {isVisible && (\n <motion.div\n className={`pi-absolute pi-h-full pi-bg-gray-700 pi-flex pi-flex-col pi-items-center pi-text-gray-50 dark:pi-text-gray-50 -pi-mr-10 pi-right-0 -pi-z-10 pi-pointer-events-auto ${\n isOpen ? 'pi-py-6' : 'pi-py-4'\n }`}\n style={{\n borderTopRightRadius: '20px',\n borderBottomRightRadius: '20px',\n width: '80px',\n transformOrigin: 'right',\n }}\n initial={{ x: -76 }}\n animate={{ \n x: 4,\n transition: {\n duration: 0.2,\n ease: \"easeOut\"\n }\n }}\n exit={{\n x: -76,\n transition: {\n duration: 0.2,\n ease: \"easeIn\"\n }\n }}\n >\n <div className='pi-flex pi-flex-col pi-items-center pi-gap-3.5 pi-flex-1 pi-ml-9'>\n {/* Recording button */}\n <Button\n active={isRecording}\n data-stop-propagation={true}\n variant='transparentSideView'\n onClick={() => recordCurrentCall(isRecording)}\n data-tooltip-id='tooltip-record'\n data-tooltip-content={\n isRecording ? t('Tooltip.Stop recording') || '' : t('Tooltip.Record') || ''\n }\n >\n {isRecording ? (\n <FontAwesomeIcon icon={faStop} className='pi-h-5 pi-w-5' />\n ) : (\n <FontAwesomeIcon className='pi-h-5 pi-w-5 pi-text-white' icon={faRecord} />\n )}\n </Button>\n {/* Hidden at the moment waiting for implementation */}\n {/* Video button */}\n {/* <Button\n variant='transparentSideView'\n onClick={() => closeSideViewAndLaunchEvent('video')}\n data-tooltip-id='tooltip-video'\n data-tooltip-content={t('Tooltip.Enable camera') || ''}\n >\n <FontAwesomeIcon className='pi-h-5 pi-w-5 pi-text-white' icon={faVideo} />\n </Button> */}\n {/* Switch device button - show only if there are available devices */}\n {availableDevices?.length > 0 && (\n <Button\n variant='transparentSideView'\n data-tooltip-id='tooltip-switch-device'\n data-tooltip-content={t('Tooltip.Switch device') || ''}\n onClick={() => closeSideViewAndLaunchEvent('switchDevice')}\n >\n <FontAwesomeIcon className='pi-h-5 pi-w-5 pi-text-white' icon={faArrowsRepeat} />\n </Button>\n )}\n {/* Hidden at the moment waiting for implementation */}\n {/* Share button */}\n {/* <Button variant='transparentSideView' disabled>\n <FontAwesomeIcon\n className='pi-h-5 pi-w-5 pi-text-white'\n icon={faArrowUpRightFromSquare}\n />\n </Button>\n <Button variant='transparentSideView' disabled>\n <FontAwesomeIcon className='pi-h-5 pi-w-5 pi-text-white' icon={faDisplay} />\n </Button> */}\n </div>\n </motion.div>\n )}\n </AnimatePresence>\n <CustomThemedTooltip id='tooltip-record' place='left' />\n <CustomThemedTooltip id='tooltip-video' place='left' />\n <CustomThemedTooltip id='tooltip-switch-device' place='left' />\n </>\n )\n}\n\nexport default SideView\n\ninterface SideViewTypes {\n isVisible: boolean\n}\n"],"names":["_a","isVisible","dispatch","useDispatch","isOpen","useSelector","state","island","isRecording","currentCall","userInformation","currentUser","allUsersInformation","users","t","useTranslation","availableDevices","getAvailableDevices","React","createElement","Fragment","AnimatePresence","motion","div","className","style","borderTopRightRadius","borderBottomRightRadius","width","transformOrigin","initial","x","animate","transition","duration","ease","exit","Button","active","variant","onClick","recordCurrentCall","FontAwesomeIcon","icon","faStop","faRecord","length","viewType","toggleSideViewVisible","setIslandView","faArrowsRepeat","CustomThemedTooltip","id","place"],"mappings":"g6CAkBoC,SAACA,GAAE,IAAAC,EAASD,EAAAC,UACxCC,EAAWC,EAAAA,cACTC,EAAWC,eAAY,SAACC,GAAqB,OAAAA,EAAMC,iBACnDC,EAAgBH,eAAY,SAACC,GAAqB,OAAAA,EAAMG,2BAC1DC,EAAkBL,EAAWA,aAAC,SAACC,GAAqB,OAAAA,EAAMK,WAAN,IACpDC,EAAsBP,EAAWA,aAAC,SAACC,GAAqB,OAAAA,EAAMO,KAAN,IACtDC,EAAMC,qBAERC,EAAmBC,EAAAA,oBAAoBP,EAAiBE,GAS9D,OACEM,UAAAC,cAAAD,EAAA,QAAAE,SAAA,KACEF,EAAC,QAAAC,cAAAE,kBACE,KAAApB,GACCiB,EAAAA,sBAACI,EAAMA,OAACC,IAAG,CACTC,UAAW,6KACTpB,EAAS,UAAY,WAEvBqB,MAAO,CACLC,qBAAsB,OACtBC,wBAAyB,OACzBC,MAAO,OACPC,gBAAiB,SAEnBC,QAAS,CAAEC,GAAI,IACfC,QAAS,CACPD,EAAG,EACHE,WAAY,CACVC,SAAU,GACVC,KAAM,YAGVC,KAAM,CACJL,GAAI,GACJE,WAAY,CACVC,SAAU,GACVC,KAAM,YAIVjB,EAAAA,QAAKC,cAAA,MAAA,CAAAK,UAAU,oEAEbN,UAAAC,cAACkB,EAAMA,OACL,CAAAC,OAAQ9B,2BACe,EACvB+B,QAAQ,sBACRC,QAAS,WAAM,OAAAC,oBAAkBjC,IAAY,kBAC7B,iBAAgB,uBAE9BA,EAAcM,EAAE,2BAA6B,GAAKA,EAAE,mBAAqB,IAG1EN,EACCU,UAAAC,cAACuB,EAAeA,gBAAC,CAAAC,KAAMC,SAAQpB,UAAU,kBAEzCN,EAAAA,sBAACwB,kBAAe,CAAClB,UAAU,8BAA8BmB,KAAME,eAclE7B,aAAA,EAAAA,EAAkB8B,QAAS,GAC1B5B,EAAC,QAAAC,cAAAkB,EAAMA,OACL,CAAAE,QAAQ,sBAAqB,kBACb,wBAAuB,uBACjBzB,EAAE,0BAA4B,GACpD0B,QAAS,WAAM,OAvEMO,EAuEsB,eAtEzD7C,EAASK,OAAOyC,uBAAsB,QACrB,OAAbD,GACF7C,EAASK,OAAO0C,cAAcF,IAHE,IAACA,IAyErB7B,EAAAA,QAAAC,cAACuB,kBAAe,CAAClB,UAAU,8BAA8BmB,KAAMO,uBAkB3EhC,EAAC,QAAAC,cAAAgC,uBAAoBC,GAAG,iBAAiBC,MAAM,SAC/CnC,EAAC,QAAAC,cAAAgC,uBAAoBC,GAAG,gBAAgBC,MAAM,SAC9CnC,UAAAC,cAACgC,EAAAA,oBAAmB,CAACC,GAAG,wBAAwBC,MAAM,SAG5D"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nethesis/phone-island",
3
3
  "author": "Nethesis",
4
- "version": "0.9.0",
4
+ "version": "0.10.0",
5
5
  "description": "NethVoice CTI Phone Island",
6
6
  "keywords": [
7
7
  "nethserver",
@@ -78,10 +78,11 @@
78
78
  "format": "prettier --write './**/*.{js,jsx,ts,tsx,css,md,json}' --config ./.prettierrc",
79
79
  "bump": "node bump-version.js",
80
80
  "build-pack": "npm run bump && npm run build && npm pack",
81
+ "build-pack:win": "npm run bump && npm run build:win && npm pack",
81
82
  "publish:minor": "npm version minor --allow-same-version -m v%s --force",
82
83
  "publish:major": "npm version major --allow-same-version -m v%s --force",
83
84
  "publish:patch": "npm version patch --allow-same-version -m v%s --force",
84
- "postversion": "git add . && git push --follow-tags && git push --tags",
85
+ "postversion": "git push --tags",
85
86
  "revert-bump": "node revert-bump.js"
86
87
  },
87
88
  "browserslist": {