siam-ui-utils 2.1.13 → 2.1.15
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/package.json +3 -3
- package/src/App.jsx +2 -2
- package/src/where-by-room/index.jsx +7 -64
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "siam-ui-utils",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.15",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"ampf-react",
|
|
6
6
|
"ampf-utils",
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
|
|
65
65
|
"eslint-plugin-react-refresh": "^0.4.9",
|
|
66
66
|
"sass-embedded": "^1.79.4",
|
|
67
|
-
"vite": "^
|
|
67
|
+
"vite": "^7.0.1",
|
|
68
68
|
"vite-plugin-eslint": "^1.8.1",
|
|
69
|
-
"vitest": "^2.
|
|
69
|
+
"vitest": "^3.2.4"
|
|
70
70
|
}
|
|
71
71
|
}
|
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 {
|
|
12
|
+
import { WhereByRoom } from './where-by-room';
|
|
13
13
|
|
|
14
14
|
const App = () => {
|
|
15
15
|
const [open, setOpen] = useState('0');
|
|
@@ -71,7 +71,7 @@ const App = () => {
|
|
|
71
71
|
<AccordionItem>
|
|
72
72
|
<AccordionHeader targetId="4">Video Call Room</AccordionHeader>
|
|
73
73
|
<AccordionBody accordionId="4">
|
|
74
|
-
<
|
|
74
|
+
<WhereByRoom
|
|
75
75
|
url="https://whereby.com/test-ampf-room"
|
|
76
76
|
title="Videollamada de ejemplo"
|
|
77
77
|
/>
|
|
@@ -1,67 +1,10 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
1
|
+
export const WhereByRoom = ({ url, title = 'Videollamada AMPF' }) => {
|
|
49
2
|
return (
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
style={{
|
|
57
|
-
width: '100%',
|
|
58
|
-
height: '80vh',
|
|
59
|
-
border: 0,
|
|
60
|
-
borderRadius: '12px',
|
|
61
|
-
}}
|
|
62
|
-
></iframe>
|
|
63
|
-
</div>
|
|
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
|
+
/>
|
|
64
9
|
);
|
|
65
10
|
};
|
|
66
|
-
|
|
67
|
-
export default WherebyRoom;
|