@nethesis/phone-island 0.7.39 → 0.7.41

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.
Files changed (262) hide show
  1. package/dist/App.js +1 -1
  2. package/dist/App.js.map +1 -1
  3. package/dist/_virtual/assert.js +2 -0
  4. package/dist/_virtual/assert.js.map +1 -0
  5. package/dist/_virtual/browser.js +2 -0
  6. package/dist/_virtual/browser.js.map +1 -0
  7. package/dist/_virtual/events.js +2 -0
  8. package/dist/_virtual/events.js.map +1 -0
  9. package/dist/_virtual/index10.js +2 -0
  10. package/dist/_virtual/index10.js.map +1 -0
  11. package/dist/_virtual/index11.js +2 -0
  12. package/dist/_virtual/index11.js.map +1 -0
  13. package/dist/_virtual/index2.js +1 -1
  14. package/dist/_virtual/index3.js +1 -1
  15. package/dist/_virtual/index4.js +1 -1
  16. package/dist/_virtual/index5.js +1 -1
  17. package/dist/_virtual/index6.js +1 -1
  18. package/dist/_virtual/index8.js +1 -1
  19. package/dist/_virtual/index9.js +2 -0
  20. package/dist/_virtual/index9.js.map +1 -0
  21. package/dist/_virtual/inherits.js +2 -0
  22. package/dist/_virtual/inherits.js.map +1 -0
  23. package/dist/_virtual/inherits_browser.js +2 -0
  24. package/dist/_virtual/inherits_browser.js.map +1 -0
  25. package/dist/_virtual/node.js +2 -0
  26. package/dist/_virtual/node.js.map +1 -0
  27. package/dist/_virtual/punycode.js +2 -0
  28. package/dist/_virtual/punycode.js.map +1 -0
  29. package/dist/_virtual/url.js +2 -0
  30. package/dist/_virtual/url.js.map +1 -0
  31. package/dist/_virtual/util.js +2 -0
  32. package/dist/_virtual/util.js.map +1 -0
  33. package/dist/_virtual/util2.js +2 -0
  34. package/dist/_virtual/util2.js.map +1 -0
  35. package/dist/components/Button.d.ts +1 -0
  36. package/dist/components/Button.js +1 -1
  37. package/dist/components/Button.js.map +1 -1
  38. package/dist/components/Events.js +1 -1
  39. package/dist/components/Events.js.map +1 -1
  40. package/dist/components/Island.js +1 -1
  41. package/dist/components/Island.js.map +1 -1
  42. package/dist/components/RestAPI.d.ts +9 -0
  43. package/dist/components/RestAPI.js +2 -0
  44. package/dist/components/RestAPI.js.map +1 -0
  45. package/dist/components/Socket.js +1 -1
  46. package/dist/components/Socket.js.map +1 -1
  47. package/dist/components/WebRTC.js +1 -1
  48. package/dist/components/WebRTC.js.map +1 -1
  49. package/dist/components/index.d.ts +1 -0
  50. package/dist/components/index.js +1 -1
  51. package/dist/events/CallEvents.d.ts +8 -0
  52. package/dist/events/CallEvents.js +1 -1
  53. package/dist/events/CallEvents.js.map +1 -1
  54. package/dist/events/SocketEvents.js +1 -1
  55. package/dist/events/SocketEvents.js.map +1 -1
  56. package/dist/events/index.d.ts +1 -0
  57. package/dist/index.css +1 -1
  58. package/dist/lib/devices/devices.js +1 -1
  59. package/dist/lib/devices/devices.js.map +1 -1
  60. package/dist/lib/phone/audio.d.ts +4 -1
  61. package/dist/lib/phone/audio.js +2 -0
  62. package/dist/lib/phone/audio.js.map +1 -0
  63. package/dist/lib/phone/call.d.ts +16 -0
  64. package/dist/lib/phone/call.js +1 -1
  65. package/dist/lib/phone/call.js.map +1 -1
  66. package/dist/lib/user/default_device.d.ts +4 -0
  67. package/dist/lib/user/default_device.js +2 -0
  68. package/dist/lib/user/default_device.js.map +1 -0
  69. package/dist/lib/webrtc/messages.d.ts +21 -1
  70. package/dist/lib/webrtc/messages.js +1 -1
  71. package/dist/lib/webrtc/messages.js.map +1 -1
  72. package/dist/models/currentCall.d.ts +63 -20
  73. package/dist/models/currentCall.js +1 -1
  74. package/dist/models/currentCall.js.map +1 -1
  75. package/dist/models/currentUser.d.ts +53 -0
  76. package/dist/models/currentUser.js +2 -0
  77. package/dist/models/currentUser.js.map +1 -0
  78. package/dist/models/index.d.ts +2 -0
  79. package/dist/models/index.js +1 -1
  80. package/dist/models/index.js.map +1 -1
  81. package/dist/models/player.d.ts +21 -19
  82. package/dist/models/player.js +1 -1
  83. package/dist/models/player.js.map +1 -1
  84. package/dist/models/webrtc.d.ts +4 -4
  85. package/dist/models/webrtc.js.map +1 -1
  86. package/dist/node_modules/@fortawesome/free-solid-svg-icons/index.mjs.js +1 -1
  87. package/dist/node_modules/@fortawesome/free-solid-svg-icons/index.mjs.js.map +1 -1
  88. package/dist/node_modules/@fortawesome/react-fontawesome/index.es.js +1 -1
  89. package/dist/node_modules/assert/assert.js +9 -0
  90. package/dist/node_modules/assert/assert.js.map +1 -0
  91. package/dist/node_modules/assert/node_modules/inherits/inherits.js +2 -0
  92. package/dist/node_modules/assert/node_modules/inherits/inherits.js.map +1 -0
  93. package/dist/node_modules/assert/node_modules/util/support/isBuffer.js +2 -0
  94. package/dist/node_modules/assert/node_modules/util/support/isBuffer.js.map +1 -0
  95. package/dist/node_modules/assert/node_modules/util/util.js +2 -0
  96. package/dist/node_modules/assert/node_modules/util/util.js.map +1 -0
  97. package/dist/node_modules/axios/index.js +2 -0
  98. package/dist/node_modules/axios/index.js.map +1 -0
  99. package/dist/node_modules/axios/lib/adapters/adapters.js +2 -0
  100. package/dist/node_modules/axios/lib/adapters/adapters.js.map +1 -0
  101. package/dist/node_modules/axios/lib/adapters/http.js +2 -0
  102. package/dist/node_modules/axios/lib/adapters/http.js.map +1 -0
  103. package/dist/node_modules/axios/lib/adapters/xhr.js +2 -0
  104. package/dist/node_modules/axios/lib/adapters/xhr.js.map +1 -0
  105. package/dist/node_modules/axios/lib/axios.js +2 -0
  106. package/dist/node_modules/axios/lib/axios.js.map +1 -0
  107. package/dist/node_modules/axios/lib/cancel/CancelToken.js +2 -0
  108. package/dist/node_modules/axios/lib/cancel/CancelToken.js.map +1 -0
  109. package/dist/node_modules/axios/lib/cancel/CanceledError.js +2 -0
  110. package/dist/node_modules/axios/lib/cancel/CanceledError.js.map +1 -0
  111. package/dist/node_modules/axios/lib/cancel/isCancel.js +2 -0
  112. package/dist/node_modules/axios/lib/cancel/isCancel.js.map +1 -0
  113. package/dist/node_modules/axios/lib/core/Axios.js +2 -0
  114. package/dist/node_modules/axios/lib/core/Axios.js.map +1 -0
  115. package/dist/node_modules/axios/lib/core/AxiosError.js +2 -0
  116. package/dist/node_modules/axios/lib/core/AxiosError.js.map +1 -0
  117. package/dist/node_modules/axios/lib/core/AxiosHeaders.js +2 -0
  118. package/dist/node_modules/axios/lib/core/AxiosHeaders.js.map +1 -0
  119. package/dist/node_modules/axios/lib/core/InterceptorManager.js +2 -0
  120. package/dist/node_modules/axios/lib/core/InterceptorManager.js.map +1 -0
  121. package/dist/node_modules/axios/lib/core/buildFullPath.js +2 -0
  122. package/dist/node_modules/axios/lib/core/buildFullPath.js.map +1 -0
  123. package/dist/node_modules/axios/lib/core/dispatchRequest.js +2 -0
  124. package/dist/node_modules/axios/lib/core/dispatchRequest.js.map +1 -0
  125. package/dist/node_modules/axios/lib/core/mergeConfig.js +2 -0
  126. package/dist/node_modules/axios/lib/core/mergeConfig.js.map +1 -0
  127. package/dist/node_modules/axios/lib/core/settle.js +2 -0
  128. package/dist/node_modules/axios/lib/core/settle.js.map +1 -0
  129. package/dist/node_modules/axios/lib/core/transformData.js +2 -0
  130. package/dist/node_modules/axios/lib/core/transformData.js.map +1 -0
  131. package/dist/node_modules/axios/lib/defaults/index.js +2 -0
  132. package/dist/node_modules/axios/lib/defaults/index.js.map +1 -0
  133. package/dist/node_modules/axios/lib/defaults/transitional.js +2 -0
  134. package/dist/node_modules/axios/lib/defaults/transitional.js.map +1 -0
  135. package/dist/node_modules/axios/lib/env/classes/FormData.js +2 -0
  136. package/dist/node_modules/axios/lib/env/classes/FormData.js.map +1 -0
  137. package/dist/node_modules/axios/lib/env/data.js +2 -0
  138. package/dist/node_modules/axios/lib/env/data.js.map +1 -0
  139. package/dist/node_modules/axios/lib/helpers/AxiosTransformStream.js +2 -0
  140. package/dist/node_modules/axios/lib/helpers/AxiosTransformStream.js.map +1 -0
  141. package/dist/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +2 -0
  142. package/dist/node_modules/axios/lib/helpers/AxiosURLSearchParams.js.map +1 -0
  143. package/dist/node_modules/axios/lib/helpers/HttpStatusCode.js +2 -0
  144. package/dist/node_modules/axios/lib/helpers/HttpStatusCode.js.map +1 -0
  145. package/dist/node_modules/axios/lib/helpers/bind.js +2 -0
  146. package/dist/node_modules/axios/lib/helpers/bind.js.map +1 -0
  147. package/dist/node_modules/axios/lib/helpers/buildURL.js +2 -0
  148. package/dist/node_modules/axios/lib/helpers/buildURL.js.map +1 -0
  149. package/dist/node_modules/axios/lib/helpers/combineURLs.js +2 -0
  150. package/dist/node_modules/axios/lib/helpers/combineURLs.js.map +1 -0
  151. package/dist/node_modules/axios/lib/helpers/cookies.js +2 -0
  152. package/dist/node_modules/axios/lib/helpers/cookies.js.map +1 -0
  153. package/dist/node_modules/axios/lib/helpers/formDataToJSON.js +2 -0
  154. package/dist/node_modules/axios/lib/helpers/formDataToJSON.js.map +1 -0
  155. package/dist/node_modules/axios/lib/helpers/fromDataURI.js +2 -0
  156. package/dist/node_modules/axios/lib/helpers/fromDataURI.js.map +1 -0
  157. package/dist/node_modules/axios/lib/helpers/isAbsoluteURL.js +2 -0
  158. package/dist/node_modules/axios/lib/helpers/isAbsoluteURL.js.map +1 -0
  159. package/dist/node_modules/axios/lib/helpers/isAxiosError.js +2 -0
  160. package/dist/node_modules/axios/lib/helpers/isAxiosError.js.map +1 -0
  161. package/dist/node_modules/axios/lib/helpers/isURLSameOrigin.js +2 -0
  162. package/dist/node_modules/axios/lib/helpers/isURLSameOrigin.js.map +1 -0
  163. package/dist/node_modules/axios/lib/helpers/parseHeaders.js +2 -0
  164. package/dist/node_modules/axios/lib/helpers/parseHeaders.js.map +1 -0
  165. package/dist/node_modules/axios/lib/helpers/parseProtocol.js +2 -0
  166. package/dist/node_modules/axios/lib/helpers/parseProtocol.js.map +1 -0
  167. package/dist/node_modules/axios/lib/helpers/speedometer.js +2 -0
  168. package/dist/node_modules/axios/lib/helpers/speedometer.js.map +1 -0
  169. package/dist/node_modules/axios/lib/helpers/spread.js +2 -0
  170. package/dist/node_modules/axios/lib/helpers/spread.js.map +1 -0
  171. package/dist/node_modules/axios/lib/helpers/throttle.js +2 -0
  172. package/dist/node_modules/axios/lib/helpers/throttle.js.map +1 -0
  173. package/dist/node_modules/axios/lib/helpers/toFormData.js +2 -0
  174. package/dist/node_modules/axios/lib/helpers/toFormData.js.map +1 -0
  175. package/dist/node_modules/axios/lib/helpers/toURLEncodedForm.js +2 -0
  176. package/dist/node_modules/axios/lib/helpers/toURLEncodedForm.js.map +1 -0
  177. package/dist/node_modules/axios/lib/helpers/validator.js +2 -0
  178. package/dist/node_modules/axios/lib/helpers/validator.js.map +1 -0
  179. package/dist/node_modules/axios/lib/platform/node/classes/FormData.js +2 -0
  180. package/dist/node_modules/axios/lib/platform/node/classes/FormData.js.map +1 -0
  181. package/dist/node_modules/axios/lib/platform/node/classes/URLSearchParams.js +2 -0
  182. package/dist/node_modules/axios/lib/platform/node/classes/URLSearchParams.js.map +1 -0
  183. package/dist/node_modules/axios/lib/platform/node/index.js +2 -0
  184. package/dist/node_modules/axios/lib/platform/node/index.js.map +1 -0
  185. package/dist/node_modules/axios/lib/utils.js +2 -0
  186. package/dist/node_modules/axios/lib/utils.js.map +1 -0
  187. package/dist/node_modules/axios/node_modules/form-data/lib/browser.js +2 -0
  188. package/dist/node_modules/axios/node_modules/form-data/lib/browser.js.map +1 -0
  189. package/dist/node_modules/debug/src/browser.js +2 -0
  190. package/dist/node_modules/debug/src/browser.js.map +1 -0
  191. package/dist/node_modules/debug/src/common.js +2 -0
  192. package/dist/node_modules/debug/src/common.js.map +1 -0
  193. package/dist/node_modules/debug/src/index.js +2 -0
  194. package/dist/node_modules/debug/src/index.js.map +1 -0
  195. package/dist/node_modules/debug/src/node.js +2 -0
  196. package/dist/node_modules/debug/src/node.js.map +1 -0
  197. package/dist/node_modules/events/events.js +2 -0
  198. package/dist/node_modules/events/events.js.map +1 -0
  199. package/dist/node_modules/follow-redirects/debug.js +2 -0
  200. package/dist/node_modules/follow-redirects/debug.js.map +1 -0
  201. package/dist/node_modules/follow-redirects/index.js +2 -0
  202. package/dist/node_modules/follow-redirects/index.js.map +1 -0
  203. package/dist/node_modules/has-flag/index.js +2 -0
  204. package/dist/node_modules/has-flag/index.js.map +1 -0
  205. package/dist/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js +1 -1
  206. package/dist/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js.map +1 -1
  207. package/dist/node_modules/hoist-non-react-statics/node_modules/react-is/index.js +1 -1
  208. package/dist/node_modules/hoist-non-react-statics/node_modules/react-is/index.js.map +1 -1
  209. package/dist/node_modules/mic-check/lib/index.js +1 -1
  210. package/dist/node_modules/mic-check/lib/index.js.map +1 -1
  211. package/dist/node_modules/ms/index.js +2 -0
  212. package/dist/node_modules/ms/index.js.map +1 -0
  213. package/dist/node_modules/object-assign/index.js +2 -2
  214. package/dist/node_modules/object-assign/index.js.map +1 -1
  215. package/dist/node_modules/prop-types/factoryWithTypeCheckers.js +1 -1
  216. package/dist/node_modules/prop-types/factoryWithTypeCheckers.js.map +1 -1
  217. package/dist/node_modules/prop-types/index.js +1 -1
  218. package/dist/node_modules/prop-types/node_modules/react-is/index.js +1 -1
  219. package/dist/node_modules/proxy-from-env/index.js +2 -0
  220. package/dist/node_modules/proxy-from-env/index.js.map +1 -0
  221. package/dist/node_modules/querystring/decode.js +2 -0
  222. package/dist/node_modules/querystring/decode.js.map +1 -0
  223. package/dist/node_modules/querystring/encode.js +2 -0
  224. package/dist/node_modules/querystring/encode.js.map +1 -0
  225. package/dist/node_modules/querystring/index.js +2 -0
  226. package/dist/node_modules/querystring/index.js.map +1 -0
  227. package/dist/node_modules/react-moment/dist/index.js +1 -1
  228. package/dist/node_modules/react-redux/node_modules/react-is/index.js +1 -1
  229. package/dist/node_modules/supports-color/index.js +2 -0
  230. package/dist/node_modules/supports-color/index.js.map +1 -0
  231. package/dist/node_modules/url/node_modules/punycode/punycode.js +2 -0
  232. package/dist/node_modules/url/node_modules/punycode/punycode.js.map +1 -0
  233. package/dist/node_modules/url/url.js +2 -0
  234. package/dist/node_modules/url/url.js.map +1 -0
  235. package/dist/node_modules/url/util.js +2 -0
  236. package/dist/node_modules/url/util.js.map +1 -0
  237. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +1 -1
  238. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js +1 -1
  239. package/dist/node_modules/use-sync-external-store/shim/index.js +1 -1
  240. package/dist/node_modules/util/node_modules/inherits/inherits.js +2 -0
  241. package/dist/node_modules/util/node_modules/inherits/inherits.js.map +1 -0
  242. package/dist/node_modules/util/node_modules/inherits/inherits_browser.js +2 -0
  243. package/dist/node_modules/util/node_modules/inherits/inherits_browser.js.map +1 -0
  244. package/dist/node_modules/util/support/isBuffer.js +2 -0
  245. package/dist/node_modules/util/support/isBuffer.js.map +1 -0
  246. package/dist/node_modules/util/util.js +2 -0
  247. package/dist/node_modules/util/util.js.map +1 -0
  248. package/dist/services/user.d.ts +88 -0
  249. package/dist/services/user.js +2 -0
  250. package/dist/services/user.js.map +1 -0
  251. package/dist/styles/Island.styles.d.ts +1 -1
  252. package/dist/styles/Island.styles.js +1 -1
  253. package/dist/styles/Island.styles.js.map +1 -1
  254. package/dist/utils/index.d.ts +6 -0
  255. package/dist/utils/useCurrentCallStore.d.ts +6 -0
  256. package/dist/utils/useCurrentCallStore.js +2 -0
  257. package/dist/utils/useCurrentCallStore.js.map +1 -0
  258. package/dist/utils/useCurrentUserStore.d.ts +6 -0
  259. package/dist/utils/useCurrentUserStore.js +2 -0
  260. package/dist/utils/useCurrentUserStore.js.map +1 -0
  261. package/dist/utils/useWaitResolution.d.ts +5 -0
  262. package/package.json +3 -2
package/dist/App.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("./components/Events.js"),r=require("./components/Socket.js"),o=require("./components/WebRTC.js"),s=require("./components/Island.js");require("./node_modules/react-redux/es/index.js");var a=require("./store/index.js"),n=require("./node_modules/js-base64/base64.mjs.js"),u=require("./utils/useIsomorphicLayoutEffect.js"),d=require("./node_modules/react-redux/es/components/Provider.js");function l(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 c=l(e),i=function(e){var l=e.dataConfig,i=e.always,m=void 0!==i&&i,f=n.Base64.atob(l||"").split(":"),p=f[0],j=f[1],q=f[2],y=f[3],x=f[4];return u.useIsomorphicLayoutEffect((function(){var e=document.querySelector("#audio"),t=document.querySelector("#localVideo"),r=document.querySelector("#remoteVideo");a.store.dispatch.player.updatePlayer({audio:e,localVideo:t,remoteVideo:r})}),[]),c.default.createElement(c.default.Fragment,null,c.default.createElement(d.default,{store:a.store},c.default.createElement(o.WebRTC,{hostName:p,sipExten:y,sipSecret:x},c.default.createElement(r.Socket,{hostName:p,username:j,authToken:q},c.default.createElement(t.Events,null,c.default.createElement(s.Island,{always:m}))))))};i.displayName="PhoneIsland",exports.PhoneIsland=i;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("./components/Events.js"),s=require("./components/Socket.js"),r=require("./components/WebRTC.js"),n=require("./components/Island.js"),a=require("./components/RestAPI.js");require("./node_modules/react-redux/es/index.js");var o=require("./store/index.js"),u=require("./node_modules/js-base64/base64.mjs.js"),d=require("./node_modules/react-redux/es/components/Provider.js");function l(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 i=l(e),c=function(e){var l=e.dataConfig,c=e.always,m=void 0!==c&&c,j=u.Base64.atob(l||"").split(":"),f=j[0],p=j[1],q=j[2],x=j[3],E=j[4];return i.default.createElement(i.default.Fragment,null,i.default.createElement(d.default,{store:o.store},i.default.createElement(r.WebRTC,{hostName:f,sipExten:x,sipSecret:E},i.default.createElement(a.RestAPI,{hostName:f,username:p,authToken:q},i.default.createElement(s.Socket,{hostName:f,username:p,authToken:q},i.default.createElement(t.Events,null,i.default.createElement(n.Island,{always:m})))))))};c.displayName="PhoneIsland",exports.PhoneIsland=c;
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, { FC } from 'react'\nimport { Events, WebRTC } from './components'\nimport { Provider } from 'react-redux'\nimport { store } from './store'\nimport { Socket } from './components'\nimport { Base64 } from 'js-base64'\nimport { useIsomorphicLayoutEffect } from './utils'\nimport { Island } from './components'\n\ninterface PhoneIslandProps {\n dataConfig: string\n always?: boolean\n}\n\nexport const PhoneIsland: FC<PhoneIslandProps> = ({ dataConfig, always = false }) => {\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\n useIsomorphicLayoutEffect(() => {\n const audio: HTMLAudioElement | null = document.querySelector('#audio')\n const localVideo: HTMLVideoElement | null = document.querySelector('#localVideo')\n const remoteVideo: HTMLVideoElement | null = document.querySelector('#remoteVideo')\n store.dispatch.player.updatePlayer({\n audio,\n localVideo,\n remoteVideo,\n })\n }, [])\n\n return (\n <>\n <Provider store={store}>\n <WebRTC hostName={HOST_NAME} sipExten={SIP_EXTEN} sipSecret={SIP_SECRET}>\n <Socket hostName={HOST_NAME} username={USERNAME} authToken={AUTH_TOKEN}>\n <Events>\n <Island always={always} />\n </Events>\n </Socket>\n </WebRTC>\n </Provider>\n </>\n )\n}\n\nPhoneIsland.displayName = 'PhoneIsland'\n"],"names":["PhoneIsland","_a","dataConfig","_b","always","CONFIG","Base64","atob","split","HOST_NAME","USERNAME","AUTH_TOKEN","SIP_EXTEN","SIP_SECRET","useIsomorphicLayoutEffect","audio","document","querySelector","localVideo","remoteVideo","store","dispatch","player","updatePlayer","React","createElement","Fragment","Provider","WebRTC","hostName","sipExten","sipSecret","Socket","username","authToken","Events","Island","displayName"],"mappings":"oxBAcaA,EAAoC,SAACC,GAAE,IAAAC,eAAYC,EAAAF,EAAAG,OAAAA,OAAM,IAAAD,GAAQA,EACtEE,EAAmBC,EAAMA,OAACC,KAAKL,GAAc,IAAIM,MAAM,KACvDC,EAAoBJ,EAAO,GAC3BK,EAAmBL,EAAO,GAC1BM,EAAqBN,EAAO,GAC5BO,EAAoBP,EAAO,GAC3BQ,EAAqBR,EAAO,GAalC,OAXAS,EAAAA,2BAA0B,WACxB,IAAMC,EAAiCC,SAASC,cAAc,UACxDC,EAAsCF,SAASC,cAAc,eAC7DE,EAAuCH,SAASC,cAAc,gBACpEG,QAAMC,SAASC,OAAOC,aAAa,CACjCR,MAAKA,EACLG,WAAUA,EACVC,YAAWA,GAEd,GAAE,IAGDK,UAAAC,cAAAD,EAAA,QAAAE,SAAA,KACEF,EAAAA,QAAAC,cAACE,EAAAA,QAAQ,CAACP,MAAOA,EAAAA,OACfI,UAAAC,cAACG,EAAMA,OAAA,CAACC,SAAUpB,EAAWqB,SAAUlB,EAAWmB,UAAWlB,GAC3DW,UAAAC,cAACO,EAAMA,OAAA,CAACH,SAAUpB,EAAWwB,SAAUvB,EAAUwB,UAAWvB,GAC1Da,UAAAC,cAACU,EAAAA,OAAM,KACLX,UAAAC,cAACW,EAAAA,OAAM,CAAChC,OAAQA,QAO9B,EAEAJ,EAAYqC,YAAc"}
1
+ {"version":3,"file":"App.js","sources":["../src/App.tsx"],"sourcesContent":["import React, { FC } from 'react'\nimport { Events, WebRTC } from './components'\nimport { Provider } from 'react-redux'\nimport { store } from './store'\nimport { Socket } from './components'\nimport { Base64 } from 'js-base64'\nimport { Island } from './components'\nimport { RestAPI } from './components'\n\ninterface PhoneIslandProps {\n dataConfig: string\n always?: boolean\n}\n\nexport const PhoneIsland: FC<PhoneIslandProps> = ({ dataConfig, always = false }) => {\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\n return (\n <>\n <Provider store={store}>\n <WebRTC hostName={HOST_NAME} sipExten={SIP_EXTEN} sipSecret={SIP_SECRET}>\n <RestAPI hostName={HOST_NAME} username={USERNAME} authToken={AUTH_TOKEN}>\n <Socket hostName={HOST_NAME} username={USERNAME} authToken={AUTH_TOKEN}>\n <Events>\n <Island always={always} />\n </Events>\n </Socket>\n </RestAPI>\n </WebRTC>\n </Provider>\n </>\n )\n}\n\nPhoneIsland.displayName = 'PhoneIsland'\n"],"names":["PhoneIsland","_a","dataConfig","_b","always","CONFIG","Base64","atob","split","HOST_NAME","USERNAME","AUTH_TOKEN","SIP_EXTEN","SIP_SECRET","React","createElement","Fragment","Provider","store","WebRTC","hostName","sipExten","sipSecret","RestAPI","username","authToken","Socket","Events","Island","displayName"],"mappings":"uwBAcaA,EAAoC,SAACC,GAAE,IAAAC,eAAYC,EAAAF,EAAAG,OAAAA,OAAM,IAAAD,GAAQA,EACtEE,EAAmBC,EAAMA,OAACC,KAAKL,GAAc,IAAIM,MAAM,KACvDC,EAAoBJ,EAAO,GAC3BK,EAAmBL,EAAO,GAC1BM,EAAqBN,EAAO,GAC5BO,EAAoBP,EAAO,GAC3BQ,EAAqBR,EAAO,GAElC,OACES,UAAAC,cAAAD,EAAA,QAAAE,SAAA,KACEF,EAAAA,QAAAC,cAACE,EAAAA,QAAQ,CAACC,MAAOA,EAAAA,OACfJ,UAAAC,cAACI,EAAMA,OAAA,CAACC,SAAUX,EAAWY,SAAUT,EAAWU,UAAWT,GAC3DC,UAAAC,cAACQ,EAAOA,QAAA,CAACH,SAAUX,EAAWe,SAAUd,EAAUe,UAAWd,GAC3DG,UAAAC,cAACW,EAAMA,OAAA,CAACN,SAAUX,EAAWe,SAAUd,EAAUe,UAAWd,GAC1DG,UAAAC,cAACY,EAAAA,OAAM,KACLb,UAAAC,cAACa,EAAMA,OAAA,CAACxB,OAAQA,SAQhC,EAEAJ,EAAY6B,YAAc"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.assert={exports:{}};
2
+ //# sourceMappingURL=assert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.browser={exports:{}};
2
+ //# sourceMappingURL=browser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.events={exports:{}};
2
+ //# sourceMappingURL=events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.reactIs={exports:{}};
2
+ //# sourceMappingURL=index10.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index10.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.__exports={};
2
+ //# sourceMappingURL=index11.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index11.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.reactIs={exports:{}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.__exports={};
2
2
  //# sourceMappingURL=index2.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.dist={exports:{}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.reactIs={exports:{}};
2
2
  //# sourceMappingURL=index3.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.shim={exports:{}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.dist={exports:{}};
2
2
  //# sourceMappingURL=index4.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.propTypes={exports:{}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.shim={exports:{}};
2
2
  //# sourceMappingURL=index5.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.reactIs={exports:{}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.propTypes={exports:{}};
2
2
  //# sourceMappingURL=index6.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.__exports={};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.followRedirects={exports:{}};
2
2
  //# sourceMappingURL=index8.js.map
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.src={exports:{}};
2
+ //# sourceMappingURL=index9.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index9.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.inherits={exports:{}};
2
+ //# sourceMappingURL=inherits.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inherits.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.inherits_browser={exports:{}};
2
+ //# sourceMappingURL=inherits_browser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inherits_browser.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.node={exports:{}};
2
+ //# sourceMappingURL=node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.punycode={exports:{}};
2
+ //# sourceMappingURL=punycode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"punycode.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.__exports={};
2
+ //# sourceMappingURL=url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.__exports={};
2
+ //# sourceMappingURL=util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.__exports={};
2
+ //# sourceMappingURL=util2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util2.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -2,6 +2,7 @@ import { FC, ReactNode, ComponentPropsWithRef } from 'react';
2
2
  interface ButtonProps extends ComponentPropsWithRef<'button'> {
3
3
  children: ReactNode;
4
4
  variant: 'red' | 'green' | 'default' | 'neutral';
5
+ active?: boolean;
5
6
  }
6
7
  export declare const Button: FC<ButtonProps>;
7
8
  export {};
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../node_modules/tslib/tslib.es6.js");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t=r(require("react"));function n(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return e.filter(Boolean).join(" ")}exports.Button=function(r){var o=r.children,a=r.variant,i=e.__rest(r,["children","variant"]),s={base:"flex content-center items-center justify-center font-medium tracking-wide transition-colors duration-200 transform focus:outline-none focus:ring-2 focus:z-20 focus:ring-offset-2 disabled:opacity-75 text-white border border-transparent focus:ring-offset-black rounded-full text-sm leading-4 h-12 w-12 col-start-auto",variant:{red:"bg-red-600 hover:bg-red-700 focus:ring-red-500",green:"bg-green-600 hover:bg-green-700 focus:ring-green-500",default:"bg-gray-700 hover:bg-gray-800 focus:ring-gray-600",neutral:"bg-transparent hover:bg-gray-500 border border-gray-600 focus:ring-0"}};return t.default.createElement("button",e.__assign({"data-stop-propagation":!0,className:n(s.base,a&&s.variant[a])},i),o)};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../node_modules/tslib/tslib.es6.js"),r=require("react");require("../node_modules/framer-motion/dist/framer-motion.js");var t=require("../_virtual/framer-motion.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=n(r);function o(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return e.filter(Boolean).join(" ")}exports.Button=function(r){var n=r.children,i=r.variant,u=r.active,s=void 0!==u&&u,l=e.__rest(r,["children","variant","active"]),d={base:"flex content-center items-center justify-center font-medium tracking-wide duration-200 transform focus:outline-none focus:ring-2 focus:z-20 focus:ring-offset-2 disabled:opacity-75 text-white border border-transparent focus:ring-offset-black rounded-full text-sm leading-4 h-12 w-12 col-start-auto transition-color",variant:{red:"bg-red-600 hover:bg-red-700 focus:ring-red-500",green:"bg-green-600 hover:bg-green-700 focus:ring-green-500",default:"bg-gray-700 hover:bg-gray-500 focus:ring-gray-500",neutral:"bg-transparent hover:bg-gray-500 hover:border-gray-500 border border-gray-700 focus:ring-0"},active:{default:"bg-gray-500"}};return a.default.createElement(a.default.Fragment,null,a.default.createElement(t.framerMotion.exports.motion.div,null,a.default.createElement("button",e.__assign({"data-stop-propagation":!0,className:o(s&&d.active[i],d.base,i&&d.variant[i])},l),n)))};
2
2
  //# sourceMappingURL=Button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sources":["../../src/components/Button.tsx"],"sourcesContent":["// Copyright (C) 2022 Nethesis S.r.l.\n// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport React, { FC, ReactNode, ComponentPropsWithRef } from 'react'\n\ninterface ButtonProps extends ComponentPropsWithRef<'button'> {\n children: ReactNode\n variant: 'red' | 'green' | 'default' | 'neutral'\n}\n\nfunction classNames(...classes) {\n return classes.filter(Boolean).join(' ')\n}\n\nexport const Button: FC<ButtonProps> = ({ children, variant, ...props }) => {\n const styles = {\n base: 'flex content-center items-center justify-center font-medium tracking-wide transition-colors duration-200 transform focus:outline-none focus:ring-2 focus:z-20 focus:ring-offset-2 disabled:opacity-75 text-white border border-transparent focus:ring-offset-black rounded-full text-sm leading-4 h-12 w-12 col-start-auto',\n variant: {\n red: 'bg-red-600 hover:bg-red-700 focus:ring-red-500',\n green: 'bg-green-600 hover:bg-green-700 focus:ring-green-500',\n default: 'bg-gray-700 hover:bg-gray-800 focus:ring-gray-600',\n neutral: 'bg-transparent hover:bg-gray-500 border border-gray-600 focus:ring-0',\n },\n }\n\n return (\n <button\n data-stop-propagation={true}\n className={classNames(styles.base, variant && styles.variant[variant])}\n {...props}\n >\n {children}\n </button>\n )\n}\n"],"names":["classNames","classes","_i","arguments","length","filter","Boolean","join","_a","children","variant","props","__rest","styles","base","red","green","default","neutral","React","createElement","__assign","className"],"mappings":"0NAUA,SAASA,QAAW,IAAUC,EAAA,GAAAC,EAAA,EAAVA,EAAUC,UAAAC,OAAVF,IAAAD,EAAUC,GAAAC,UAAAD,GAC5B,OAAOD,EAAQI,OAAOC,SAASC,KAAK,IACtC,gBAEuC,SAACC,GAAE,IAAAC,aAAUC,YAAYC,EAAxBC,EAAAA,OAAAJ,EAAA,CAAA,WAAA,YAChCK,EAAS,CACbC,KAAM,6TACNJ,QAAS,CACPK,IAAK,iDACLC,MAAO,uDACPC,QAAS,oDACTC,QAAS,yEAIb,OACEC,EACyB,QAAAC,cAAA,SAAAC,EAAAA,SAAA,CAAA,yBAAA,EACvBC,UAAWtB,EAAWa,EAAOC,KAAMJ,GAAWG,EAAOH,QAAQA,KACzDC,GAEHF,EAGP"}
1
+ {"version":3,"file":"Button.js","sources":["../../src/components/Button.tsx"],"sourcesContent":["// Copyright (C) 2022 Nethesis S.r.l.\n// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport React, { FC, ReactNode, ComponentPropsWithRef } from 'react'\nimport { motion } from 'framer-motion/dist/framer-motion'\n\ninterface ButtonProps extends ComponentPropsWithRef<'button'> {\n children: ReactNode\n variant: 'red' | 'green' | 'default' | 'neutral'\n active?: boolean\n}\n\nfunction classNames(...classes) {\n return classes.filter(Boolean).join(' ')\n}\n\nexport const Button: FC<ButtonProps> = ({ children, variant, active = false, ...props }) => {\n const styles = {\n base: 'flex content-center items-center justify-center font-medium tracking-wide duration-200 transform focus:outline-none focus:ring-2 focus:z-20 focus:ring-offset-2 disabled:opacity-75 text-white border border-transparent focus:ring-offset-black rounded-full text-sm leading-4 h-12 w-12 col-start-auto transition-color',\n variant: {\n red: 'bg-red-600 hover:bg-red-700 focus:ring-red-500',\n green: 'bg-green-600 hover:bg-green-700 focus:ring-green-500',\n default: 'bg-gray-700 hover:bg-gray-500 focus:ring-gray-500',\n neutral:\n 'bg-transparent hover:bg-gray-500 hover:border-gray-500 border border-gray-700 focus:ring-0',\n },\n active: {\n default: 'bg-gray-500',\n },\n }\n\n return (\n <>\n <motion.div>\n <button\n data-stop-propagation={true}\n className={classNames(\n active && styles.active[variant],\n styles.base,\n variant && styles.variant[variant],\n )}\n {...props}\n >\n {children}\n </button>\n </motion.div>\n </>\n )\n}\n"],"names":["classNames","classes","_i","arguments","length","filter","Boolean","join","_a","children","variant","_b","active","props","__rest","styles","base","red","green","default","neutral","React","createElement","Fragment","motion","div","__assign","className"],"mappings":"2UAYA,SAASA,QAAW,IAAUC,EAAA,GAAAC,EAAA,EAAVA,EAAUC,UAAAC,OAAVF,IAAAD,EAAUC,GAAAC,UAAAD,GAC5B,OAAOD,EAAQI,OAAOC,SAASC,KAAK,IACtC,gBAEuC,SAACC,GAAE,IAAAC,EAAQD,EAAAC,SAAEC,EAAOF,EAAAE,QAAEC,EAAcH,EAAAI,OAAdA,OAAM,IAAAD,GAAQA,EAAKE,EAAKC,EAAAA,OAAAN,EAA7C,iCAChCO,EAAS,CACbC,KAAM,4TACNN,QAAS,CACPO,IAAK,iDACLC,MAAO,uDACPC,QAAS,oDACTC,QACE,8FAEJR,OAAQ,CACNO,QAAS,gBAIb,OACEE,UAAAC,cAAAD,EAAA,QAAAE,SAAA,KACEF,EAAAA,QAACC,cAAAE,8BAAOC,IAAG,KACTJ,EAAAA,QAAAC,cAAA,SAAAI,EAAAA,SAAA,CAAA,yBACyB,EACvBC,UAAW3B,EACTY,GAAUG,EAAOH,OAAOF,GACxBK,EAAOC,KACPN,GAAWK,EAAOL,QAAQA,KAExBG,GAEHJ,IAKX"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("../events/CallEvents.js");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=r(e);exports.Events=function(e){var r=e.children;return l.default.createElement(l.default.Fragment,null,l.default.createElement(t.CallEvents,null),r)};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("../events/CallEvents.js");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("../store/index.js");var n=r(e);exports.Events=function(e){var r=e.children;return n.default.createElement(n.default.Fragment,null,n.default.createElement(t.CallEvents,null),r)};
2
2
  //# sourceMappingURL=Events.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Events.js","sources":["../../src/components/Events.tsx"],"sourcesContent":["// Copyright (C) 2022 Nethesis S.r.l.\n// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport React, { type ReactNode, FC } from 'react'\nimport { CallEvents } from '../events'\n\ninterface EventsProps {\n children: ReactNode\n}\n\nexport const Events: FC<EventsProps> = ({ children }) => {\n return (\n <>\n {<CallEvents />}\n {children}\n </>\n )\n}\n"],"names":["_a","children","React","createElement","Fragment","CallEvents"],"mappings":"kOAUuC,SAACA,GAAE,IAAAC,EAAQD,EAAAC,SAChD,OACEC,UAAAC,cAAAD,EAAA,QAAAE,SAAA,KACGF,UAAAC,cAACE,EAAUA,WAAG,MACdJ,EAGP"}
1
+ {"version":3,"file":"Events.js","sources":["../../src/components/Events.tsx"],"sourcesContent":["// Copyright (C) 2022 Nethesis S.r.l.\n// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport React, { type ReactNode, FC } from 'react'\nimport { CallEvents } from '../events'\n\ninterface EventsProps {\n children: ReactNode\n}\n\nexport const Events: FC<EventsProps> = ({ children }) => {\n return (\n <>\n {<CallEvents />}\n {children}\n </>\n )\n}\n"],"names":["_a","children","React","createElement","Fragment","CallEvents"],"mappings":"+PAUuC,SAACA,GAAE,IAAAC,EAAQD,EAAAC,SAChD,OACEC,UAAAC,cAAAD,EAAA,QAAAE,SAAA,KACGF,UAAAC,cAACE,EAAUA,WAAG,MACdJ,EAGP"}
@@ -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"),n=require("../styles/Island.styles.js");require("../node_modules/react-redux/es/index.js");var a=require("../node_modules/@fortawesome/react-fontawesome/index.es.js"),o=require("../node_modules/@fortawesome/free-solid-svg-icons/index.mjs.js");require("../node_modules/framer-motion/dist/framer-motion.js");var r=require("../lib/phone/call.js"),i=require("../utils/useLongPress.js"),l=require("../node_modules/react-moment/dist/index.js"),s=require("../utils/useLocalStorage.js"),u=require("./AudioBars.js"),d=require("../utils/getTranslate.js"),c=require("./Button.js"),m=require("../_virtual/framer-motion.js"),f=require("../node_modules/react-redux/es/hooks/useSelector.js");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var g=p(t),x=m.framerMotion.exports.motion(n.StyledDynamicIsland);m.framerMotion.exports.motion(n.StyledMusicIconBar);var h=m.framerMotion.exports.motion(n.StyledAlbumArtThumb);m.framerMotion.exports.motion(n.StyledMusicIcon);var v=m.framerMotion.exports.motion(n.StyledArtistDetails),y=0,E=0,w=function(p){var w=p.always,b=t.useState(!0),j=b[0],S=b[1],q=f.useSelector((function(e){return e.currentCall})),M=q.incoming,N=q.accepted,A=q.outgoing,I=q.displayName,B=q.number,C=q.startTime,P=f.useSelector((function(e){return e.player})).audio,_=m.framerMotion.exports.useDragControls(),z=s.useLocalStorage("phone-island",null),D=z[0],F=z[1],R=t.useRef(null),L=t.useRef(null),T=t.useState(D&&D.position?D.position:null),H=T[0],O=T[1],V=t.useState(!1),k=V[0],W=V[1];function G(){return!A&&!N}var Y=i.useLongPress((function(){console.log("long press trigger")}),(function(){S(!j)}),k,(function(){W(!1)}),{shouldPreventDefault:!0,delay:250}),J={open:{width:"48px",height:"48px",borderRadius:"12px",margin:"0 auto"},closed:{width:"20px",height:"20px",borderRadius:"4px"}},K=t.useState(null),Q=K[0],U=K[1];return t.useEffect((function(){var e=null==P?void 0:P.addEventListener("play",(function(){navigator.userAgent.indexOf("Firefox")>-1?U(P.mozCaptureStream()):U(P.captureStream())}));return function(){null==P||P.removeEventListener("play",e)}}),[P]),g.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"},(M||A||N||w)&&g.default.createElement(x,e.__assign({className:"font-sans absolute pointer-events-auto",incoming:M,accepted:N,outgoing:A,isOpen:j,animate:j&&(M||A)&&!N?"openIncoming":j&&N?"openAccepted":"closed",variants:{openIncoming:{width:"418px",height:"96px",borderRadius:"20px"},openAccepted:{width:"348px",height:"236px",borderRadius:"20px"},closed:{width:"156px",height:"36px",borderRadius:"99px"}},drag:!0,onPointerDown:function(e){_.start(e)},onDragStart:function(){W(!0)},dragTransition:{power:0},initial:{x:(null==H?void 0:H.x)||y,y:(null==H?void 0:H.y)||E},style:{padding:j?"24px":"8px 16px"},dragControls:_,dragConstraints:L,onDragEnd:function(){var e=d.getTranslateValues(R.current),t=e.x,n=e.y;t=function(e){var t=L.current.offsetWidth/2-R.current.offsetWidth/2;return e>0&&e>t?t:e<0&&e<-t?-t:e}(Math.round(t)),n=function(e){var t=L.current.offsetHeight/2-R.current.offsetHeight/2;return e>0&&e>t?t:e<0&&e<-t?-t:e}(Math.round(n)),F({position:{x:t,y:n}}),O({x:t,y:n})},ref:R},Y),g.default.createElement(n.StyledDynamicIslandTopContent,{isOpen:j,incoming:M,accepted:N,outgoing:A},g.default.createElement("div",{className:"relative w-12 h-12"},(M||A)&&g.default.createElement(m.framerMotion.exports.motion.div,{style:{animation:"ping 2s cubic-bezier(0, 0, 0.2, 1) infinite",borderRadius:"4px"},animate:j?"open":"closed",variants:J,className:"rounded-xl bg-white absolute opacity-60 -z-10 top-0 left-0 animate-ping h-12 w-12"}),g.default.createElement(h,{className:"z-10 h-12 w-12",animate:j?"open":"closed",variants:J,src:"https://images.unsplash.com/photo-1500462918059-b1a0cb512f1d?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=387&q=80"})),g.default.createElement("div",null,j&&g.default.createElement(v,{initial:{opacity:0},animate:{opacity:1}},g.default.createElement(n.StyledSongName,null,I&&I),g.default.createElement(n.StyledArtistName,null,N?g.default.createElement(l.default,{date:C,interval:1e3,format:"hh:mm:ss",trim:"mid",unix:!0,durationFromNow:!0}):g.default.createElement(g.default.Fragment,null,B&&B)))),N&&g.default.createElement(u.AudioBars,{audioStream:Q})),j&&g.default.createElement("div",{className:"grid gap-y-5"},N&&g.default.createElement("div",{className:"grid grid-cols-4 auto-cols-max gap-y-5 justify-items-center place-items-center justify-center"},g.default.createElement(c.Button,{variant:"default"},g.default.createElement(a.FontAwesomeIcon,{size:"xl",icon:o.faPause})),g.default.createElement(c.Button,{variant:"default"},g.default.createElement(a.FontAwesomeIcon,{size:"xl",icon:o.faMicrophone})),g.default.createElement(c.Button,{variant:"default"},g.default.createElement(a.FontAwesomeIcon,{size:"xl",icon:o.faRightLeft})),g.default.createElement(c.Button,{variant:"neutral"},g.default.createElement(a.FontAwesomeIcon,{size:"xl",icon:o.faChevronDown}))),g.default.createElement(m.framerMotion.exports.motion.div,{className:"grid ".concat(G()?"grid-cols-2":N?"grid-cols-1 justify-items-center":"grid-cols-1 justify-items-end"," gap-3.5"),animate:{opacity:1}},g.default.createElement(c.Button,{onClick:function(e){e.stopPropagation(),r.hangupCurrentCall()},variant:"red"},g.default.createElement(a.FontAwesomeIcon,{className:"rotate-135",size:"2x",icon:o.faPhone})),G()&&g.default.createElement(c.Button,{onClick:function(e){r.answerIncomingCall()},variant:"green"},g.default.createElement(a.FontAwesomeIcon,{size:"2x",icon:o.faPhone}))))),g.default.createElement("audio",{id:"audio",className:"hidden",autoPlay:!0}),g.default.createElement("video",{id:"localVideo",className:"hidden",muted:!0,autoPlay:!0}),g.default.createElement("video",{id:"remoteVideo",className:"hidden",autoPlay:!0}))};w.displayName="Island",exports.Island=w;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../node_modules/tslib/tslib.es6.js"),t=require("react"),n=require("../styles/Island.styles.js");require("../node_modules/react-redux/es/index.js");var a=require("../node_modules/@fortawesome/react-fontawesome/index.es.js"),r=require("../node_modules/@fortawesome/free-solid-svg-icons/index.mjs.js");require("../node_modules/framer-motion/dist/framer-motion.js");var o=require("../utils/useLongPress.js"),i=require("../node_modules/react-moment/dist/index.js"),l=require("../utils/useIsomorphicLayoutEffect.js");require("../store/index.js");var u=require("../utils/useLocalStorage.js"),s=require("../utils/getTranslate.js"),c=require("./AudioBars.js"),d=require("./Button.js"),m=require("../lib/phone/call.js"),f=require("../_virtual/framer-motion.js"),p=require("../node_modules/react-redux/es/hooks/useSelector.js"),g=require("../node_modules/react-redux/es/hooks/useDispatch.js");function x(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var v=x(t),h=f.framerMotion.exports.motion(n.StyledDynamicIsland);f.framerMotion.exports.motion(n.StyledMusicIconBar);var y=f.framerMotion.exports.motion(n.StyledAlbumArtThumb);f.framerMotion.exports.motion(n.StyledMusicIcon);var E=f.framerMotion.exports.motion(n.StyledArtistDetails),w=0,j=0,S=function(x){var S=x.always,C=t.useState(!0),b=C[0],A=C[1],I=p.useSelector((function(e){return e.currentCall})),q=I.incoming,M=I.accepted,N=I.outgoing,P=I.displayName,z=I.number,R=I.startTime,_=I.muted,D=I.paused,F=p.useSelector((function(e){return e.player}));F.localAudio;var B=F.remoteAudio,L=f.framerMotion.exports.useDragControls(),T=u.useLocalStorage("phone-island",null),k=T[0],O=T[1],V=t.useRef(null),H=t.useRef(null),W=t.useState(k&&k.position?k.position:null),G=W[0],J=W[1],K=t.useState(!1),Q=K[0],U=K[1],X=g.useDispatch();function Y(){return!N&&!M}var Z=o.useLongPress((function(){console.log("long press trigger")}),(function(){A(!b)}),Q,(function(){U(!1)}),{shouldPreventDefault:!0,delay:250}),$={open:{width:"48px",height:"48px",borderRadius:"12px",margin:"0 auto"},closed:{width:"20px",height:"20px",borderRadius:"4px"}},ee=t.useState(null),te=ee[0],ne=ee[1];t.useEffect((function(){function e(){null==B||B.addEventListener("play",(function(){navigator.userAgent.indexOf("Firefox")>-1?ne(B.mozCaptureStream()):ne(B.captureStream())}))}return e(),function(){null==B||B.removeEventListener("play",e)}}),[B]);var ae=t.useRef(null),re=t.useRef(null),oe=t.useRef(null),ie=t.useRef(null);return l.useIsomorphicLayoutEffect((function(){X.player.updatePlayer({localAudio:ae.current,localVideo:oe.current,remoteVideo:ie.current,remoteAudio:re.current})}),[]),v.default.createElement("div",{ref:H,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"},(q||N||M||S)&&v.default.createElement(h,e.__assign({className:"font-sans absolute pointer-events-auto",incoming:q,accepted:M,outgoing:N,isOpen:b,animate:b&&(q||N)&&!M?"openIncoming":b&&M?"openAccepted":"closed",variants:{openIncoming:{width:"418px",height:"96px",borderRadius:"20px"},openAccepted:{width:"348px",height:"236px",borderRadius:"20px"},closed:{width:"156px",height:"36px",borderRadius:"99px"}},drag:!0,onPointerDown:function(e){L.start(e)},onDragStart:function(){U(!0)},dragTransition:{power:0},initial:{x:(null==G?void 0:G.x)||w,y:(null==G?void 0:G.y)||j},style:{padding:b?"24px":"8px 16px"},dragControls:L,dragConstraints:H,onDragEnd:function(){var e=s.getTranslateValues(V.current),t=e.x,n=e.y;t=function(e){var t=H.current.offsetWidth/2-V.current.offsetWidth/2;return e>0&&e>t?t:e<0&&e<-t?-t:e}(Math.round(t)),n=function(e){var t=H.current.offsetHeight/2-V.current.offsetHeight/2;return e>0&&e>t?t:e<0&&e<-t?-t:e}(Math.round(n)),O({position:{x:t,y:n}}),J({x:t,y:n})},ref:V},Z),v.default.createElement(n.StyledDynamicIslandTopContent,{isOpen:b,incoming:q,accepted:M,outgoing:N},v.default.createElement("div",{className:"relative w-12 h-12"},(q||N&&!M)&&v.default.createElement(f.framerMotion.exports.motion.div,{style:{animation:"ping 2s cubic-bezier(0, 0, 0.2, 1) infinite",borderRadius:"4px"},animate:b?"open":"closed",variants:$,className:"rounded-xl bg-white absolute opacity-60 -z-10 top-0 left-0 animate-ping h-12 w-12"}),v.default.createElement(y,{className:"z-10 h-12 w-12 bg-gray-300 rounded-sm",animate:b?"open":"closed",variants:$})),v.default.createElement("div",null,b&&v.default.createElement(E,{initial:{opacity:0},animate:{opacity:1}},v.default.createElement(n.StyledSongName,null,P&&P),v.default.createElement(n.StyledArtistName,null,M?v.default.createElement(i.default,{date:R||(new Date).getTime()/1e3,interval:1e3,format:"hh:mm:ss",trim:"mid",unix:!0,durationFromNow:!0}):v.default.createElement(v.default.Fragment,null,z&&z)))),M&&v.default.createElement(c.AudioBars,{audioStream:te})),b&&v.default.createElement("div",{className:"grid gap-y-5"},M&&v.default.createElement("div",{className:"grid grid-cols-4 auto-cols-max gap-y-5 justify-items-center place-items-center justify-center"},v.default.createElement(d.Button,{variant:"default",active:!!D,onClick:function(){return D?m.unpauseCurrentCall():m.pauseCurrentCall()}},D?v.default.createElement(a.FontAwesomeIcon,{size:"xl",icon:r.faPlay}):v.default.createElement(a.FontAwesomeIcon,{size:"xl",icon:r.faPause})),v.default.createElement(d.Button,{variant:"default",active:!!_,onClick:function(){return _?m.unmuteCurrentCall():m.muteCurrentCall()}},_?v.default.createElement(a.FontAwesomeIcon,{size:"xl",icon:r.faMicrophoneSlash}):v.default.createElement(a.FontAwesomeIcon,{size:"xl",icon:r.faMicrophone})),v.default.createElement(d.Button,{variant:"default"},v.default.createElement(a.FontAwesomeIcon,{size:"xl",icon:r.faRightLeft})),v.default.createElement(d.Button,{variant:"neutral"},v.default.createElement(a.FontAwesomeIcon,{size:"xl",icon:r.faChevronDown}))),v.default.createElement(f.framerMotion.exports.motion.div,{className:"grid ".concat(Y()?"grid-cols-2":M?"grid-cols-1 justify-items-center":"grid-cols-1 justify-items-end"," gap-3.5"),animate:{opacity:1}},v.default.createElement(d.Button,{onClick:function(e){e.stopPropagation(),m.hangupCurrentCall()},variant:"red"},v.default.createElement(a.FontAwesomeIcon,{className:"rotate-135",size:"2x",icon:r.faPhone})),Y()&&v.default.createElement(d.Button,{onClick:function(e){m.answerIncomingCall()},variant:"green"},v.default.createElement(a.FontAwesomeIcon,{size:"2x",icon:r.faPhone}))))),v.default.createElement("div",{className:"hidden"},v.default.createElement("audio",{autoPlay:!0,ref:ae}),v.default.createElement("audio",{autoPlay:!0,ref:re}),v.default.createElement("video",{muted:!0,autoPlay:!0,ref:oe}),v.default.createElement("video",{autoPlay:!0,ref:ie})))};S.displayName="Island",exports.Island=S;
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 } from 'react'\nimport {\n StyledAlbumArtThumb,\n StyledArtistDetails,\n StyledArtistName,\n StyledDynamicIsland,\n StyledDynamicIslandTopContent,\n StyledMusicIcon,\n StyledMusicIconBar,\n StyledPlayBar,\n StyledPlayBarWrapper,\n StyledSongControls,\n StyledSongControlsWrappers,\n StyledSongName,\n} from '../styles/Island.styles'\nimport { useSelector } from 'react-redux'\nimport { RootState } from '../store'\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\nimport {\n faBackward,\n faPause,\n faForward,\n faCompactDisc,\n faPhone,\n faMicrophone,\n faRightLeft,\n faChevronDown,\n faChevronUp,\n} from '@fortawesome/free-solid-svg-icons'\nimport { motion, useDragControls, useAnimation } from 'framer-motion/dist/framer-motion'\nimport { hangupCurrentCall, answerIncomingCall } from '../lib/phone/call'\nimport { useLongPress } from '../utils/useLongPress'\nimport Moment from 'react-moment'\nimport { useLocalStorage } from '../utils/useLocalStorage'\n\nimport { AudioBars } from './AudioBars'\n\nimport { getTranslateValues } from '../utils/getTranslate'\nimport { Button } from './Button'\n\nconst StyledDynamicIslandMotion = motion(StyledDynamicIsland)\nconst StyledMusicIconBarMotion = motion(StyledMusicIconBar)\nconst StyledMusicAlbumArtThumbMotion = motion(StyledAlbumArtThumb)\nconst StyledMusicIconMotion = motion(StyledMusicIcon)\nconst StyledArtistDetailsMotion = motion(StyledArtistDetails)\n\ninterface IslandProps {\n always?: boolean\n}\n\ninterface PositionTypes {\n x: number\n y: number\n}\n\ninterface PhoneIslandStorageTypes {\n position: PositionTypes\n}\n\nconst ISLAND_STARTING_POSITION = {\n x: 0,\n y: 0,\n}\n\nexport const Island = ({ always }: IslandProps) => {\n const [isOpen, setIsOpen] = useState(true)\n const { incoming, accepted, outgoing, displayName, number, startTime } = useSelector(\n // ADD ACCEPTED\n (state: RootState) => state.currentCall,\n )\n\n const { audio } = useSelector(\n // ADD ACCEPTED\n (state: RootState) => state.player,\n )\n const controls = useDragControls()\n\n const [phoneIslandStorage, setPhoneIslandStorage] =\n useLocalStorage<PhoneIslandStorageTypes | null>('phone-island', null)\n\n const islandRef = useRef<any>(null)\n\n const islandContainerRef = useRef<any>(null)\n\n const [position, setPosition] = useState<PositionTypes | null>(\n phoneIslandStorage && phoneIslandStorage.position ? phoneIslandStorage.position : null,\n )\n\n const [moved, setMoved] = useState<boolean>(false)\n\n function isAnswerVisible() {\n return !outgoing && !accepted\n }\n\n function startDrag(event) {\n controls.start(event)\n }\n\n function handleAnswer(event) {\n answerIncomingCall()\n }\n\n function handleHangup(event) {\n event.stopPropagation()\n hangupCurrentCall()\n }\n\n const onLongPress = () => {\n console.log('long press trigger')\n }\n\n const islandClick = () => {\n setIsOpen(!isOpen)\n }\n\n function innerXPosition(x) {\n // Get horizontal constraints\n const xConstraintPosition =\n islandContainerRef.current.offsetWidth / 2 - islandRef.current.offsetWidth / 2\n\n // Return the X position inside the constraints\n return x > 0 && x > xConstraintPosition\n ? xConstraintPosition\n : x < 0 && x < -xConstraintPosition\n ? -xConstraintPosition\n : x\n }\n\n function innerYPosition(y) {\n // Get vertical constraints\n const yConstraintPosition =\n islandContainerRef.current.offsetHeight / 2 - islandRef.current.offsetHeight / 2\n\n // Return the Y position inside the constraints\n return y > 0 && y > yConstraintPosition\n ? yConstraintPosition\n : y < 0 && y < -yConstraintPosition\n ? -yConstraintPosition\n : y\n }\n\n const onDragEnd = () => {\n // Get initial translation values\n let { x, y }: any = getTranslateValues(islandRef.current)\n\n // Round position\n x = innerXPosition(Math.round(x))\n y = innerYPosition(Math.round(y))\n\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 function resetMoved() {\n setMoved(false)\n }\n\n function dragStarted() {\n setMoved(true)\n }\n\n const longPressEvent = useLongPress(onLongPress, islandClick, moved, resetMoved, {\n shouldPreventDefault: true,\n delay: 250,\n })\n\n const variants = {\n openIncoming: {\n width: '418px',\n height: '96px',\n borderRadius: '20px',\n },\n openAccepted: {\n width: '348px',\n height: '236px',\n borderRadius: '20px',\n },\n closed: {\n width: '156px',\n height: '36px',\n borderRadius: '99px',\n },\n }\n\n const iconVariants = {\n open: {\n width: '48px',\n height: '48px',\n borderRadius: '12px',\n margin: '0 auto',\n },\n closed: {\n width: '20px',\n height: '20px',\n borderRadius: '4px',\n },\n }\n\n const [audioStream, setAudioStream] = useState<MediaStream | null>(null)\n\n useEffect(() => {\n const audioStreamListener = audio?.addEventListener('play', () => {\n if (navigator.userAgent.indexOf('Firefox') > -1) {\n // @ts-ignore\n setAudioStream(audio.mozCaptureStream())\n } else {\n // @ts-ignore\n setAudioStream(audio.captureStream())\n }\n })\n\n return () => {\n // @ts-ignore\n audio?.removeEventListener('play', audioStreamListener)\n }\n }, [audio])\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 {/* <div className='bg-black h-72 w-72 flex justify-center '>\n <AudioBars audioStream={audioStream} />\n </div> */}\n\n {(incoming || outgoing || accepted || always) && (\n <StyledDynamicIslandMotion\n className='font-sans absolute pointer-events-auto'\n incoming={incoming}\n accepted={accepted}\n outgoing={outgoing}\n isOpen={isOpen}\n animate={\n isOpen && (incoming || outgoing) && !accepted\n ? 'openIncoming'\n : isOpen && accepted\n ? 'openAccepted'\n : 'closed'\n }\n variants={variants}\n drag\n onPointerDown={startDrag}\n onDragStart={dragStarted}\n dragTransition={{\n power: 0,\n }}\n initial={{\n x: position?.x || ISLAND_STARTING_POSITION.x,\n y: position?.y || ISLAND_STARTING_POSITION.y,\n }}\n style={{\n padding: isOpen ? '24px' : '8px 16px',\n }}\n dragControls={controls}\n dragConstraints={islandContainerRef}\n onDragEnd={onDragEnd}\n ref={islandRef}\n {...longPressEvent}\n >\n <StyledDynamicIslandTopContent\n isOpen={isOpen}\n incoming={incoming}\n accepted={accepted}\n outgoing={outgoing}\n >\n <div className='relative w-12 h-12'>\n {(incoming || outgoing) && (\n <motion.div\n style={{\n animation: 'ping 2s cubic-bezier(0, 0, 0.2, 1) infinite',\n borderRadius: '4px',\n }}\n animate={isOpen ? 'open' : 'closed'}\n variants={iconVariants}\n className={`rounded-xl bg-white absolute opacity-60 -z-10 top-0 left-0 animate-ping h-12 w-12`}\n ></motion.div>\n )}\n <StyledMusicAlbumArtThumbMotion\n className='z-10 h-12 w-12'\n animate={isOpen ? 'open' : 'closed'}\n variants={iconVariants}\n src='https://images.unsplash.com/photo-1500462918059-b1a0cb512f1d?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=387&q=80'\n />\n </div>\n <div>\n {isOpen && (\n <StyledArtistDetailsMotion initial={{ opacity: 0 }} animate={{ opacity: 1 }}>\n <StyledSongName>{displayName && displayName}</StyledSongName>\n <StyledArtistName>\n {accepted ? (\n <Moment\n date={startTime}\n interval={1000}\n format='hh:mm:ss'\n trim='mid'\n unix\n durationFromNow\n />\n ) : (\n <>{number && number}</>\n )}\n </StyledArtistName>\n </StyledArtistDetailsMotion>\n )}\n </div>\n {accepted && <AudioBars audioStream={audioStream} />}\n {/* <StyledMusicIconMotion animate={{ opacity: isOpen ? [0, 1] : 1 }}>\n <StyledMusicIconBarMotion\n initial={{ height: '0' }}\n animate={{ height: '100%' }}\n transition={{ duration: 1, delay: 0.5, repeat: Infinity }}\n />\n <StyledMusicIconBarMotion\n initial={{ height: '0' }}\n animate={{ height: '100%' }}\n transition={{ duration: 1, delay: 0.75, repeat: Infinity }}\n />\n <StyledMusicIconBarMotion\n initial={{ height: '0' }}\n animate={{ height: '75%' }}\n transition={{ duration: 1, delay: 0.3, repeat: Infinity }}\n />\n </StyledMusicIconMotion> */}\n </StyledDynamicIslandTopContent>\n {isOpen && (\n <div className='grid gap-y-5'>\n {/* <StyledPlayBarWrapper>\n <span>2:30</span>\n <StyledPlayBar />\n <span>-1:35</span>\n </StyledPlayBarWrapper>\n <StyledSongControlsWrappers>\n <StyledSongControls>\n <FontAwesomeIcon size='2x' icon={faBackward} />\n <FontAwesomeIcon size='3x' icon={faPause} />\n <FontAwesomeIcon size='2x' icon={faForward} />\n </StyledSongControls>\n <div>\n <FontAwesomeIcon size='2x' icon={faCompactDisc} />\n </div>\n </StyledSongControlsWrappers> */}\n {accepted && (\n <div className='grid grid-cols-4 auto-cols-max gap-y-5 justify-items-center place-items-center justify-center'>\n <Button variant='default'>\n <FontAwesomeIcon size='xl' icon={faPause} />\n </Button>\n <Button variant='default'>\n <FontAwesomeIcon size='xl' icon={faMicrophone} />\n </Button>\n <Button variant='default'>\n <FontAwesomeIcon size='xl' icon={faRightLeft} />\n </Button>\n <Button variant='neutral'>\n <FontAwesomeIcon size='xl' icon={faChevronDown} />\n </Button>\n </div>\n )}\n <motion.div\n className={`grid ${\n isAnswerVisible()\n ? 'grid-cols-2'\n : accepted\n ? 'grid-cols-1 justify-items-center'\n : 'grid-cols-1 justify-items-end'\n } gap-3.5`}\n animate={{ opacity: 1 }}\n >\n <Button onClick={handleHangup} variant='red'>\n <FontAwesomeIcon className='rotate-135' size='2x' icon={faPhone} />\n </Button>\n {isAnswerVisible() && (\n <Button onClick={handleAnswer} variant='green'>\n <FontAwesomeIcon size='2x' icon={faPhone} />\n </Button>\n )}\n </motion.div>\n </div>\n )}\n </StyledDynamicIslandMotion>\n )}\n <audio id='audio' className='hidden' autoPlay></audio>\n <video id='localVideo' className='hidden' muted={true} autoPlay></video>\n <video id='remoteVideo' className='hidden' autoPlay></video>\n </div>\n )\n}\n\nIsland.displayName = 'Island'\n"],"names":["StyledDynamicIslandMotion","motion","StyledDynamicIsland","framerMotion","exports","StyledMusicIconBar","StyledMusicAlbumArtThumbMotion","StyledAlbumArtThumb","StyledMusicIcon","StyledArtistDetailsMotion","StyledArtistDetails","ISLAND_STARTING_POSITION","Island","_a","always","_b","useState","isOpen","setIsOpen","_c","useSelector","state","currentCall","incoming","accepted","outgoing","displayName","number","startTime","audio","player","controls","useDragControls","_d","useLocalStorage","phoneIslandStorage","setPhoneIslandStorage","islandRef","useRef","islandContainerRef","_e","position","setPosition","_f","moved","setMoved","isAnswerVisible","longPressEvent","useLongPress","console","log","shouldPreventDefault","delay","iconVariants","open","width","height","borderRadius","margin","closed","_g","audioStream","setAudioStream","useEffect","audioStreamListener","addEventListener","navigator","userAgent","indexOf","mozCaptureStream","captureStream","removeEventListener","React","ref","className","__assign","animate","variants","openIncoming","openAccepted","drag","onPointerDown","event","start","onDragStart","dragTransition","power","initial","x","y","style","padding","dragControls","dragConstraints","onDragEnd","getTranslateValues","current","xConstraintPosition","offsetWidth","innerXPosition","Math","round","yConstraintPosition","offsetHeight","innerYPosition","createElement","StyledDynamicIslandTopContent","div","animation","src","opacity","StyledSongName","StyledArtistName","Moment","date","interval","format","trim","unix","durationFromNow","Fragment","AudioBars","Button","variant","FontAwesomeIcon","size","icon","faPause","faMicrophone","faRightLeft","faChevronDown","concat","onClick","stopPropagation","hangupCurrentCall","faPhone","answerIncomingCall","id","autoPlay","muted"],"mappings":"m4BA2CMA,EAA4BC,EAAAA,aAAAA,QAAAA,OAAOC,EAAAA,qBACRD,EAAME,aAAAC,QAAAH,OAACI,sBACxC,IAAMC,EAAiCL,EAAAA,aAAAA,QAAAA,OAAOM,EAAAA,qBAChBN,EAAME,aAAAC,QAAAH,OAACO,mBACrC,IAAMC,EAA4BR,EAAAA,aAAAA,QAAAA,OAAOS,EAAAA,qBAenCC,EACD,EADCA,EAED,EAGQC,EAAS,SAACC,GAAE,IAAAC,EAAMD,E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D,UAAU,SAASiE,OAAO,EAAMD,UAAiB,IACxElE,EAAAA,QAAAiC,cAAA,QAAA,CAAOgC,GAAG,cAAc/D,UAAU,SAASgE,UAAQ,IAGzD,EAEA9H,EAAOc,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 } from 'react'\nimport {\n StyledAlbumArtThumb,\n StyledArtistDetails,\n StyledArtistName,\n StyledDynamicIsland,\n StyledDynamicIslandTopContent,\n StyledMusicIcon,\n StyledMusicIconBar,\n StyledPlayBar,\n StyledPlayBarWrapper,\n StyledSongControls,\n StyledSongControlsWrappers,\n StyledSongName,\n} from '../styles/Island.styles'\nimport { useSelector, useDispatch } from 'react-redux'\nimport { RootState } from '../store'\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\nimport {\n faBackward,\n faPause,\n faForward,\n faCompactDisc,\n faPhone,\n faMicrophone,\n faMicrophoneSlash,\n faRightLeft,\n faChevronDown,\n faPlay,\n faChevronUp,\n} from '@fortawesome/free-solid-svg-icons'\nimport { motion, useDragControls, useAnimation } from 'framer-motion/dist/framer-motion'\nimport { useLongPress } from '../utils/useLongPress'\nimport Moment from 'react-moment'\nimport { useLocalStorage, getTranslateValues } from '../utils'\nimport { AudioBars } from './AudioBars'\nimport { Button } from './Button'\nimport {\n hangupCurrentCall,\n answerIncomingCall,\n muteCurrentCall,\n unmuteCurrentCall,\n pauseCurrentCall,\n unpauseCurrentCall,\n} from '../lib/phone/call'\n\nconst StyledDynamicIslandMotion = motion(StyledDynamicIsland)\nconst StyledMusicIconBarMotion = motion(StyledMusicIconBar)\nconst StyledMusicAlbumArtThumbMotion = motion(StyledAlbumArtThumb)\nconst StyledMusicIconMotion = motion(StyledMusicIcon)\nconst StyledArtistDetailsMotion = motion(StyledArtistDetails)\n\nimport { useIsomorphicLayoutEffect } from '../utils'\n\ninterface IslandProps {\n always?: boolean\n}\n\ninterface PositionTypes {\n x: number\n y: number\n}\n\ninterface PhoneIslandStorageTypes {\n position: PositionTypes\n}\n\nconst ISLAND_STARTING_POSITION = {\n x: 0,\n y: 0,\n}\n\nexport const Island = ({ always }: IslandProps) => {\n const [isOpen, setIsOpen] = useState(true)\n // Get the currentCall info\n const { incoming, accepted, outgoing, displayName, number, startTime, muted, paused } =\n useSelector((state: RootState) => state.currentCall)\n\n const { localAudio: storeLocalAudio, remoteAudio: storeRemoteAudio } = useSelector(\n (state: RootState) => state.player,\n )\n const controls = useDragControls()\n\n const [phoneIslandStorage, setPhoneIslandStorage] =\n useLocalStorage<PhoneIslandStorageTypes | null>('phone-island', null)\n\n const islandRef = useRef<any>(null)\n\n const islandContainerRef = useRef<any>(null)\n\n const [position, setPosition] = useState<PositionTypes | null>(\n phoneIslandStorage && phoneIslandStorage.position ? phoneIslandStorage.position : null,\n )\n\n const [moved, setMoved] = useState<boolean>(false)\n\n const dispatch = useDispatch()\n\n function isAnswerVisible() {\n return !outgoing && !accepted\n }\n\n function startDrag(event) {\n controls.start(event)\n }\n\n function handleAnswer(event) {\n answerIncomingCall()\n }\n\n function handleHangup(event) {\n event.stopPropagation()\n hangupCurrentCall()\n }\n\n const onLongPress = () => {\n console.log('long press trigger')\n }\n\n const islandClick = () => {\n setIsOpen(!isOpen)\n }\n\n function innerXPosition(x) {\n // Get horizontal constraints\n const xConstraintPosition =\n islandContainerRef.current.offsetWidth / 2 - islandRef.current.offsetWidth / 2\n\n // Return the X position inside the constraints\n return x > 0 && x > xConstraintPosition\n ? xConstraintPosition\n : x < 0 && x < -xConstraintPosition\n ? -xConstraintPosition\n : x\n }\n\n function innerYPosition(y) {\n // Get vertical constraints\n const yConstraintPosition =\n islandContainerRef.current.offsetHeight / 2 - islandRef.current.offsetHeight / 2\n\n // Return the Y position inside the constraints\n return y > 0 && y > yConstraintPosition\n ? yConstraintPosition\n : y < 0 && y < -yConstraintPosition\n ? -yConstraintPosition\n : y\n }\n\n const onDragEnd = () => {\n // Get initial translation values\n let { x, y }: any = getTranslateValues(islandRef.current)\n\n // Round position\n x = innerXPosition(Math.round(x))\n y = innerYPosition(Math.round(y))\n\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 function resetMoved() {\n setMoved(false)\n }\n\n function dragStarted() {\n setMoved(true)\n }\n\n const longPressEvent = useLongPress(onLongPress, islandClick, moved, resetMoved, {\n shouldPreventDefault: true,\n delay: 250,\n })\n\n const variants = {\n openIncoming: {\n width: '418px',\n height: '96px',\n borderRadius: '20px',\n },\n openAccepted: {\n width: '348px',\n height: '236px',\n borderRadius: '20px',\n },\n closed: {\n width: '156px',\n height: '36px',\n borderRadius: '99px',\n },\n }\n\n const iconVariants = {\n open: {\n width: '48px',\n height: '48px',\n borderRadius: '12px',\n margin: '0 auto',\n },\n closed: {\n width: '20px',\n height: '20px',\n borderRadius: '4px',\n },\n }\n\n const [audioStream, setAudioStream] = useState<MediaStream | null>(null)\n\n useEffect(() => {\n function audioStreamListener() {\n storeRemoteAudio?.addEventListener('play', () => {\n if (navigator.userAgent.indexOf('Firefox') > -1) {\n // @ts-ignore\n setAudioStream(storeRemoteAudio.mozCaptureStream())\n } else {\n // @ts-ignore\n setAudioStream(storeRemoteAudio.captureStream())\n }\n })\n }\n audioStreamListener()\n return () => {\n storeRemoteAudio?.removeEventListener('play', audioStreamListener)\n }\n }, [storeRemoteAudio])\n\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 localAudio: localAudio.current,\n localVideo: localVideo.current,\n remoteVideo: remoteVideo.current,\n remoteAudio: remoteAudio.current,\n })\n }, [])\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 {/* <div className='bg-black h-72 w-72 flex justify-center '>\n <AudioBars audioStream={audioStream} />\n </div> */}\n\n {(incoming || outgoing || accepted || always) && (\n <StyledDynamicIslandMotion\n className='font-sans absolute pointer-events-auto'\n incoming={incoming}\n accepted={accepted}\n outgoing={outgoing}\n isOpen={isOpen}\n animate={\n isOpen && (incoming || outgoing) && !accepted\n ? 'openIncoming'\n : isOpen && accepted\n ? 'openAccepted'\n : 'closed'\n }\n variants={variants}\n drag\n onPointerDown={startDrag}\n onDragStart={dragStarted}\n dragTransition={{\n power: 0,\n }}\n initial={{\n x: position?.x || ISLAND_STARTING_POSITION.x,\n y: position?.y || ISLAND_STARTING_POSITION.y,\n }}\n style={{\n padding: isOpen ? '24px' : '8px 16px',\n }}\n dragControls={controls}\n dragConstraints={islandContainerRef}\n onDragEnd={onDragEnd}\n ref={islandRef}\n {...longPressEvent}\n >\n <StyledDynamicIslandTopContent\n isOpen={isOpen}\n incoming={incoming}\n accepted={accepted}\n outgoing={outgoing}\n >\n <div className='relative w-12 h-12'>\n {(incoming || (outgoing && !accepted)) && (\n <motion.div\n style={{\n animation: 'ping 2s cubic-bezier(0, 0, 0.2, 1) infinite',\n borderRadius: '4px',\n }}\n animate={isOpen ? 'open' : 'closed'}\n variants={iconVariants}\n className={`rounded-xl bg-white absolute opacity-60 -z-10 top-0 left-0 animate-ping h-12 w-12`}\n ></motion.div>\n )}\n <StyledMusicAlbumArtThumbMotion\n className='z-10 h-12 w-12 bg-gray-300 rounded-sm'\n animate={isOpen ? 'open' : 'closed'}\n variants={iconVariants}\n />\n </div>\n <div>\n {isOpen && (\n <StyledArtistDetailsMotion initial={{ opacity: 0 }} animate={{ opacity: 1 }}>\n <StyledSongName>{displayName && displayName}</StyledSongName>\n <StyledArtistName>\n {accepted ? (\n <Moment\n date={startTime || new Date().getTime() / 1000}\n interval={1000}\n format='hh:mm:ss'\n trim='mid'\n unix\n durationFromNow\n />\n ) : (\n <>{number && number}</>\n )}\n </StyledArtistName>\n </StyledArtistDetailsMotion>\n )}\n </div>\n {accepted && <AudioBars audioStream={audioStream} />}\n {/* <StyledMusicIconMotion animate={{ opacity: isOpen ? [0, 1] : 1 }}>\n <StyledMusicIconBarMotion\n initial={{ height: '0' }}\n animate={{ height: '100%' }}\n transition={{ duration: 1, delay: 0.5, repeat: Infinity }}\n />\n <StyledMusicIconBarMotion\n initial={{ height: '0' }}\n animate={{ height: '100%' }}\n transition={{ duration: 1, delay: 0.75, repeat: Infinity }}\n />\n <StyledMusicIconBarMotion\n initial={{ height: '0' }}\n animate={{ height: '75%' }}\n transition={{ duration: 1, delay: 0.3, repeat: Infinity }}\n />\n </StyledMusicIconMotion> */}\n </StyledDynamicIslandTopContent>\n {isOpen && (\n <div className='grid gap-y-5'>\n {/* <StyledPlayBarWrapper>\n <span>2:30</span>\n <StyledPlayBar />\n <span>-1:35</span>\n </StyledPlayBarWrapper>\n <StyledSongControlsWrappers>\n <StyledSongControls>\n <FontAwesomeIcon size='2x' icon={faBackward} />\n <FontAwesomeIcon size='3x' icon={faPause} />\n <FontAwesomeIcon size='2x' icon={faForward} />\n </StyledSongControls>\n <div>\n <FontAwesomeIcon size='2x' icon={faCompactDisc} />\n </div>\n </StyledSongControlsWrappers> */}\n {accepted && (\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={faPause} />\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={faMicrophone} />\n )}\n </Button>\n <Button variant='default'>\n <FontAwesomeIcon size='xl' icon={faRightLeft} />\n </Button>\n <Button variant='neutral'>\n <FontAwesomeIcon size='xl' icon={faChevronDown} />\n </Button>\n </div>\n )}\n <motion.div\n className={`grid ${\n isAnswerVisible()\n ? 'grid-cols-2'\n : accepted\n ? 'grid-cols-1 justify-items-center'\n : 'grid-cols-1 justify-items-end'\n } gap-3.5`}\n animate={{ opacity: 1 }}\n >\n <Button onClick={handleHangup} variant='red'>\n <FontAwesomeIcon className='rotate-135' size='2x' icon={faPhone} />\n </Button>\n {isAnswerVisible() && (\n <Button onClick={handleAnswer} variant='green'>\n <FontAwesomeIcon size='2x' icon={faPhone} />\n </Button>\n )}\n </motion.div>\n </div>\n )}\n </StyledDynamicIslandMotion>\n )}\n <div className='hidden'>\n <audio autoPlay 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"],"names":["StyledDynamicIslandMotion","motion","StyledDynamicIsland","framerMotion","exports","StyledMusicIconBar","StyledMusicAlbumArtThumbMotion","StyledAlbumArtThumb","StyledMusicIcon","StyledArtistDetailsMotion","StyledArtistDetails","ISLAND_STARTING_POSITION","Island","_a","always","_b","useState","isOpen","setIsOpen","_c","useSelector","state","currentCall","incoming","accepted","outgoing","displayName","number","startTime","muted","paused","_d","player","storeRemoteAudio","controls","useDragControls","_e","useLocalStorage","phoneIslandStorage","setPhoneIslandStorage","islandRef","useRef","islandContainerRef","_f","position","setPosition","_g","moved","setMoved","dispatch","useDispatch","isAnswerVisible","longPressEvent","useLongPress","console","log","shouldPreventDefault","delay","iconVariants","open","width","height","borderRadius","margin","closed","_h","audioStream","setAudioStream","useEffect","audioStreamListener","addEventListener","navigator","userAgent","indexOf","mozCaptureStream","captureStream","removeEventListener","localAudio","remoteAudio","localVideo","remoteVideo","useIsomorphicLayoutEffect","updatePlayer","current","React","ref","className","__assign","animate","variants","openIncoming","openAccepted","drag","onPointerDown","event","start","onDragStart","dragTransition","power","initial","x","y","style","padding","dragControls","dragConstraints","onDragEnd","getTranslateValues","xConstraintPosition","offsetWidth","innerXPosition","Math","round","yConstraintPosition","offsetHeight","innerYPosition","createElement","StyledDynamicIslandTopContent","div","animation","opacity","StyledSongName","StyledArtistName","Moment","date","Date","getTime","interval","format","trim","unix","durationFromNow","Fragment","AudioBars","Button","variant","active","onClick","unpauseCurrentCall","pauseCurrentCall","FontAwesomeIcon","size","icon","faPlay","faPause","unmuteCurrentCall","muteCurrentCall","faMicrophoneSlash","faMicrophone","faRightLeft","faChevronDown","concat","stopPropagation","hangupCurrentCall","faPhone","answerIncomingCall","autoPlay"],"mappings":"whCAiDMA,EAA4BC,EAAAA,aAAAA,QAAAA,OAAOC,EAAAA,qBACRD,EAAME,aAAAC,QAAAH,OAACI,sBACxC,IAAMC,EAAiCL,EAAAA,aAAAA,QAAAA,OAAOM,EAAAA,qBAChBN,EAAME,aAAAC,QAAAH,OAACO,mBACrC,IAAMC,EAA4BR,EAAAA,aAAAA,QAAAA,OAAOS,EAAAA,qBAiBnCC,EACD,EADCA,EAED,EAGQC,EAAS,SAACC,GAAE,IAAAC,EAAMD,EAAAC,OACvBC,EAAsBC,EAAAA,UAAS,GAA9BC,EAAMF,EAAA,GAAEG,EAASH,EAAA,GAElBI,EACJC,EAAAA,aAAY,SAACC,GAAqB,OAAAA,EAAMC,eADlCC,aAAUC,EAAQL,EAAAK,SAAEC,EAAQN,EAAAM,SAAEC,EAAWP,EAAAO,YAAEC,EAAMR,EAAAQ,OAAEC,cAAWC,UAAOC,WAGvEC,EAAiEX,EAAWA,aAChF,SAACC,GAAqB,OAAAA,EAAMW,MAAN,iBAD0B,IAAAC,gBAG5CC,EAAWC,EAAAA,aAAAA,QAAAA,kBAEXC,EACJC,EAAAA,gBAAgD,eAAgB,MAD3DC,EAAkBF,EAAA,GAA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AAAA,QAAAgC,cAACwB,kBAAgB,CAAAC,KAAK,KAAKC,KAAMY,EAAAA,cAQ/CtE,EAAAA,QAAKgC,cAAA,MAAA,CAAA9B,UAAU,UACbF,EAAA,QAAAgC,cAAA,QAAA,CAAOwC,UAAQ,EAACvE,IAAKR,KACrBO,EAAA,QAAAgC,cAAA,QAAA,CAAOwC,UAAQ,EAACvE,IAAKP,KACrBM,UAAOgC,cAAA,QAAA,CAAAvF,OAAO,EAAM+H,UAAS,EAAAvE,IAAKN,KAClCK,UAAOgC,cAAA,QAAA,CAAAwC,YAASvE,IAAKL,MAI7B,EAEApE,EAAOc,YAAc"}
@@ -0,0 +1,9 @@
1
+ import { type ReactNode, type FC } from 'react';
2
+ export declare const RestAPI: FC<RestAPIProps>;
3
+ interface RestAPIProps {
4
+ children: ReactNode;
5
+ hostName: string;
6
+ username: string;
7
+ authToken: string;
8
+ }
9
+ export {};
@@ -0,0 +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/axios/index.js");var r=require("../services/user.js");require("../node_modules/react-redux/es/index.js");var s=require("../node_modules/axios/lib/axios.js"),u=require("../node_modules/react-redux/es/hooks/useDispatch.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=n(t);exports.RestAPI=function(n){var o=n.hostName,i=n.username,d=n.authToken,c=n.children,l=u.useDispatch();return t.useEffect((function(){s.default.defaults.baseURL="https://".concat(o,"/webrest"),s.default.defaults.headers.common.Authorization="".concat(i,":").concat(d),s.default.defaults.headers.post["Content-Type"]="application/json",function(){e.__awaiter(this,void 0,void 0,(function(){var t;return e.__generator(this,(function(e){switch(e.label){case 0:return[4,r.getCurrentUserInfo()];case 1:return null!=(t=e.sent())&&l.currentUser.updateCurrentUser(t),[2]}}))}))}()}),[]),a.default.createElement(a.default.Fragment,null,c)};
2
+ //# sourceMappingURL=RestAPI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RestAPI.js","sources":["../../src/components/RestAPI.tsx"],"sourcesContent":["// Copyright (C) 2022 Nethesis S.r.l.\n// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport React, { type ReactNode, type FC, useEffect } from 'react'\nimport axios from 'axios'\nimport { getCurrentUserInfo } from '../services/user'\nimport { useDispatch, useSelector } from 'react-redux'\n\nexport const RestAPI: FC<RestAPIProps> = ({ hostName, username, authToken, children }) => {\n const dispatch = useDispatch()\n\n useEffect(() => {\n // Initialize axios\n axios.defaults.baseURL = `https://${hostName}/webrest`\n axios.defaults.headers.common['Authorization'] = `${username}:${authToken}`\n axios.defaults.headers.post['Content-Type'] = 'application/json'\n\n async function initUserInfo() {\n const userInfo = await getCurrentUserInfo()\n if (userInfo != undefined) {\n dispatch.currentUser.updateCurrentUser(userInfo)\n }\n }\n initUserInfo()\n }, [])\n\n return <>{children}</>\n}\n\ninterface RestAPIProps {\n children: ReactNode\n hostName: string\n username: string\n authToken: string\n}\n"],"names":["_a","hostName","username","authToken","children","dispatch","useDispatch","useEffect","axios","defaults","baseURL","concat","headers","common","post","getCurrentUserInfo","undefined","userInfo","sent","currentUser","updateCurrentUser","initUserInfo","React","createElement","Fragment"],"mappings":"qeAQyC,SAACA,OAAEC,EAAQD,EAAAC,SAAEC,EAAQF,EAAAE,SAAEC,EAASH,EAAAG,UAAEC,EAAQJ,EAAAI,SAC3EC,EAAWC,EAAAA,cAiBjB,OAfAC,EAAAA,WAAU,WAERC,EAAK,QAACC,SAASC,QAAU,WAAWC,OAAAV,cACpCO,EAAAA,QAAMC,SAASG,QAAQC,OAAsB,cAAI,GAAGF,OAAAT,EAAY,KAAAS,OAAAR,GAChEK,EAAK,QAACC,SAASG,QAAQE,KAAK,gBAAkB,mBAE9C,0HACmB,MAAM,CAAA,EAAAC,EAAAA,oCACPC,OADVC,EAAWjB,EAA0BkB,SAEzCb,EAASc,YAAYC,kBAAkBH,aAE1C,CACDI,EACD,GAAE,IAEIC,EAAAA,QAAAC,cAAAD,EAAAA,QAAAE,SAAA,KAAGpB,EACZ"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");require("../node_modules/react-redux/es/index.js");var t=require("../node_modules/socket.io-client/build/esm/index.js"),n=require("../static/incoming_ringtone.js"),o=require("../lib/phone/conversation.js"),r=require("../events/SocketEvents.js"),a=require("../node_modules/react-redux/es/hooks/useDispatch.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("../node_modules/react-redux/es/components/Context.js"),require("../node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js"),require("../node_modules/react-redux/node_modules/react-is/index.js");var s=c(e);exports.Socket=function(c){var i=c.hostName,u=c.username,l=c.authToken,d=c.children,p=a.useDispatch();return e.useEffect((function(){var e;(e=t.io(i,{upgrade:!1,transports:["websocket"],reconnection:!0,reconnectionDelay:2e3})).on("connect",(function(){console.log("Socket on: "+i+" is connected !"),e.emit("login",{accessKeyId:"".concat(u),token:l,uaType:"desktop"})})),e.on("authe_ok",(function(){console.log("auth_ok")})),e.on("userMainPresenceUpdate",(function(e){r.dispatchMainPresence(e)})),e.on("extenUpdate",(function(e){r.dispatchConversations(e),e.username===u&&function(e){var t=e.conversations[Object.keys(e.conversations)[0]]||{};if(Object.keys(t).length>0){var r=e.status;if(r)switch(r){case"ringing":p.currentCall.updateCurrentCall({displayName:o.getDisplayName(t),number:"".concat(t.counterpartNum),incoming:!0,ringing:!0}),p.player.updateAudioSource({src:n.default}),p.player.playAudio({loop:!0});break;case"busy":t&&t.connected?p.currentCall.updateCurrentCall({accepted:!0,incoming:!1,outgoing:!1,displayName:o.getDisplayName(t),number:"".concat(t.counterpartNum),startTime:"".concat(t.startTime/1e3)}):t&&!t.connected&&"out"===t.direction&&p.currentCall.updateCurrentCall({outgoing:!0,displayName:o.getDisplayName(t),number:"".concat(t.counterpartNum)})}}else console.log(e)}(e)}))}),[]),s.default.createElement(s.default.Fragment,null,d)};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");require("../node_modules/react-redux/es/index.js");var n=require("../node_modules/socket.io-client/build/esm/index.js"),t=require("../lib/phone/conversation.js");require("../store/index.js"),require("../node_modules/mic-check/lib/index.js"),require("../lib/webrtc/janus.js");var o=require("../events/SocketEvents.js"),r=require("../node_modules/react-redux/es/hooks/useDispatch.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("../node_modules/react-redux/es/components/Context.js"),require("../node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js"),require("../node_modules/react-redux/node_modules/react-is/index.js");var s=c(e);exports.Socket=function(c){var a=c.hostName,i=c.username,u=c.authToken,d=c.children,l=r.useDispatch();return e.useEffect((function(){var e;(e=n.io(a,{upgrade:!1,transports:["websocket"],reconnection:!0,reconnectionDelay:2e3})).on("connect",(function(){console.log("Socket on: "+a+" is connected !"),e.emit("login",{accessKeyId:"".concat(i),token:u,uaType:"desktop"})})),e.on("authe_ok",(function(){console.log("auth_ok")})),e.on("userMainPresenceUpdate",(function(e){o.dispatchMainPresence(e)})),e.on("extenUpdate",(function(e){o.dispatchConversations(e);var n=e.conversations[Object.keys(e.conversations)[0]]||{};e.username===i&&function(e,n){if(Object.keys(n).length>0){var o=e.status;if(o)switch(o){case"ringing":l.currentCall.checkIncomingUpdateAndPlay({displayName:t.getDisplayName(n),number:"".concat(n.counterpartNum),incomingSocket:!0});break;case"busy":n&&n.connected?l.currentCall.updateCurrentCall({accepted:!0,incoming:!1,outgoing:!1,displayName:t.getDisplayName(n),number:"".concat(n.counterpartNum),startTime:"".concat(n.startTime/1e3)}):n&&!n.connected&&"out"===n.direction&&l.currentCall.checkOutgoingUpdateAndPlay({outgoingSocket:!0,displayName:t.getDisplayName(n),number:"".concat(n.counterpartNum)})}}else console.error(e)}(e,n)}))}),[]),s.default.createElement(s.default.Fragment,null,d)};
2
2
  //# sourceMappingURL=Socket.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Socket.js","sources":["../../src/components/Socket.tsx"],"sourcesContent":["// Copyright (C) 2022 Nethesis S.r.l.\n// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport React, { type ReactNode, FC, useEffect, useState } from 'react'\nimport { useDispatch } from 'react-redux'\nimport { Dispatch } from '../store'\nimport { io } from 'socket.io-client'\nimport incomingRingtone from '../static/incoming_ringtone'\nimport { getDisplayName, type ConvType } from '../lib/phone/conversation'\nimport { dispatchMainPresence, dispatchConversations } from '../events/SocketEvents'\n\ninterface SocketProps {\n children: ReactNode\n hostName: string\n username: string\n authToken: string\n}\n\nexport const Socket: FC<SocketProps> = ({ hostName, username, authToken, children }) => {\n const dispatch = useDispatch<Dispatch>()\n\n useEffect(() => {\n const handleCalls = (res: any) => {\n // Initialize conversation\n const conv: ConvType = res.conversations[Object.keys(res.conversations)[0]] || {}\n // Check conversation isn't empty\n if (Object.keys(conv).length > 0) {\n const status: string = res.status\n if (status) {\n switch (status) {\n case 'ringing':\n dispatch.currentCall.updateCurrentCall({\n displayName: getDisplayName(conv),\n number: `${conv.counterpartNum}`,\n incoming: true,\n ringing: true,\n })\n dispatch.player.updateAudioSource({\n src: incomingRingtone,\n })\n dispatch.player.playAudio({\n loop: true,\n })\n\n break\n // @ts-ignore\n case 'busy':\n if (conv && conv.connected) {\n // Accepted call\n dispatch.currentCall.updateCurrentCall({\n accepted: true,\n incoming: false,\n outgoing: false,\n displayName: getDisplayName(conv),\n number: `${conv.counterpartNum}`,\n startTime: `${conv.startTime / 1000}`,\n })\n }\n // Handle outgoing call\n else if (conv && !conv.connected && conv.direction === 'out') {\n // Start an outgoing call\n dispatch.currentCall.updateCurrentCall({\n outgoing: true,\n displayName: getDisplayName(conv),\n number: `${conv.counterpartNum}`,\n })\n }\n default:\n break\n }\n }\n } else {\n console.log(res)\n }\n }\n\n const initWsConnection = () => {\n const socket = io(hostName, {\n upgrade: false,\n transports: ['websocket'],\n reconnection: true,\n reconnectionDelay: 2000,\n })\n\n socket.on('connect', () => {\n console.log('Socket on: ' + hostName + ' is connected !')\n socket.emit('login', {\n accessKeyId: `${username}`,\n token: authToken,\n uaType: 'desktop',\n })\n })\n\n socket.on('authe_ok', () => {\n console.log('auth_ok')\n })\n\n socket.on('userMainPresenceUpdate', (res) => {\n // Pass data to dispatchMainPresence\n dispatchMainPresence(res)\n })\n\n socket.on('extenUpdate', (res) => {\n // Call the dispatchConversations\n dispatchConversations(res)\n\n // Handle only the events of the user\n if (res.username === username) {\n handleCalls(res)\n }\n })\n }\n\n initWsConnection()\n }, [])\n\n return <>{children}</>\n}\n"],"names":["_a","hostName","username","authToken","children","dispatch","useDispatch","useEffect","socket","io","upgrade","transports","reconnection","reconnectionDelay","on","console","log","emit","accessKeyId","concat","token","uaType","res","dispatchMainPresence","dispatchConversations","conv","conversations","Object","keys","length","status_1","status","currentCall","updateCurrentCall","displayName","getDisplayName","number","counterpartNum","incoming","ringing","player","updateAudioSource","src","incomingRingtone","playAudio","loop","connected","accepted","outgoing","startTime","direction","handleCalls","React","createElement","Fragment"],"mappings":"gtBAkBuC,SAACA,OAAEC,EAAQD,EAAAC,SAAEC,EAAQF,EAAAE,SAAEC,EAASH,EAAAG,UAAEC,EAAQJ,EAAAI,SACzEC,EAAWC,EAAAA,cAiGjB,OA/FAC,EAAAA,WAAU,WACR,IAuDQC,KAASC,EAAEA,GAACR,EAAU,CAC1BS,SAAS,EACTC,WAAY,CAAC,aACbC,cAAc,EACdC,kBAAmB,OAGdC,GAAG,WAAW,WACnBC,QAAQC,IAAI,cAAgBf,EAAW,mBACvCO,EAAOS,KAAK,QAAS,CACnBC,YAAa,GAAGC,OAAAjB,GAChBkB,MAAOjB,EACPkB,OAAQ,WAEZ,IAEAb,EAAOM,GAAG,YAAY,WACpBC,QAAQC,IAAI,UACd,IAEAR,EAAOM,GAAG,0BAA0B,SAACQ,GAEnCC,EAAoBA,qBAACD,EACvB,IAEAd,EAAOM,GAAG,eAAe,SAACQ,GAExBE,EAAqBA,sBAACF,GAGlBA,EAAIpB,WAAaA,GArFL,SAACoB,GAEnB,IAAMG,EAAiBH,EAAII,cAAcC,OAAOC,KAAKN,EAAII,eAAe,KAAO,CAAA,EAE/E,GAAIC,OAAOC,KAAKH,GAAMI,OAAS,EAAG,CAChC,IAAMC,EAAiBR,EAAIS,OAC3B,GAAID,EACF,OAAQA,GACN,IAAK,UACHzB,EAAS2B,YAAYC,kBAAkB,CACrCC,YAAaC,EAAcA,eAACV,GAC5BW,OAAQ,GAAAjB,OAAGM,EAAKY,gBAChBC,UAAU,EACVC,SAAS,IAEXlC,EAASmC,OAAOC,kBAAkB,CAChCC,IAAKC,EAAgB,UAEvBtC,EAASmC,OAAOI,UAAU,CACxBC,MAAM,IAGR,MAEF,IAAK,OACCpB,GAAQA,EAAKqB,UAEfzC,EAAS2B,YAAYC,kBAAkB,CACrCc,UAAU,EACVT,UAAU,EACVU,UAAU,EACVd,YAAaC,EAAcA,eAACV,GAC5BW,OAAQ,GAAAjB,OAAGM,EAAKY,gBAChBY,UAAW,GAAG9B,OAAAM,EAAKwB,UAAY,OAI1BxB,IAASA,EAAKqB,WAAgC,QAAnBrB,EAAKyB,WAEvC7C,EAAS2B,YAAYC,kBAAkB,CACrCe,UAAU,EACVd,YAAaC,EAAcA,eAACV,GAC5BW,OAAQ,GAAAjB,OAAGM,EAAKY,kBAO3B,MACCtB,QAAQC,IAAIM,EAEhB,CAkCM6B,CAAY7B,EAEhB,GAIH,GAAE,IAEI8B,EAAAA,QAAAC,cAAAD,EAAAA,QAAAE,SAAA,KAAGlD,EACZ"}
1
+ {"version":3,"file":"Socket.js","sources":["../../src/components/Socket.tsx"],"sourcesContent":["// Copyright (C) 2022 Nethesis S.r.l.\n// SPDX-License-Identifier: AGPL-3.0-or-later\n\nimport React, { type ReactNode, FC, useEffect } from 'react'\nimport { useDispatch } from 'react-redux'\nimport { Dispatch, store } from '../store'\nimport { io } from 'socket.io-client'\nimport { getDisplayName, type ConvType } from '../lib/phone/conversation'\nimport { dispatchMainPresence, dispatchConversations } from '../events'\nimport type { ExtensionTypes, ExtensinTypeTypes } from '../services/user'\n\ninterface SocketProps {\n children: ReactNode\n hostName: string\n username: string\n authToken: string\n}\n\nexport const Socket: FC<SocketProps> = ({ hostName, username, authToken, children }) => {\n const dispatch = useDispatch<Dispatch>()\n\n useEffect(() => {\n const handleCalls = (res: any, conv) => {\n // Check conversation isn't empty\n if (Object.keys(conv).length > 0) {\n const status: string = res.status\n if (status) {\n switch (status) {\n case 'ringing':\n // The name and the number are updated here not in webrtc\n dispatch.currentCall.checkIncomingUpdateAndPlay({\n displayName: getDisplayName(conv),\n number: `${conv.counterpartNum}`,\n incomingSocket: true,\n })\n break\n // @ts-ignore\n case 'busy':\n if (conv && conv.connected) {\n // Set current call accepted\n dispatch.currentCall.updateCurrentCall({\n accepted: true,\n incoming: false,\n outgoing: false,\n displayName: getDisplayName(conv),\n number: `${conv.counterpartNum}`,\n startTime: `${conv.startTime / 1000}`,\n })\n }\n // Handle outgoing call\n else if (conv && !conv.connected && conv.direction === 'out') {\n // Update the current outgoing conversation\n dispatch.currentCall.checkOutgoingUpdateAndPlay({\n outgoingSocket: true,\n displayName: getDisplayName(conv),\n number: `${conv.counterpartNum}`,\n })\n }\n default:\n break\n }\n }\n } else {\n console.error(res)\n }\n }\n\n const initWsConnection = () => {\n const socket = io(hostName, {\n upgrade: false,\n transports: ['websocket'],\n reconnection: true,\n reconnectionDelay: 2000,\n })\n\n socket.on('connect', () => {\n console.log('Socket on: ' + hostName + ' is connected !')\n socket.emit('login', {\n accessKeyId: `${username}`,\n token: authToken,\n uaType: 'desktop',\n })\n })\n\n socket.on('authe_ok', () => {\n console.log('auth_ok')\n })\n\n socket.on('userMainPresenceUpdate', (res) => {\n // Pass data to dispatchMainPresence\n dispatchMainPresence(res)\n })\n\n socket.on('extenUpdate', (res) => {\n // Call the dispatchConversations\n dispatchConversations(res)\n // Initialize conversation\n const conv: ConvType = res.conversations[Object.keys(res.conversations)[0]] || {}\n // Handle only the events of the user\n if (res.username === username) {\n handleCalls(res, conv)\n }\n })\n }\n\n initWsConnection()\n }, [])\n\n return <>{children}</>\n}\n"],"names":["_a","hostName","username","authToken","children","dispatch","useDispatch","useEffect","socket","io","upgrade","transports","reconnection","reconnectionDelay","on","console","log","emit","accessKeyId","concat","token","uaType","res","dispatchMainPresence","dispatchConversations","conv","conversations","Object","keys","length","status_1","status","currentCall","checkIncomingUpdateAndPlay","displayName","getDisplayName","number","counterpartNum","incomingSocket","connected","updateCurrentCall","accepted","incoming","outgoing","startTime","direction","checkOutgoingUpdateAndPlay","outgoingSocket","error","handleCalls","React","createElement","Fragment"],"mappings":"yxBAkBuC,SAACA,OAAEC,EAAQD,EAAAC,SAAEC,EAAQF,EAAAE,SAAEC,EAASH,EAAAG,UAAEC,EAAQJ,EAAAI,SACzEC,EAAWC,EAAAA,cAyFjB,OAvFAC,EAAAA,WAAU,WACR,IA8CQC,KAASC,EAAEA,GAACR,EAAU,CAC1BS,SAAS,EACTC,WAAY,CAAC,aACbC,cAAc,EACdC,kBAAmB,OAGdC,GAAG,WAAW,WACnBC,QAAQC,IAAI,cAAgBf,EAAW,mBACvCO,EAAOS,KAAK,QAAS,CACnBC,YAAa,GAAGC,OAAAjB,GAChBkB,MAAOjB,EACPkB,OAAQ,WAEZ,IAEAb,EAAOM,GAAG,YAAY,WACpBC,QAAQC,IAAI,UACd,IAEAR,EAAOM,GAAG,0BAA0B,SAACQ,GAEnCC,EAAoBA,qBAACD,EACvB,IAEAd,EAAOM,GAAG,eAAe,SAACQ,GAExBE,EAAqBA,sBAACF,GAEtB,IAAMG,EAAiBH,EAAII,cAAcC,OAAOC,KAAKN,EAAII,eAAe,KAAO,CAAA,EAE3EJ,EAAIpB,WAAaA,GA7EL,SAACoB,EAAUG,GAE7B,GAAIE,OAAOC,KAAKH,GAAMI,OAAS,EAAG,CAChC,IAAMC,EAAiBR,EAAIS,OAC3B,GAAID,EACF,OAAQA,GACN,IAAK,UAEHzB,EAAS2B,YAAYC,2BAA2B,CAC9CC,YAAaC,EAAcA,eAACV,GAC5BW,OAAQ,GAAAjB,OAAGM,EAAKY,gBAChBC,gBAAgB,IAElB,MAEF,IAAK,OACCb,GAAQA,EAAKc,UAEflC,EAAS2B,YAAYQ,kBAAkB,CACrCC,UAAU,EACVC,UAAU,EACVC,UAAU,EACVT,YAAaC,EAAcA,eAACV,GAC5BW,OAAQ,GAAAjB,OAAGM,EAAKY,gBAChBO,UAAW,GAAGzB,OAAAM,EAAKmB,UAAY,OAI1BnB,IAASA,EAAKc,WAAgC,QAAnBd,EAAKoB,WAEvCxC,EAAS2B,YAAYc,2BAA2B,CAC9CC,gBAAgB,EAChBb,YAAaC,EAAcA,eAACV,GAC5BW,OAAQ,GAAAjB,OAAGM,EAAKY,kBAO3B,MACCtB,QAAQiC,MAAM1B,EAElB,CAmCM2B,CAAY3B,EAAKG,EAErB,GAIH,GAAE,IAEIyB,EAAAA,QAAAC,cAAAD,EAAAA,QAAAE,SAAA,KAAGhD,EACZ"}
@@ -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 r=require("../node_modules/webrtc-adapter/src/js/adapter_core.js"),a=require("../lib/webrtc/janus.js"),t=require("../lib/webrtc/messages.js"),n=require("../utils/useWebRTCStore.js"),o=require("../store/index.js"),s=require("../lib/devices/devices.js"),i=require("../node_modules/react-redux/es/hooks/useDispatch.js");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=l(e),u=a.default;exports.WebRTC=function(a){var l=a.hostName,g=a.sipExten,d=a.sipSecret,p=a.children,f=i.useDispatch(),m=!1;return e.useEffect((function(){s.checkMediaPermissions()}),[]),e.useEffect((function(){var e={registration_failed:[],registered:[],calling:[],incomingcall:[],accepted:[],hangup:[],gateway_down:[],error:[],progress:[],destroyed:[]};return u.init({debug:"all",dependencies:u.useDefaultDependencies({adapter:r.default}),callback:function(){var r=new u({server:"https://".concat(l,"/janus"),success:function(){r.attach&&r.attach({plugin:"janus.plugin.sip",opaqueId:"sebastian_"+(new Date).getTime(),success:function(e){f.webrtc.updateWebRTC({sipcall:e}),t.register(g,d),e&&u.log&&u.log("SIP plugin attached! ("+e.getPlugin()+", id = )")},error:function(e){u.error&&(u.error(" -- Error attaching plugin..."),u.error(e))},consentDialog:function(e){u.log&&u.log("janus consentDialog (on: ".concat(e,")"))},webrtcState:function(e){u.log&&u.log("Janus says our WebRTC PeerConnection is "+(e?"up":"down")+" now")},iceState:function(e){n.useWebRTCStore().sipcall&&u.log&&u.log('ICE state of PeerConnection of handle has changed to "'.concat(e,'"'))},mediaState:function(e,r){u.log&&u.log("Janus "+(r?"started":"stopped")+" receiving our "+e)},slowLink:function(e,r){e?u.warn&&u.warn("SLOW link: several missing packets from janus (".concat(r,")")):u.warn&&u.warn("SLOW link: janus is not receiving all your packets (".concat(r,")"))},onmessage:function(r,a){var o=n.useWebRTCStore().sipcall;u.debug&&(u.debug(" ::: Got a message :::"),u.debug(JSON.stringify(r)));var s=r.error;if(null==s||null==s){var i=r.result;if(null!=i&&void 0!==i.event&&null!==i.event){var l=i.event;for(var c in e[l])e[l][c](r,a);switch(l){case"registration_failed":return void(u.error&&u.error("Registration failed: "+i.code+" "+i.reason));case"unregistered":u.log&&u.log("Successfully un-registered as "+i.username+"!");break;case"registered":u.log&&u.log("Successfully registered as "+i.username+"!"),m||(m=!0);break;case"registering":u.log&&u.log("janus registering");break;case"calling":u.log&&u.log("Waiting for the peer to answer...");break;case"incomingcall":f.webrtc.updateWebRTC({jsepGlobal:a}),u.log&&u.log("Incoming call from "+i.username+"!");break;case"progress":u.log&&u.log("There's early media from "+i.username+", wairing for the call!"),null!=a&&t.handleRemote(a);break;case"accepted":u.log&&u.log(i.username+" accepted the call!"),null!=a&&t.handleRemote(a);break;case"hangup":f.player.stopAudio(),f.currentCall.reset(),o.hangup(),u.log&&u.log("Call hung up ("+i.code+" "+i.reason+")!")}}}else for(var c in m?o.hangup():u.log&&u.log("User is not registered"),e.error);},onlocalstream:function(e){var r=o.store.getState().player.localVideo;u.debug&&(u.debug(" ::: Got a local stream :::"),u.debug(e)),u.attachMediaStream&&u.attachMediaStream(r,e)},onremotestream:function(e){var r=o.store.getState().player.audio,a=o.store.getState().player.remoteVideo;u.debug&&(u.debug(" ::: Got a remote stream :::"),u.debug(e));var t=e.getAudioTracks(),n=e.getVideoTracks();o.store.dispatch.player.stopAudio(),u.attachMediaStream&&(u.attachMediaStream(r,new MediaStream(t)),u.attachMediaStream(a,new MediaStream(n)))},oncleanup:function(){u.log&&u.log(" ::: janus Got a cleanup notification :::")},detached:function(){u.warn&&u.warn("SIP plugin handle detached from the plugin itself")}})},error:function(e){u.log&&u.log("error",e)}})}}),function(){t.unregister()}}),[]),c.default.createElement(c.default.Fragment,null,p)};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");require("../node_modules/react-redux/es/index.js");var r=require("../node_modules/webrtc-adapter/src/js/adapter_core.js"),a=require("../lib/webrtc/janus.js"),t=require("../lib/webrtc/messages.js"),n=require("../utils/useWebRTCStore.js"),o=require("../store/index.js"),s=require("../lib/devices/devices.js"),i=require("../lib/phone/call.js"),l=require("../node_modules/react-redux/es/hooks/useDispatch.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=c(e),g=a.default;exports.WebRTC=function(a){var c=a.hostName,d=a.sipExten,p=a.sipSecret,f=a.children,m=l.useDispatch(),b=!1;return e.useEffect((function(){s.checkMediaPermissions()}),[]),e.useEffect((function(){var e={registration_failed:[],registered:[],calling:[],incomingcall:[],accepted:[],hangup:[],gateway_down:[],error:[],progress:[],destroyed:[]};return g.init({debug:"all",dependencies:g.useDefaultDependencies({adapter:r.default}),callback:function(){var r=new g({server:"https://".concat(c,"/janus"),success:function(){r.attach&&r.attach({plugin:"janus.plugin.sip",opaqueId:"sebastian_"+(new Date).getTime(),success:function(e){m.webrtc.updateWebRTC({sipcall:e}),t.register(d,p),e&&g.log&&g.log("SIP plugin attached! ("+e.getPlugin()+", id = )")},error:function(e){g.error&&(g.error(" -- Error attaching plugin..."),g.error(e))},consentDialog:function(e){g.log&&g.log("janus consentDialog (on: ".concat(e,")"))},webrtcState:function(e){g.log&&g.log("Janus says our WebRTC PeerConnection is "+(e?"up":"down")+" now")},iceState:function(e){n.useWebRTCStore().sipcall&&g.log&&g.log('ICE state of PeerConnection of handle has changed to "'.concat(e,'"'))},mediaState:function(e,r){g.log&&g.log("Janus "+(r?"started":"stopped")+" receiving our "+e)},slowLink:function(e,r){e?g.warn&&g.warn("SLOW link: several missing packets from janus (".concat(r,")")):g.warn&&g.warn("SLOW link: janus is not receiving all your packets (".concat(r,")"))},onmessage:function(r,a){var o=n.useWebRTCStore().sipcall;g.debug&&(g.debug(" ::: Got a message :::"),g.debug(JSON.stringify(r)));var s=r.error;if(null==s||null==s){var l=r.result;if(null!=l&&void 0!==l.event&&null!==l.event){var c=l.event;for(var u in e[c])e[c][u](r,a);switch(c){case"registration_failed":return void(g.error&&g.error("Registration failed: "+l.code+" "+l.reason));case"unregistered":g.log&&g.log("Successfully un-registered as "+l.username+"!");break;case"registered":g.log&&g.log("Successfully registered as "+l.username+"!"),b||(b=!0);break;case"registering":g.log&&g.log("janus registering");break;case"calling":m.currentCall.checkOutgoingUpdateAndPlay({outgoingWebRTC:!0}),g.log&&g.log("Waiting for the peer to answer...");break;case"incomingcall":m.webrtc.updateWebRTC({jsepGlobal:a}),m.currentCall.checkIncomingUpdateAndPlay({incomingWebRTC:!0}),g.log&&g.log("Incoming call from "+l.username+"!");break;case"progress":g.log&&g.log("There's early media from "+l.username+", wairing for the call!"),null!=a&&t.handleRemote(a);break;case"accepted":g.log&&g.log(l.username+" accepted the call!"),a&&t.handleRemote(a),m.currentCall.checkAcceptedUpdateAndPlay({acceptedWebRTC:!0});break;case"hangup":i.hangupCurrentCall(),o.hangup(),g.log&&g.log("Call hung up ("+l.code+" "+l.reason+")!")}}}else for(var u in b?o.hangup():g.log&&g.log("User is not registered"),e.error);},onlocalstream:function(e){var r=o.store.getState().player.localVideo;g.debug&&(g.debug(" ::: Got a local stream :::"),g.debug(e)),g.attachMediaStream&&g.attachMediaStream(r,e)},onremotestream:function(e){var r=o.store.getState().player.remoteAudio,a=o.store.getState().player.remoteVideo;g.debug&&(g.debug(" ::: Got a remote stream :::"),g.debug(e));var t=e.getAudioTracks(),n=e.getVideoTracks();o.store.dispatch.player.stopAudio(),g.attachMediaStream&&(g.attachMediaStream(r,new MediaStream(t)),g.attachMediaStream(a,new MediaStream(n)))},oncleanup:function(){g.log&&g.log(" ::: janus Got a cleanup notification :::")},detached:function(){g.warn&&g.warn("SIP plugin handle detached from the plugin itself")}})},error:function(e){g.log&&g.log("error",e)}})}}),function(){t.unregister()}}),[]),u.default.createElement(u.default.Fragment,null,f)};
2
2
  //# sourceMappingURL=WebRTC.js.map