@whereby.com/browser-sdk 2.0.0-alpha → 2.0.0-alpha2
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/dist/lib.cjs.js +5467 -0
- package/dist/lib.esm.js +5451 -0
- package/dist/types.d.ts +104 -0
- package/dist/v2-alpha2.js +105 -0
- package/package.json +6 -1
- package/.eslintrc +0 -23
- package/.github/actions/build/action.yml +0 -17
- package/.github/workflows/deploy.yml +0 -102
- package/.github/workflows/test.yml +0 -24
- package/.prettierignore +0 -7
- package/.prettierrc +0 -4
- package/.storybook/main.cjs +0 -16
- package/.storybook/preview.js +0 -9
- package/jest.config.js +0 -6
- package/rollup.config.js +0 -70
- package/src/lib/RoomConnection.ts +0 -516
- package/src/lib/RoomParticipant.ts +0 -77
- package/src/lib/__tests__/embed.unit.ts +0 -77
- package/src/lib/api/ApiClient.ts +0 -111
- package/src/lib/api/Credentials.ts +0 -45
- package/src/lib/api/HttpClient.ts +0 -95
- package/src/lib/api/MultipartHttpClient.ts +0 -53
- package/src/lib/api/OrganizationApiClient.ts +0 -64
- package/src/lib/api/Response.ts +0 -34
- package/src/lib/api/credentialsService/index.ts +0 -159
- package/src/lib/api/credentialsService/test/index.spec.ts +0 -181
- package/src/lib/api/deviceService/index.ts +0 -42
- package/src/lib/api/deviceService/tests/index.spec.ts +0 -74
- package/src/lib/api/extractUtils.ts +0 -160
- package/src/lib/api/index.ts +0 -8
- package/src/lib/api/localStorageWrapper/index.ts +0 -15
- package/src/lib/api/models/Account.ts +0 -48
- package/src/lib/api/models/Meeting.ts +0 -42
- package/src/lib/api/models/Organization.ts +0 -186
- package/src/lib/api/models/Room.ts +0 -44
- package/src/lib/api/models/account/EmbeddedFreeTierStatus.ts +0 -34
- package/src/lib/api/models/tests/Account.spec.ts +0 -128
- package/src/lib/api/models/tests/Organization.spec.ts +0 -161
- package/src/lib/api/models/tests/Room.spec.ts +0 -74
- package/src/lib/api/modules/AbstractStore.ts +0 -18
- package/src/lib/api/modules/ChromeStorageStore.ts +0 -44
- package/src/lib/api/modules/LocalStorageStore.ts +0 -57
- package/src/lib/api/modules/tests/ChromeStorageStore.spec.ts +0 -67
- package/src/lib/api/modules/tests/LocalStorageStore.spec.ts +0 -79
- package/src/lib/api/modules/tests/__mocks__/storage.ts +0 -24
- package/src/lib/api/organizationService/index.ts +0 -284
- package/src/lib/api/organizationService/tests/index.spec.ts +0 -781
- package/src/lib/api/organizationServiceCache/index.ts +0 -28
- package/src/lib/api/organizationServiceCache/tests/index.spec.ts +0 -101
- package/src/lib/api/parameterAssertUtils.ts +0 -166
- package/src/lib/api/roomService/index.ts +0 -310
- package/src/lib/api/roomService/tests/index.spec.ts +0 -668
- package/src/lib/api/test/ApiClient.spec.ts +0 -139
- package/src/lib/api/test/HttpClient.spec.ts +0 -120
- package/src/lib/api/test/MultipartHttpClient.spec.ts +0 -145
- package/src/lib/api/test/OrganizationApiClient.spec.ts +0 -132
- package/src/lib/api/test/extractUtils.spec.ts +0 -357
- package/src/lib/api/test/helpers.ts +0 -41
- package/src/lib/api/test/parameterAssertUtils.spec.ts +0 -265
- package/src/lib/api/types.ts +0 -6
- package/src/lib/embed.ts +0 -172
- package/src/lib/index.ts +0 -3
- package/src/lib/react/VideoElement.tsx +0 -16
- package/src/lib/react/index.ts +0 -3
- package/src/lib/react/useLocalMedia.ts +0 -25
- package/src/lib/react/useRoomConnection.ts +0 -92
- package/src/lib/reducer.ts +0 -142
- package/src/stories/custom-ui.stories.tsx +0 -133
- package/src/stories/prebuilt-ui.stories.tsx +0 -131
- package/src/stories/styles.css +0 -74
- package/src/types.d.ts +0 -175
- package/tsconfig.json +0 -30
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { Story } from "@storybook/react";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import "../lib/embed";
|
|
4
|
-
|
|
5
|
-
interface WherebyEmbedAttributes {
|
|
6
|
-
audio: boolean;
|
|
7
|
-
avatarUrl: string;
|
|
8
|
-
background: boolean;
|
|
9
|
-
cameraAccess: boolean;
|
|
10
|
-
chat: boolean;
|
|
11
|
-
displayName: string;
|
|
12
|
-
emptyRoomInvitation: string;
|
|
13
|
-
floatSelf: boolean;
|
|
14
|
-
help: boolean;
|
|
15
|
-
leaveButton: boolean;
|
|
16
|
-
logo: boolean;
|
|
17
|
-
people: boolean;
|
|
18
|
-
precallReview: boolean;
|
|
19
|
-
recording: boolean;
|
|
20
|
-
room: string;
|
|
21
|
-
screenshare: boolean;
|
|
22
|
-
video: boolean;
|
|
23
|
-
virtualBackgroundUrl: string;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export default {
|
|
27
|
-
title: "Examples/Pre-built UI",
|
|
28
|
-
argTypes: {
|
|
29
|
-
audio: { control: "boolean" },
|
|
30
|
-
avatarUrl: { control: "text", description: "Image url to use for avatar" },
|
|
31
|
-
background: { control: "boolean" },
|
|
32
|
-
cameraAccess: { control: "boolean" },
|
|
33
|
-
chat: { control: "boolean" },
|
|
34
|
-
displayName: { control: "text", description: "The name to use for the local participant" },
|
|
35
|
-
embed: { control: "boolean" },
|
|
36
|
-
emptyRoomInvitation: { control: "boolean" },
|
|
37
|
-
floatSelf: { control: "boolean" },
|
|
38
|
-
help: { control: "boolean" },
|
|
39
|
-
leaveButton: { control: "boolean" },
|
|
40
|
-
locking: { control: "boolean" },
|
|
41
|
-
logo: { control: "boolean" },
|
|
42
|
-
people: { control: "boolean" },
|
|
43
|
-
precallReview: { control: "boolean" },
|
|
44
|
-
recording: { control: "boolean" },
|
|
45
|
-
room: { control: "text" },
|
|
46
|
-
screenshare: { control: "boolean" },
|
|
47
|
-
topToolbar: { control: "boolean" },
|
|
48
|
-
video: { control: "boolean" },
|
|
49
|
-
virtualBackgroundUrl: { control: "text", description: "Image url to use for virtual background" },
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const offOn = (arg: boolean | string | undefined) => (arg ? "on" : "off");
|
|
54
|
-
|
|
55
|
-
const WherebyEmbed = ({
|
|
56
|
-
audio,
|
|
57
|
-
avatarUrl,
|
|
58
|
-
background,
|
|
59
|
-
cameraAccess,
|
|
60
|
-
chat,
|
|
61
|
-
displayName,
|
|
62
|
-
emptyRoomInvitation,
|
|
63
|
-
floatSelf,
|
|
64
|
-
help,
|
|
65
|
-
leaveButton,
|
|
66
|
-
logo,
|
|
67
|
-
people,
|
|
68
|
-
precallReview,
|
|
69
|
-
recording,
|
|
70
|
-
room,
|
|
71
|
-
screenshare,
|
|
72
|
-
video,
|
|
73
|
-
virtualBackgroundUrl,
|
|
74
|
-
}: Partial<WherebyEmbedAttributes>) => {
|
|
75
|
-
return (
|
|
76
|
-
<p>
|
|
77
|
-
<whereby-embed
|
|
78
|
-
audio={offOn(audio)}
|
|
79
|
-
avatarUrl={avatarUrl}
|
|
80
|
-
background={offOn(background)}
|
|
81
|
-
cameraAccess={offOn(cameraAccess)}
|
|
82
|
-
chat={offOn(chat)}
|
|
83
|
-
displayName={displayName}
|
|
84
|
-
emptyRoomInvitation={emptyRoomInvitation}
|
|
85
|
-
floatSelf={offOn(floatSelf)}
|
|
86
|
-
help={offOn(help)}
|
|
87
|
-
leaveButton={offOn(leaveButton)}
|
|
88
|
-
logo={offOn(logo)}
|
|
89
|
-
people={offOn(people)}
|
|
90
|
-
precallReview={offOn(precallReview)}
|
|
91
|
-
recording={offOn(recording)}
|
|
92
|
-
screenshare={offOn(screenshare)}
|
|
93
|
-
video={offOn(video)}
|
|
94
|
-
virtualBackgroundUrl={virtualBackgroundUrl}
|
|
95
|
-
room={room}
|
|
96
|
-
style={{ height: "100vh", width: "100%" }}
|
|
97
|
-
/>
|
|
98
|
-
</p>
|
|
99
|
-
);
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
const Template: Story<Partial<WherebyEmbedAttributes>> = (args) => WherebyEmbed(args);
|
|
103
|
-
export const WherebyEmbedElement = Template.bind({});
|
|
104
|
-
|
|
105
|
-
WherebyEmbedElement.args = {
|
|
106
|
-
audio: true,
|
|
107
|
-
avatarUrl: "",
|
|
108
|
-
background: true,
|
|
109
|
-
cameraAccess: true,
|
|
110
|
-
chat: true,
|
|
111
|
-
displayName: "Your name",
|
|
112
|
-
emptyRoomInvitation: "true",
|
|
113
|
-
floatSelf: false,
|
|
114
|
-
help: true,
|
|
115
|
-
leaveButton: true,
|
|
116
|
-
logo: true,
|
|
117
|
-
people: true,
|
|
118
|
-
precallReview: true,
|
|
119
|
-
room: process.env.STORYBOOK_ROOM,
|
|
120
|
-
screenshare: true,
|
|
121
|
-
video: true,
|
|
122
|
-
virtualBackgroundUrl: "",
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
WherebyEmbedElement.parameters = {
|
|
126
|
-
docs: {
|
|
127
|
-
transformSource: (src: string) => {
|
|
128
|
-
return (src || "").replace(/><iframe(.+)$/, " />");
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
};
|
package/src/stories/styles.css
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
.container {
|
|
2
|
-
display: flex;
|
|
3
|
-
min-height: 290px;
|
|
4
|
-
background-color: pink;
|
|
5
|
-
gap: 10px;
|
|
6
|
-
padding: 10px;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.participantWrapper {
|
|
10
|
-
position: relative;
|
|
11
|
-
flex-direction: column;
|
|
12
|
-
display: flex;
|
|
13
|
-
width: 140px;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.bouncingball {
|
|
17
|
-
width: 140px;
|
|
18
|
-
height: 140px;
|
|
19
|
-
border-radius: 100%;
|
|
20
|
-
background: #ccc;
|
|
21
|
-
animation: bounce 1s;
|
|
22
|
-
transform: translateY(0px);
|
|
23
|
-
animation-iteration-count: infinite;
|
|
24
|
-
position: absolute;
|
|
25
|
-
top: 25px;
|
|
26
|
-
overflow: hidden;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.displayName {
|
|
30
|
-
text-align: center;
|
|
31
|
-
color: #ffffff;
|
|
32
|
-
padding: 2px 4px;
|
|
33
|
-
border-radius: 3px;
|
|
34
|
-
background-color: rgba(0, 0, 0, 0.5);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.controls {
|
|
38
|
-
display: flex;
|
|
39
|
-
gap: 10px;
|
|
40
|
-
margin-top: 12px;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
@keyframes bounce {
|
|
44
|
-
0% {
|
|
45
|
-
top: 25px;
|
|
46
|
-
-webkit-animation-timing-function: ease-in;
|
|
47
|
-
}
|
|
48
|
-
40% {
|
|
49
|
-
}
|
|
50
|
-
50% {
|
|
51
|
-
top: 140px;
|
|
52
|
-
height: 140px;
|
|
53
|
-
-webkit-animation-timing-function: ease-out;
|
|
54
|
-
}
|
|
55
|
-
55% {
|
|
56
|
-
top: 160px;
|
|
57
|
-
height: 120px;
|
|
58
|
-
-webkit-animation-timing-function: ease-in;
|
|
59
|
-
}
|
|
60
|
-
65% {
|
|
61
|
-
top: 120px;
|
|
62
|
-
height: 140px;
|
|
63
|
-
-webkit-animation-timing-function: ease-out;
|
|
64
|
-
}
|
|
65
|
-
95% {
|
|
66
|
-
top: 25px;
|
|
67
|
-
-webkit-animation-timing-function: ease-in;
|
|
68
|
-
}
|
|
69
|
-
100% {
|
|
70
|
-
top: 25px;
|
|
71
|
-
-webkit-animation-timing-function: ease-in;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
package/src/types.d.ts
DELETED
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
declare module "heresy" {
|
|
2
|
-
interface AttrChanged {
|
|
3
|
-
attributeName: string;
|
|
4
|
-
oldValue: string | boolean;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
interface element {
|
|
8
|
-
observedAttributes?: string[];
|
|
9
|
-
onattributechanged?: (attrChanged: AttrChanged) => void;
|
|
10
|
-
onconnected?: () => void;
|
|
11
|
-
ondisconnected?: () => void;
|
|
12
|
-
oninit?: () => void;
|
|
13
|
-
render: () => void;
|
|
14
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
|
-
[x: string]: any;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function define(elementName: string, element: element): void;
|
|
19
|
-
export function ref(): boolean;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
declare module "@whereby/jslib-media/src/webrtc/RtcManagerDispatcher" {
|
|
23
|
-
enum RtcEventNames {
|
|
24
|
-
rtc_manager_created = "rtc_manager_created",
|
|
25
|
-
stream_added = "stream_added",
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
interface RtcManagerCreatedPayload {
|
|
29
|
-
rtcManager: RtcManager;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
interface RtcStreamAddedPayload {
|
|
33
|
-
clientId: string;
|
|
34
|
-
stream: MediaStream;
|
|
35
|
-
streamId: string;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
type RtcEvents = {
|
|
39
|
-
rtc_manager_created: RtcManagerCreatedPayload;
|
|
40
|
-
stream_added: RtcStreamAddedPayload;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
interface ConstructorArgs {
|
|
44
|
-
emitter: { emit: <K extends keyof RtcEvents>(eventName: K, args: RtcEvents[K]) => void };
|
|
45
|
-
serverSocket: ServerSocket;
|
|
46
|
-
webrtcProvider: {
|
|
47
|
-
getMediaConstraints: () => { audio: boolean; video: boolean };
|
|
48
|
-
deferrable: (clientId: string) => boolean;
|
|
49
|
-
};
|
|
50
|
-
features: {
|
|
51
|
-
lowDataModeEnabled: boolean;
|
|
52
|
-
sfuServerOverrideHost: undefined;
|
|
53
|
-
turnServerOverrideHost: undefined;
|
|
54
|
-
useOnlyTURN: undefined;
|
|
55
|
-
vp9On: boolean;
|
|
56
|
-
h264On: boolean;
|
|
57
|
-
simulcastScreenshareOn: boolean;
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
export default class RtcManagerDispatcher {
|
|
61
|
-
constructor(args: ConstructorArgs);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
declare module "@whereby/jslib-media/src/webrtc/RtcManager" {
|
|
66
|
-
export default interface RtcManager {
|
|
67
|
-
acceptNewStream: ({
|
|
68
|
-
activeBreakout: boolean,
|
|
69
|
-
clientId: string,
|
|
70
|
-
shouldAddLocalVideo: boolean,
|
|
71
|
-
streamId: string,
|
|
72
|
-
}) => void;
|
|
73
|
-
addNewStream: (streamId: string, stream: MediaStream, isAudioEnabled: boolean, isVideoEnabled: boolean) => void;
|
|
74
|
-
disconnect(streamId: string, activeBreakout: boolean): void;
|
|
75
|
-
shouldAcceptStreamsFromBothSides?: () => boolean;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
declare module "@whereby/jslib-media/src/utils/urls" {
|
|
80
|
-
export function fromLocation({ host }: { host: string }): { subdomain: string };
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
declare module "@whereby/jslib-media/src/utils/ServerSocket" {
|
|
84
|
-
interface SocketConf {
|
|
85
|
-
host?: string;
|
|
86
|
-
path?: string;
|
|
87
|
-
reconnectionDelay?: number;
|
|
88
|
-
reconnectoinDelayMax?: number;
|
|
89
|
-
timeout?: number;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
interface ClientRole {
|
|
93
|
-
roleName: string;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
interface SignalClient {
|
|
97
|
-
displayName: string;
|
|
98
|
-
id: string;
|
|
99
|
-
streams: string[];
|
|
100
|
-
isAudioEnabled: boolean;
|
|
101
|
-
isVideoEnabled: boolean;
|
|
102
|
-
role: ClientRole;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
interface AudioEnabledEvent {
|
|
106
|
-
clientId: string;
|
|
107
|
-
isAudioEnabled: boolean;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
interface ClientLeftEvent {
|
|
111
|
-
clientId: string;
|
|
112
|
-
}
|
|
113
|
-
interface NewClientEvent {
|
|
114
|
-
client: SignalClient;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
interface RoomJoinedEvent {
|
|
118
|
-
room: {
|
|
119
|
-
clients: SignalClient[];
|
|
120
|
-
};
|
|
121
|
-
selfId: string;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
interface VideoEnabledEvent {
|
|
125
|
-
clientId: string;
|
|
126
|
-
isVideoEnabled: boolean;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
interface ClientMetadataReceivedEvent {
|
|
130
|
-
type: string;
|
|
131
|
-
payload: { clientId: string; displayName: string };
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
interface SignalEvents {
|
|
135
|
-
audio_enabled: AudioEnabledEvent;
|
|
136
|
-
client_left: ClientLeftEvent;
|
|
137
|
-
client_metadata_received: ClientMetadataReceivedEvent;
|
|
138
|
-
connect: void;
|
|
139
|
-
device_identified: void;
|
|
140
|
-
new_client: NewClientEvent;
|
|
141
|
-
room_joined: RoomJoinedEvent;
|
|
142
|
-
room_left: void;
|
|
143
|
-
video_enabled: VideoEnabledEvent;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
interface IdentifyDeviceRequest {
|
|
147
|
-
deviceCredentials: Credentials;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
interface JoinRoomRequest {
|
|
151
|
-
config: { isAudioEnabled: boolean; isVideoEnabled: boolean };
|
|
152
|
-
organizationId: string;
|
|
153
|
-
roomName: string;
|
|
154
|
-
displayName?: string;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
interface SignalRequests {
|
|
158
|
-
enable_audio: { enabled: boolean };
|
|
159
|
-
enable_video: { enabled: boolean };
|
|
160
|
-
identify_device: IdentifyDeviceRequest;
|
|
161
|
-
join_room: JoinRoomRequest;
|
|
162
|
-
leave_room: void;
|
|
163
|
-
send_client_metadata: { type: string; payload: { displayName?: string } };
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
export default class ServerSocket {
|
|
167
|
-
constructor(host: string, conf?: SocketConf);
|
|
168
|
-
|
|
169
|
-
connect(): void;
|
|
170
|
-
disconnect(): void;
|
|
171
|
-
emit<K extends keyof SignalRequests>(eventName: K, payload?: SignalRequests[k]);
|
|
172
|
-
on<K extends keyof SignalEvents>(eventName: K, callback: (args: SignalEvents[K]) => void);
|
|
173
|
-
once<K extends keyof SignalEvents>(eventName: K, callback: (args: SignalEvents[K]) => void);
|
|
174
|
-
}
|
|
175
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "es6",
|
|
4
|
-
"downlevelIteration": true,
|
|
5
|
-
"importHelpers": true,
|
|
6
|
-
"lib": ["dom", "dom.iterable", "esnext", "es2015.collection", "es2015.iterable"],
|
|
7
|
-
"allowJs": true,
|
|
8
|
-
"checkJs": false,
|
|
9
|
-
"skipLibCheck": true,
|
|
10
|
-
"esModuleInterop": true,
|
|
11
|
-
"allowSyntheticDefaultImports": true,
|
|
12
|
-
"strict": true,
|
|
13
|
-
"forceConsistentCasingInFileNames": true,
|
|
14
|
-
"noFallthroughCasesInSwitch": true,
|
|
15
|
-
"module": "esnext",
|
|
16
|
-
"moduleResolution": "node",
|
|
17
|
-
"resolveJsonModule": true,
|
|
18
|
-
"isolatedModules": true,
|
|
19
|
-
"noEmit": true,
|
|
20
|
-
"declaration": true,
|
|
21
|
-
"jsx": "react",
|
|
22
|
-
"baseUrl": "./",
|
|
23
|
-
"paths": {
|
|
24
|
-
"~/*": ["src/*"],
|
|
25
|
-
"@tests/*": ["tests/*"],
|
|
26
|
-
"@types": ["src/__types__/index.ts"]
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
"include": ["src/**/*.ts", "src/**/*.tsx", "tests/**/*.ts", "tests/**/*.tsx"]
|
|
30
|
-
}
|