siam-ui-utils 2.2.3 → 2.2.4
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/eslint.config.mjs
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import js from '@eslint/js';
|
|
2
|
-
import globals from 'globals';
|
|
3
|
-
import pluginReact from 'eslint-plugin-react';
|
|
4
|
-
import pluginReactHooks from 'eslint-plugin-react-hooks';
|
|
5
|
-
import pluginReactRefresh from 'eslint-plugin-react-refresh';
|
|
6
|
-
import { defineConfig } from 'eslint/config';
|
|
7
|
-
|
|
8
|
-
export default defineConfig([
|
|
9
|
-
{ ignores: ['build', '**/*.d.ts'] },
|
|
10
|
-
{
|
|
11
|
-
files: ['**/*.{js,jsx,ts,tsx}'],
|
|
12
|
-
languageOptions: {
|
|
13
|
-
ecmaVersion: 'latest',
|
|
14
|
-
sourceType: 'module',
|
|
15
|
-
globals: globals.browser,
|
|
16
|
-
parserOptions: {
|
|
17
|
-
ecmaFeatures: { jsx: true },
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
plugins: {
|
|
21
|
-
react: pluginReact,
|
|
22
|
-
'react-hooks': pluginReactHooks,
|
|
23
|
-
'react-refresh': pluginReactRefresh,
|
|
24
|
-
},
|
|
25
|
-
rules: {
|
|
26
|
-
...js.configs.recommended.rules,
|
|
27
|
-
...pluginReact.configs.recommended.rules,
|
|
28
|
-
...pluginReact.configs['jsx-runtime'].rules,
|
|
29
|
-
...pluginReactHooks.configs.recommended.rules,
|
|
30
|
-
'react/jsx-no-target-blank': 'off',
|
|
31
|
-
'react-refresh/only-export-components': [
|
|
32
|
-
'off',
|
|
33
|
-
{ allowConstantExport: true },
|
|
34
|
-
],
|
|
35
|
-
'react/prop-types': 'off',
|
|
36
|
-
'@/no-default-export': 'off',
|
|
37
|
-
'no-unused-vars': 'warn',
|
|
38
|
-
},
|
|
39
|
-
settings: { react: { version: 'detect' } },
|
|
40
|
-
},
|
|
41
|
-
]);
|
|
1
|
+
import js from '@eslint/js';
|
|
2
|
+
import globals from 'globals';
|
|
3
|
+
import pluginReact from 'eslint-plugin-react';
|
|
4
|
+
import pluginReactHooks from 'eslint-plugin-react-hooks';
|
|
5
|
+
import pluginReactRefresh from 'eslint-plugin-react-refresh';
|
|
6
|
+
import { defineConfig } from 'eslint/config';
|
|
7
|
+
|
|
8
|
+
export default defineConfig([
|
|
9
|
+
{ ignores: ['build', '**/*.d.ts'] },
|
|
10
|
+
{
|
|
11
|
+
files: ['**/*.{js,jsx,ts,tsx}'],
|
|
12
|
+
languageOptions: {
|
|
13
|
+
ecmaVersion: 'latest',
|
|
14
|
+
sourceType: 'module',
|
|
15
|
+
globals: globals.browser,
|
|
16
|
+
parserOptions: {
|
|
17
|
+
ecmaFeatures: { jsx: true },
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
plugins: {
|
|
21
|
+
react: pluginReact,
|
|
22
|
+
'react-hooks': pluginReactHooks,
|
|
23
|
+
'react-refresh': pluginReactRefresh,
|
|
24
|
+
},
|
|
25
|
+
rules: {
|
|
26
|
+
...js.configs.recommended.rules,
|
|
27
|
+
...pluginReact.configs.recommended.rules,
|
|
28
|
+
...pluginReact.configs['jsx-runtime'].rules,
|
|
29
|
+
...pluginReactHooks.configs.recommended.rules,
|
|
30
|
+
'react/jsx-no-target-blank': 'off',
|
|
31
|
+
'react-refresh/only-export-components': [
|
|
32
|
+
'off',
|
|
33
|
+
{ allowConstantExport: true },
|
|
34
|
+
],
|
|
35
|
+
'react/prop-types': 'off',
|
|
36
|
+
'@/no-default-export': 'off',
|
|
37
|
+
'no-unused-vars': 'warn',
|
|
38
|
+
},
|
|
39
|
+
settings: { react: { version: 'detect' } },
|
|
40
|
+
},
|
|
41
|
+
]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "siam-ui-utils",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.4",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"ampf-react",
|
|
6
6
|
"ampf-utils",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@types/react-intl": "^3.0.0",
|
|
27
|
-
"@whereby.com/browser-sdk": "^3.
|
|
27
|
+
"@whereby.com/browser-sdk": "^3.13.1",
|
|
28
28
|
"events": "^3.3.0",
|
|
29
29
|
"html5-file-selector": "^2.1.0",
|
|
30
30
|
"prop-types": "^15.8.1",
|
|
@@ -4,11 +4,10 @@ import './index.css';
|
|
|
4
4
|
export const CustomInputRadio = ({
|
|
5
5
|
className,
|
|
6
6
|
customClassName,
|
|
7
|
-
|
|
7
|
+
checked,
|
|
8
8
|
disabled,
|
|
9
9
|
id,
|
|
10
10
|
inline,
|
|
11
|
-
key,
|
|
12
11
|
label,
|
|
13
12
|
name,
|
|
14
13
|
onChange,
|
|
@@ -16,15 +15,14 @@ export const CustomInputRadio = ({
|
|
|
16
15
|
return (
|
|
17
16
|
<FormGroup
|
|
18
17
|
check
|
|
19
|
-
key={key}
|
|
20
18
|
inline={inline}
|
|
21
|
-
className={`custom-radio ${customClassName}`}
|
|
19
|
+
className={`custom-radio ${customClassName || ''}`}
|
|
22
20
|
>
|
|
23
21
|
<Input
|
|
24
22
|
id={id}
|
|
25
23
|
type="radio"
|
|
26
24
|
name={name}
|
|
27
|
-
|
|
25
|
+
checked={checked}
|
|
28
26
|
onChange={onChange}
|
|
29
27
|
disabled={disabled}
|
|
30
28
|
className={className}
|
|
@@ -1,98 +1,71 @@
|
|
|
1
|
-
import { useEffect, useRef
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
import '@whereby.com/browser-sdk/embed';
|
|
2
3
|
|
|
3
|
-
export const WhereByRoom = ({
|
|
4
|
-
|
|
5
|
-
title = 'Videollamada AMPF',
|
|
6
|
-
onEvent,
|
|
7
|
-
style = {},
|
|
8
|
-
waitingMessage = 'Por favor, espere a que el doctor habilite la sala...',
|
|
9
|
-
...props
|
|
10
|
-
}) => {
|
|
11
|
-
const iframeRef = useRef(null);
|
|
12
|
-
const [roomEnabled, setRoomEnabled] = useState(false);
|
|
4
|
+
export const WhereByRoom = ({ src, onEvent, onActions, iframeClass }) => {
|
|
5
|
+
const wherebyRef = useRef(null);
|
|
13
6
|
|
|
14
7
|
useEffect(() => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
onEvent?.('participantLeft', event)
|
|
37
|
-
);
|
|
38
|
-
// Agrega más eventos según necesidad
|
|
39
|
-
};
|
|
40
|
-
document.body.appendChild(script);
|
|
41
|
-
} else {
|
|
42
|
-
whereby = new window.Whereby(iframeRef.current);
|
|
43
|
-
whereby.on('roomJoined', (event) => {
|
|
44
|
-
setRoomEnabled(true);
|
|
45
|
-
onEvent?.('roomJoined', event);
|
|
46
|
-
});
|
|
47
|
-
whereby.on('roomLeft', (event) => {
|
|
48
|
-
setRoomEnabled(false);
|
|
49
|
-
onEvent?.('roomLeft', event);
|
|
50
|
-
});
|
|
51
|
-
whereby.on('participantJoined', (event) =>
|
|
52
|
-
onEvent?.('participantJoined', event)
|
|
53
|
-
);
|
|
54
|
-
whereby.on('participantLeft', (event) =>
|
|
55
|
-
onEvent?.('participantLeft', event)
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
loadSDK();
|
|
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
|
+
}
|
|
60
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));
|
|
61
51
|
return () => {
|
|
62
|
-
|
|
52
|
+
events.forEach((ev) => elm.removeEventListener(ev, handleEvent));
|
|
63
53
|
};
|
|
64
|
-
}, [
|
|
65
|
-
|
|
66
|
-
if (!roomEnabled) {
|
|
67
|
-
return (
|
|
68
|
-
<div
|
|
69
|
-
style={{
|
|
70
|
-
...style,
|
|
71
|
-
minHeight: '600px',
|
|
72
|
-
display: 'flex',
|
|
73
|
-
alignItems: 'center',
|
|
74
|
-
justifyContent: 'center',
|
|
75
|
-
}}
|
|
76
|
-
>
|
|
77
|
-
{waitingMessage}
|
|
78
|
-
</div>
|
|
79
|
-
);
|
|
80
|
-
}
|
|
54
|
+
}, [onEvent, onActions]);
|
|
81
55
|
|
|
82
56
|
return (
|
|
83
|
-
<
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
{...props}
|
|
96
|
-
/>
|
|
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>
|
|
97
69
|
);
|
|
98
70
|
};
|
|
71
|
+
export default WhereByRoom;
|