@cloudflare/realtimekit-react 0.0.0 → 2.5.0-staging.88
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/README.md +86 -0
- package/build-types.sh +12 -0
- package/dist/index.cjs.js +23 -0
- package/dist/index.d.ts +56 -0
- package/dist/index.es.js +30980 -0
- package/example/App.tsx +37 -0
- package/example/components/Chat.tsx +48 -0
- package/example/components/Meeting.tsx +83 -0
- package/example/components/Participants.tsx +112 -0
- package/example/index.css +24 -0
- package/example/main.tsx +11 -0
- package/example/vite-env.d.ts +1 -0
- package/package.json +30 -4
- package/tsconfig.node.json +8 -0
- package/types/context.d.ts +36 -0
- package/types/index.d.ts +14 -0
package/README.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<!-- PROJECT LOGO -->
|
|
2
|
+
<p align="center">
|
|
3
|
+
<a href="https://cloudflare.com">
|
|
4
|
+
<img src="https://cf-assets.www.cloudflare.com/slt3lc6tev37/6EYsdkdfBcHtgPmgp3YtkD/0b203affd2053988264b9253b13de6b3/logo-thumbnail.png" alt="Logo" width="180">
|
|
5
|
+
</a>
|
|
6
|
+
<h3 align="center">RealtimeKit</h3>
|
|
7
|
+
|
|
8
|
+
<p align="center">
|
|
9
|
+
A real-time video and audio SDK for building custom, collaborative communication experiences.
|
|
10
|
+
<br />
|
|
11
|
+
<a href="https://docs.realtime.cloudflare.com"><strong>Explore the docs »</strong></a>
|
|
12
|
+
<br />
|
|
13
|
+
<br />
|
|
14
|
+
<a href="https://demo.realtime.cloudflare.com">View Demo</a>
|
|
15
|
+
·
|
|
16
|
+
<a href="https://community.cloudflare.com/">Report Bug</a>
|
|
17
|
+
·
|
|
18
|
+
<a href="https://community.cloudflare.com/">Request Feature</a>
|
|
19
|
+
</p>
|
|
20
|
+
</p>
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
<!-- TABLE OF CONTENTS -->
|
|
25
|
+
|
|
26
|
+
## Table of Contents
|
|
27
|
+
|
|
28
|
+
* [About the Project](#about-the-project)
|
|
29
|
+
* [Built With](#built-with)
|
|
30
|
+
* [Installation](#installation)
|
|
31
|
+
* [Usage](#usage)
|
|
32
|
+
* [About](#about)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
<!-- ABOUT THE PROJECT -->
|
|
37
|
+
## About The Project
|
|
38
|
+
|
|
39
|
+
A real-time video and audio SDK for building custom, collaborative communication experiences.
|
|
40
|
+
|
|
41
|
+
### Built With
|
|
42
|
+
|
|
43
|
+
* [Cloudflare](https://cloudflare.com)
|
|
44
|
+
* [Typescript](https://typescriptlang.org)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
<!-- INSTALLATION -->
|
|
48
|
+
## Installation
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
npm install @cloudflare/realtimekit-react
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
<!-- USAGE EXAMPLES -->
|
|
55
|
+
## Usage
|
|
56
|
+
|
|
57
|
+
A `meeting` object can be created using the `useRealtimeKitClient` hook.
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
const [meeting, initMeeting] = useRealtimeKitClient();
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
await initMeeting({
|
|
63
|
+
authToken: "<AuthTokenHere>",
|
|
64
|
+
defaults: {
|
|
65
|
+
audio: false,
|
|
66
|
+
video: false,
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}, []);
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
The `meeting` object is used for all interaction with Cloudflare's servers. For example, the following code snippet is used for a user to join a room.
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
await meeting.join();
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
_For more examples, please refer to the [Documentation](https://docs.realtime.cloudflare.com)._
|
|
80
|
+
|
|
81
|
+
## About
|
|
82
|
+
|
|
83
|
+
`@cloudflare/realtimekit` is created & maintained by Cloudflare, Inc.
|
|
84
|
+
|
|
85
|
+
The names and logos are trademarks of Cloudflare, Inc.
|
|
86
|
+
|
package/build-types.sh
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Back up the original package.json
|
|
3
|
+
cp package.json package.json.bak
|
|
4
|
+
|
|
5
|
+
# Remove all dependencies starting with the prefix @dyte-in
|
|
6
|
+
# The imported types from these dependencies will be bundled
|
|
7
|
+
# cat package.json.bak | jq '.dependencies |= delpaths([keys[] | select(contains("@dytesdk")) | [.]])' > package.json
|
|
8
|
+
|
|
9
|
+
npx tsup src/index.ts --external @protobuf-ts/runtime --external axios --dts-resolve --dts-only --format esm
|
|
10
|
+
|
|
11
|
+
mv package.json.bak package.json
|
|
12
|
+
find dist/ -name '*.d.ts' -exec sed -i '' '/#private;/d' {} +
|