siam-ui-utils 2.2.8 → 2.2.10

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/index.d.ts CHANGED
@@ -82,4 +82,7 @@ declare module 'siam-ui-utils' {
82
82
 
83
83
  //VIDEO CALL ROOM
84
84
  export function WhereByRoom(props);
85
+
86
+ //COPY LINK
87
+ export function CopyLink(props);
85
88
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "siam-ui-utils",
3
- "version": "2.2.8",
3
+ "version": "2.2.10",
4
4
  "keywords": [
5
5
  "ampf-react",
6
6
  "ampf-utils",
package/src/App.jsx CHANGED
@@ -11,6 +11,7 @@ import './index.css';
11
11
  import './App.css';
12
12
  import './assets/css/vendor/bootstrap.min.css';
13
13
  import { WhereByRoom } from './where-by-room';
14
+ import CopyLink from './copy-link';
14
15
 
15
16
  const App = () => {
16
17
  const [open, setOpen] = useState('0');
@@ -81,7 +82,7 @@ const App = () => {
81
82
  <AccordionHeader targetId="4">Video Call Room</AccordionHeader>
82
83
  <AccordionBody accordionId="4">
83
84
  <WhereByRoom
84
- src="https://ampf.whereby.com/ampf-cons-virc92qft?displayName=Jose"
85
+ src="https://whereby.com/test-ampf-room"
85
86
  title="Videollamada de ejemplo"
86
87
  />
87
88
  </AccordionBody>
@@ -110,6 +111,12 @@ const App = () => {
110
111
  />
111
112
  </AccordionBody>
112
113
  </AccordionItem>
114
+ <AccordionItem>
115
+ <AccordionHeader targetId="2">Copy-Link</AccordionHeader>
116
+ <AccordionBody accordionId="2">
117
+ <CopyLink link="https://linkdepruebaparaelcopylink.com" />
118
+ </AccordionBody>
119
+ </AccordionItem>
113
120
  </Accordion>
114
121
  </div>
115
122
  );
Binary file
@@ -0,0 +1,58 @@
1
+ import { useState } from 'react';
2
+ import { Button } from 'reactstrap';
3
+ import copiarIcon from '../assets/img/copiar.png';
4
+ import './styles.scss';
5
+
6
+ const copyToClipboard = async (text) => {
7
+ try {
8
+ if (!text) return false;
9
+ if (navigator.clipboard?.writeText) {
10
+ await navigator.clipboard.writeText(text);
11
+ return true;
12
+ }
13
+ const ta = document.createElement('textarea');
14
+ ta.value = text;
15
+ ta.style.position = 'fixed';
16
+ ta.style.left = '-9999px';
17
+ document.body.appendChild(ta);
18
+ ta.select();
19
+ document.execCommand('copy');
20
+ document.body.removeChild(ta);
21
+ return true;
22
+ } catch {
23
+ return false;
24
+ }
25
+ };
26
+
27
+ const CopyLink = ({ link }) => {
28
+ const [copied, setCopied] = useState(false);
29
+
30
+ const handleCopy = async () => {
31
+ await copyToClipboard(link);
32
+ setCopied(true);
33
+ setTimeout(() => setCopied(false), 2000);
34
+ };
35
+ return (
36
+ <span className="copy-link-container">
37
+ <span
38
+ title={link}
39
+ className={`copy-link-text${copied ? ' copied' : ''}`}
40
+ onClick={handleCopy}
41
+ >
42
+ {link}
43
+ </span>
44
+ <Button
45
+ color="link"
46
+ size="sm"
47
+ onClick={handleCopy}
48
+ title="Copiar link"
49
+ className="copy-link-btn"
50
+ >
51
+ <img src={copiarIcon} alt="Copiar" />
52
+ </Button>
53
+ {copied && <span className="copy-link-copied">¡Copiado!</span>}
54
+ </span>
55
+ );
56
+ };
57
+
58
+ export default CopyLink;
@@ -0,0 +1,39 @@
1
+ .copy-link-container {
2
+ display: inline-flex;
3
+ align-items: center;
4
+ gap: 8px;
5
+ width: 100%;
6
+ position: relative;
7
+ }
8
+
9
+ .copy-link-text {
10
+ width: 90%;
11
+ overflow: hidden;
12
+ text-overflow: ellipsis;
13
+ white-space: nowrap;
14
+ display: inline-block;
15
+ vertical-align: middle;
16
+ cursor: pointer;
17
+ transition: color 0.2s;
18
+ font-weight: 500;
19
+ color: #007bff;
20
+
21
+ &.copied {
22
+ color: #28a745;
23
+ }
24
+ }
25
+
26
+ .copy-link-btn {
27
+ padding: 0;
28
+ font-size: 16px;
29
+ }
30
+
31
+ .copy-link-copied {
32
+ color: #28a745;
33
+ font-size: 13px;
34
+ margin-left: 8px;
35
+ position: absolute;
36
+ top: 100%;
37
+ left: 0;
38
+ white-space: nowrap;
39
+ }
package/src/index.js CHANGED
@@ -7,4 +7,4 @@ export * from './CustomSelectInput';
7
7
  export * from './tomar-foto';
8
8
  export * as IntlMessages from './IntlMessages';
9
9
  export * from './where-by-room';
10
-
10
+ export * from './copy-link';
@@ -2,14 +2,7 @@ import { WherebyProvider } from '@whereby.com/browser-sdk/react';
2
2
  import '@whereby.com/browser-sdk/embed';
3
3
  import Room from './room';
4
4
 
5
- export const WhereByRoom = ({
6
- src,
7
- onEvent,
8
- onActions,
9
- iframeClass,
10
- isChatEnabled = true,
11
- isMinimalEnabled = false,
12
- }) => {
5
+ export const WhereByRoom = ({ src, onEvent, onActions, iframeClass }) => {
13
6
  return (
14
7
  <WherebyProvider>
15
8
  <Room
@@ -17,8 +10,6 @@ export const WhereByRoom = ({
17
10
  onEvent={onEvent}
18
11
  onActions={onActions}
19
12
  iframeClass={iframeClass}
20
- isChatEnabled={isChatEnabled}
21
- isMinimalEnabled={isMinimalEnabled}
22
13
  />
23
14
  </WherebyProvider>
24
15
  );
@@ -1,14 +1,7 @@
1
1
  import { useEffect, useRef } from 'react';
2
2
  import '@whereby.com/browser-sdk/embed';
3
3
 
4
- export const Room = ({
5
- src,
6
- onEvent,
7
- onActions,
8
- iframeClass,
9
- isChatEnabled = true,
10
- isMinimalEnabled = false,
11
- }) => {
4
+ export const Room = ({ src, onEvent, onActions, iframeClass }) => {
12
5
  const wherebyRef = useRef(null);
13
6
 
14
7
  useEffect(() => {
@@ -74,12 +67,11 @@ export const Room = ({
74
67
  ref={wherebyRef}
75
68
  class={iframeClass}
76
69
  room={src}
77
- chat={isChatEnabled ? 'on' : 'off'}
70
+ chat="on"
78
71
  screenshare="on"
79
72
  audio="on"
80
73
  video="on"
81
74
  allow="camera; microphone; fullscreen"
82
- minimal={isMinimalEnabled ? 'on' : 'off'}
83
75
  />
84
76
  </div>
85
77
  );