siam-ui-utils 2.2.4 → 2.2.6
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 +1 -1
- package/src/App.jsx +1 -1
- package/src/where-by-room/index.jsx +9 -63
- package/src/where-by-room/room.jsx +71 -0
- package/vite.config.ts +18 -15
package/package.json
CHANGED
package/src/App.jsx
CHANGED
|
@@ -81,7 +81,7 @@ const App = () => {
|
|
|
81
81
|
<AccordionHeader targetId="4">Video Call Room</AccordionHeader>
|
|
82
82
|
<AccordionBody accordionId="4">
|
|
83
83
|
<WhereByRoom
|
|
84
|
-
|
|
84
|
+
src="https://whereby.com/test-ampf-room"
|
|
85
85
|
title="Videollamada de ejemplo"
|
|
86
86
|
/>
|
|
87
87
|
</AccordionBody>
|
|
@@ -1,71 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { WherebyProvider } from '@whereby.com/browser-sdk/react';
|
|
2
2
|
import '@whereby.com/browser-sdk/embed';
|
|
3
|
+
import Room from './room';
|
|
3
4
|
|
|
4
5
|
export const WhereByRoom = ({ src, onEvent, onActions, iframeClass }) => {
|
|
5
|
-
const wherebyRef = useRef(null);
|
|
6
|
-
|
|
7
|
-
useEffect(() => {
|
|
8
|
-
const elm = wherebyRef.current;
|
|
9
|
-
if (!elm) return;
|
|
10
|
-
|
|
11
|
-
if (onActions) {
|
|
12
|
-
onActions({
|
|
13
|
-
endMeeting: () => elm.endMeeting(),
|
|
14
|
-
knock: () => elm.knock(),
|
|
15
|
-
cancelKnock: () => elm.cancelKnock(),
|
|
16
|
-
leaveRoom: () => elm.leaveRoom(),
|
|
17
|
-
startRecording: () => elm.startRecording(),
|
|
18
|
-
stopRecording: () => elm.stopRecording(),
|
|
19
|
-
startStreaming: () => elm.startStreaming(),
|
|
20
|
-
stopStreaming: () => elm.stopStreaming(),
|
|
21
|
-
startLiveTranscription: () => elm.startLiveTranscription(),
|
|
22
|
-
stopLiveTranscription: () => elm.stopLiveTranscription(),
|
|
23
|
-
toggleCamera: (enabled) => elm.toggleCamera(enabled),
|
|
24
|
-
toggleMicrophone: (enabled) => elm.toggleMicrophone(enabled),
|
|
25
|
-
toggleScreenshare: (enabled) => elm.toggleScreenshare(enabled),
|
|
26
|
-
toggleChat: (enabled) => elm.toggleChat(enabled),
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const events = [
|
|
31
|
-
'ready',
|
|
32
|
-
'join',
|
|
33
|
-
'leave',
|
|
34
|
-
'participant_join',
|
|
35
|
-
'participant_leave',
|
|
36
|
-
'microphone_toggle',
|
|
37
|
-
'camera_toggle',
|
|
38
|
-
'screenshare_toggle',
|
|
39
|
-
'chat_toggle',
|
|
40
|
-
'people_toggle',
|
|
41
|
-
'pip_toggle',
|
|
42
|
-
'deny_device_permission',
|
|
43
|
-
'streaming_status_change',
|
|
44
|
-
'connection_status_change',
|
|
45
|
-
'meeting_end',
|
|
46
|
-
];
|
|
47
|
-
function handleEvent(e) {
|
|
48
|
-
if (onEvent) onEvent(e.type, e.detail);
|
|
49
|
-
}
|
|
50
|
-
events.forEach((ev) => elm.addEventListener(ev, handleEvent));
|
|
51
|
-
return () => {
|
|
52
|
-
events.forEach((ev) => elm.removeEventListener(ev, handleEvent));
|
|
53
|
-
};
|
|
54
|
-
}, [onEvent, onActions]);
|
|
55
|
-
|
|
56
6
|
return (
|
|
57
|
-
<
|
|
58
|
-
<
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
screenshare="on"
|
|
64
|
-
audio="on"
|
|
65
|
-
video="on"
|
|
66
|
-
allow="camera; microphone; fullscreen"
|
|
7
|
+
<WherebyProvider>
|
|
8
|
+
<Room
|
|
9
|
+
src={src}
|
|
10
|
+
onEvent={onEvent}
|
|
11
|
+
onActions={onActions}
|
|
12
|
+
iframeClass={iframeClass}
|
|
67
13
|
/>
|
|
68
|
-
</
|
|
14
|
+
</WherebyProvider>
|
|
69
15
|
);
|
|
70
16
|
};
|
|
71
17
|
export default WhereByRoom;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
import '@whereby.com/browser-sdk/embed';
|
|
3
|
+
|
|
4
|
+
export const Room = ({ src, onEvent, onActions, iframeClass }) => {
|
|
5
|
+
const wherebyRef = useRef(null);
|
|
6
|
+
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
const elm = wherebyRef.current;
|
|
9
|
+
if (!elm) return;
|
|
10
|
+
|
|
11
|
+
if (onActions) {
|
|
12
|
+
onActions({
|
|
13
|
+
endMeeting: () => elm.endMeeting(),
|
|
14
|
+
knock: () => elm.knock(),
|
|
15
|
+
cancelKnock: () => elm.cancelKnock(),
|
|
16
|
+
leaveRoom: () => elm.leaveRoom(),
|
|
17
|
+
startRecording: () => elm.startRecording(),
|
|
18
|
+
stopRecording: () => elm.stopRecording(),
|
|
19
|
+
startStreaming: () => elm.startStreaming(),
|
|
20
|
+
stopStreaming: () => elm.stopStreaming(),
|
|
21
|
+
startLiveTranscription: () => elm.startLiveTranscription(),
|
|
22
|
+
stopLiveTranscription: () => elm.stopLiveTranscription(),
|
|
23
|
+
toggleCamera: (enabled) => elm.toggleCamera(enabled),
|
|
24
|
+
toggleMicrophone: (enabled) => elm.toggleMicrophone(enabled),
|
|
25
|
+
toggleScreenshare: (enabled) => elm.toggleScreenshare(enabled),
|
|
26
|
+
toggleChat: (enabled) => elm.toggleChat(enabled),
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const events = [
|
|
31
|
+
'ready',
|
|
32
|
+
'join',
|
|
33
|
+
'leave',
|
|
34
|
+
'participant_join',
|
|
35
|
+
'participant_leave',
|
|
36
|
+
'microphone_toggle',
|
|
37
|
+
'camera_toggle',
|
|
38
|
+
'screenshare_toggle',
|
|
39
|
+
'chat_toggle',
|
|
40
|
+
'people_toggle',
|
|
41
|
+
'pip_toggle',
|
|
42
|
+
'deny_device_permission',
|
|
43
|
+
'streaming_status_change',
|
|
44
|
+
'connection_status_change',
|
|
45
|
+
'meeting_end',
|
|
46
|
+
];
|
|
47
|
+
function handleEvent(e) {
|
|
48
|
+
if (onEvent) onEvent(e.type, e.detail);
|
|
49
|
+
}
|
|
50
|
+
events.forEach((ev) => elm.addEventListener(ev, handleEvent));
|
|
51
|
+
return () => {
|
|
52
|
+
events.forEach((ev) => elm.removeEventListener(ev, handleEvent));
|
|
53
|
+
};
|
|
54
|
+
}, [onEvent, onActions]);
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<div className={iframeClass}>
|
|
58
|
+
<whereby-embed
|
|
59
|
+
ref={wherebyRef}
|
|
60
|
+
class={iframeClass}
|
|
61
|
+
room={src}
|
|
62
|
+
chat="on"
|
|
63
|
+
screenshare="on"
|
|
64
|
+
audio="on"
|
|
65
|
+
video="on"
|
|
66
|
+
allow="camera; microphone; fullscreen"
|
|
67
|
+
/>
|
|
68
|
+
</div>
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
export default Room;
|
package/vite.config.ts
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import react from
|
|
2
|
-
import { defineConfig } from
|
|
3
|
-
import commonjs from 'vite-plugin-commonjs'
|
|
1
|
+
import react from '@vitejs/plugin-react';
|
|
2
|
+
import { defineConfig } from 'vitest/config';
|
|
3
|
+
import commonjs from 'vite-plugin-commonjs';
|
|
4
4
|
|
|
5
5
|
export default defineConfig({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
6
|
+
define: {
|
|
7
|
+
'process.env': {},
|
|
8
|
+
},
|
|
9
|
+
plugins: [react(), commonjs()],
|
|
10
|
+
server: {
|
|
11
|
+
port: 5173,
|
|
12
|
+
open: true,
|
|
13
|
+
hmr: true,
|
|
14
|
+
},
|
|
15
|
+
css: {
|
|
16
|
+
preprocessorOptions: {
|
|
17
|
+
scss: {
|
|
18
|
+
silenceDeprecations: ['legacy-js-api'],
|
|
19
|
+
},
|
|
18
20
|
},
|
|
21
|
+
},
|
|
19
22
|
});
|