react-peer-chat 0.2.3 → 0.2.5
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/build/index.d.ts +1 -1
- package/build/index.js +4 -4
- package/package.json +1 -1
package/build/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ type ChildrenOptions = {
|
|
|
12
12
|
audio?: boolean;
|
|
13
13
|
setAudio?: (audio: boolean) => void;
|
|
14
14
|
};
|
|
15
|
-
type DialogPosition = 'left' | 'center' | '
|
|
15
|
+
type DialogPosition = 'left' | 'center' | 'right';
|
|
16
16
|
type DialogOptions = {
|
|
17
17
|
position: DialogPosition;
|
|
18
18
|
style: CSSProperties;
|
package/build/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
-
import useStorage, { removeStorage } from './storage';
|
|
3
|
-
import { BiSolidMessageDetail, BiSolidMessageX, BsFillMicFill, BsFillMicMuteFill, GrSend } from './icons';
|
|
2
|
+
import useStorage, { removeStorage } from './storage.js';
|
|
3
|
+
import { BiSolidMessageDetail, BiSolidMessageX, BsFillMicFill, BsFillMicMuteFill, GrSend } from './icons.js';
|
|
4
4
|
export default function Chat({ name, peerId, remotePeerId, peerOptions, text = true, voice = true, dialogOptions, onError = () => console.error("Can not access microphone!"), children, ...props }) {
|
|
5
5
|
const [peer, setPeer] = useState();
|
|
6
6
|
const [opponentName, setOpponentName] = useState();
|
|
@@ -48,7 +48,7 @@ export default function Chat({ name, peerId, remotePeerId, peerOptions, text = t
|
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
50
|
(async function loadPeer() {
|
|
51
|
-
const Peer =
|
|
51
|
+
const { Peer } = await import('peerjs');
|
|
52
52
|
const peer = new Peer(`rpc-${peerId}`, peerOptions);
|
|
53
53
|
setPeer(peer);
|
|
54
54
|
})();
|
|
@@ -115,7 +115,7 @@ export default function Chat({ name, peerId, remotePeerId, peerOptions, text = t
|
|
|
115
115
|
setDialog(true);
|
|
116
116
|
} }),
|
|
117
117
|
notification && React.createElement("span", { className: 'rpc-badge' })),
|
|
118
|
-
React.createElement("dialog", { ref: dialogRef, className: `${dialog ? 'dialog' : ''} position-${dialogOptions?.position || 'center'}`, style: dialogOptions?.style },
|
|
118
|
+
React.createElement("dialog", { ref: dialogRef, className: `${dialog ? 'rpc-dialog' : ''} rpc-position-${dialogOptions?.position || 'center'}`, style: dialogOptions?.style },
|
|
119
119
|
React.createElement("div", { className: 'rpc-heading' }, "Chat"),
|
|
120
120
|
React.createElement("hr", null),
|
|
121
121
|
React.createElement("div", null,
|