siam-ui-utils 2.1.12 → 2.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +1 -1
- package/package.json +2 -1
- package/src/App.jsx +1 -1
- package/src/index.js +1 -1
- package/src/where-by-room/constants.js +2 -0
- package/src/where-by-room/index.jsx +67 -0
- package/src/video-call-room/index.jsx +0 -10
package/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "siam-ui-utils",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.13",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"ampf-react",
|
|
6
6
|
"ampf-utils",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@types/react-intl": "^3.0.0",
|
|
27
|
+
"@whereby.com/browser-sdk": "^3.12.18",
|
|
27
28
|
"events": "^3.3.0",
|
|
28
29
|
"html5-file-selector": "^2.1.0",
|
|
29
30
|
"prop-types": "^15.8.1",
|
package/src/App.jsx
CHANGED
|
@@ -9,7 +9,7 @@ import { TomarFoto, DropzoneUploader, DropzoneUploaderDniDigital } from './';
|
|
|
9
9
|
import './index.css';
|
|
10
10
|
import './App.css';
|
|
11
11
|
import './assets/css/vendor/bootstrap.min.css';
|
|
12
|
-
import { VideoCallRoom } from './
|
|
12
|
+
import { VideoCallRoom } from './where-by-room';
|
|
13
13
|
|
|
14
14
|
const App = () => {
|
|
15
15
|
const [open, setOpen] = useState('0');
|
package/src/index.js
CHANGED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
import { WherebyEmbedded } from '@whereby.com/browser-sdk';
|
|
3
|
+
import { ALERT_TIMEOUT, SESSION_TIMEOUT } from './constants';
|
|
4
|
+
|
|
5
|
+
const WherebyRoom = ({
|
|
6
|
+
roomUrl,
|
|
7
|
+
title = 'Sala de consulta',
|
|
8
|
+
onHostLeft = () => {},
|
|
9
|
+
onSessionFinished = () => {},
|
|
10
|
+
timeOut = SESSION_TIMEOUT,
|
|
11
|
+
alertTimeout = ALERT_TIMEOUT,
|
|
12
|
+
onAlertTimeout = () => {},
|
|
13
|
+
}) => {
|
|
14
|
+
const iframeRef = useRef(null);
|
|
15
|
+
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
const iframe = iframeRef.current;
|
|
18
|
+
|
|
19
|
+
const whereby = new WherebyEmbedded(iframe);
|
|
20
|
+
|
|
21
|
+
whereby.on('room:participant-left', (event) => {
|
|
22
|
+
if (event.participant.isHost) {
|
|
23
|
+
onHostLeft();
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const sessionTimeout = setTimeout(
|
|
28
|
+
() => {
|
|
29
|
+
onSessionFinished();
|
|
30
|
+
iframe.remove();
|
|
31
|
+
},
|
|
32
|
+
timeOut * 60 * 1000,
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const sessionAlertTimeout = setTimeout(
|
|
36
|
+
() => {
|
|
37
|
+
onAlertTimeout();
|
|
38
|
+
},
|
|
39
|
+
alertTimeout * 60 * 1000,
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
return () => {
|
|
43
|
+
clearTimeout(sessionTimeout);
|
|
44
|
+
clearTimeout(sessionAlertTimeout);
|
|
45
|
+
whereby.destroy();
|
|
46
|
+
};
|
|
47
|
+
}, []);
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<div>
|
|
51
|
+
<iframe
|
|
52
|
+
ref={iframeRef}
|
|
53
|
+
title={title}
|
|
54
|
+
src={roomUrl}
|
|
55
|
+
allow="camera; microphone; fullscreen; speaker; display-capture"
|
|
56
|
+
style={{
|
|
57
|
+
width: '100%',
|
|
58
|
+
height: '80vh',
|
|
59
|
+
border: 0,
|
|
60
|
+
borderRadius: '12px',
|
|
61
|
+
}}
|
|
62
|
+
></iframe>
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export default WherebyRoom;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export const VideoCallRoom = ({ url, title = 'Videollamada AMPF' }) => {
|
|
2
|
-
return (
|
|
3
|
-
<iframe
|
|
4
|
-
src={url}
|
|
5
|
-
allow="camera; microphone; fullscreen; speaker; display-capture"
|
|
6
|
-
style={{ width: '100%', height: '100%', border: '0', minHeight: '600px' }}
|
|
7
|
-
title={title}
|
|
8
|
-
/>
|
|
9
|
-
);
|
|
10
|
-
};
|