@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/dist/index.d.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import RTKClient, { RealtimeKitClientOptions } from '@cloudflare/realtimekit';
|
|
2
|
+
export { RTKBasicParticipant, RTKConnectedMeetings, RTKParticipant, RTKParticipantMap, RTKParticipants, RTKPermissionsPreset, RTKPlugin, RTKSelf, RTKSelfMedia, RTKThemePreset } from '@cloudflare/realtimekit';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import React, { ReactNode } from 'react';
|
|
5
|
+
|
|
6
|
+
type Listener = () => void;
|
|
7
|
+
declare class RTKUpdates {
|
|
8
|
+
private meeting;
|
|
9
|
+
private l;
|
|
10
|
+
constructor(meeting: RTKClient);
|
|
11
|
+
clean(): void;
|
|
12
|
+
addListener(listener: Listener): void;
|
|
13
|
+
removeListener(listener: Listener): void;
|
|
14
|
+
private onUpdate;
|
|
15
|
+
}
|
|
16
|
+
declare const RealtimeKitContext: React.Context<{
|
|
17
|
+
meeting: DyteClient | undefined;
|
|
18
|
+
updates: RTKUpdates | undefined;
|
|
19
|
+
}>;
|
|
20
|
+
/**
|
|
21
|
+
* Provider component which makes the RealtimeKit meeting object
|
|
22
|
+
* available to nested components
|
|
23
|
+
* @component
|
|
24
|
+
* @param value The RealtimeKitClient instance from `useRealtimeKitClient()`
|
|
25
|
+
* @param fallback Any fallback UI you want to render until the instance initialises.
|
|
26
|
+
*/
|
|
27
|
+
declare function RealtimeKitProvider({ value, children, fallback, }: {
|
|
28
|
+
value: RTKClient | undefined;
|
|
29
|
+
children: ReactNode;
|
|
30
|
+
fallback?: ReactNode;
|
|
31
|
+
}): react_jsx_runtime.JSX.Element;
|
|
32
|
+
/**
|
|
33
|
+
* Hook which returns the reference to the RealtimeKit meeting object
|
|
34
|
+
* @returns meeting instance
|
|
35
|
+
*/
|
|
36
|
+
declare const useRealtimeKitMeeting: () => {
|
|
37
|
+
meeting: any;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
interface DyteClientParams {
|
|
41
|
+
resetOnLeave?: boolean;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Hook to get and intialise an instance of RealtimeKit meeting object
|
|
46
|
+
*/
|
|
47
|
+
declare const useRealtimeKitClient: (dyteClientParams?: DyteClientParams) => readonly [RTKClient | undefined, (options: RealtimeKitClientOptions) => Promise<RTKClient | undefined>];
|
|
48
|
+
type StateSelector<T extends object, U> = (state: T) => U;
|
|
49
|
+
/**
|
|
50
|
+
* Hook which extracts data from the RealtimeKit meeting object and re-renders on change.
|
|
51
|
+
* @param selector The selector function which takes the meeting object and returns a slice of state
|
|
52
|
+
* @returns The slice of state returned by the selector function
|
|
53
|
+
*/
|
|
54
|
+
declare const useRealtimeKitSelector: <StateSlice>(selector: StateSelector<RTKClient, StateSlice>) => StateSlice;
|
|
55
|
+
|
|
56
|
+
export { RealtimeKitContext, RealtimeKitProvider, useRealtimeKitClient, useRealtimeKitMeeting, useRealtimeKitSelector };
|