react-peer-chat 0.6.2 → 0.6.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 Sahil Aggawal, <aggarwalsahil2004@gmail.com>
3
+ Copyright (c) 2024 Sahil Aggawal, <aggarwalsahil2004@gmail.com>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
6
 
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import React, { CSSProperties, DetailedHTMLProps, HTMLAttributes, ReactNode } from 'react';
2
- import { PeerOptions as ImportedPeerOptions } from 'peerjs';
2
+ import { PeerOptions } from 'peerjs';
3
3
  export type RemotePeerId = string | string[];
4
- export type PeerOptions = ImportedPeerOptions;
4
+ export type { PeerOptions };
5
5
  export type DialogPosition = 'left' | 'center' | 'right';
6
6
  export type DialogOptions = {
7
7
  position?: DialogPosition;
package/dist/index.js CHANGED
@@ -1,3 +1,12 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
1
10
  import React, { useEffect, useRef, useState } from 'react';
2
11
  import useStorage, { removeStorage } from './storage.js';
3
12
  import { BiSolidMessageDetail, BiSolidMessageX, BsFillMicFill, BsFillMicMuteFill, GrSend } from './icons.js';
@@ -80,12 +89,14 @@ export default function Chat({ name, peerId, remotePeerId = [], peerOptions, tex
80
89
  setPeer(undefined);
81
90
  return;
82
91
  }
83
- (async function () {
84
- const { Peer, util: { supports: { audioVideo, data } } } = await import('peerjs');
85
- if (!data || !audioVideo)
86
- return onError();
87
- const peer = new Peer(peerId, Object.assign({ config: defaultConfig }, peerOptions));
88
- setPeer(peer);
92
+ (function () {
93
+ return __awaiter(this, void 0, void 0, function* () {
94
+ const { Peer, util: { supports: { audioVideo, data } } } = yield import('peerjs');
95
+ if (!data || !audioVideo)
96
+ return onError();
97
+ const peer = new Peer(peerId, Object.assign({ config: defaultConfig }, peerOptions));
98
+ setPeer(peer);
99
+ });
89
100
  })();
90
101
  }, [audio]);
91
102
  useEffect(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-peer-chat",
3
- "version": "0.6.2",
3
+ "version": "0.6.4",
4
4
  "description": "An easy to use react component for impleting peer-to-peer chatting.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -32,11 +32,11 @@
32
32
  },
33
33
  "homepage": "https://github.com/SahilAggarwal2004/react-peer-chat#readme",
34
34
  "peerDependencies": {
35
- "react": ">=16.0.0",
36
- "react-dom": ">=16.0.0"
35
+ "react": ">=17.0.0",
36
+ "react-dom": ">=17.0.0"
37
37
  },
38
38
  "devDependencies": {
39
- "@types/react": "^18.2.48"
39
+ "@types/react": "^18.2.55"
40
40
  },
41
41
  "dependencies": {
42
42
  "peerjs": "^1.5.2"