@whereby.com/browser-sdk 2.1.0-beta.1 → 2.1.0-beta.2
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/cdn/v2-embed-beta.js +16 -0
- package/dist/cdn/v2-react-beta.js +3 -0
- package/dist/core/index.d.ts +2320 -0
- package/dist/core/index.js +63283 -0
- package/dist/embed/index.d.ts +109 -0
- package/dist/embed/index.esm.js +156 -0
- package/dist/react/index.d.ts +860 -0
- package/dist/react/index.esm.js +10585 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.esm.js +70 -0
- package/package.json +1 -1
|
@@ -0,0 +1,860 @@
|
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
|
+
import * as redux_thunk from 'redux-thunk';
|
|
3
|
+
import { AxiosRequestConfig } from 'axios';
|
|
4
|
+
import EventEmitter from 'events';
|
|
5
|
+
import * as _reduxjs_toolkit from '@reduxjs/toolkit';
|
|
6
|
+
import * as redux from 'redux';
|
|
7
|
+
import _whereby_jslib_media_src_utils_ServerSocket, { ChatMessage as ChatMessage$2 } from '@whereby/jslib-media/src/utils/ServerSocket';
|
|
8
|
+
import RtcManagerDispatcher from '@whereby/jslib-media/src/webrtc/RtcManagerDispatcher';
|
|
9
|
+
import RtcManager from '@whereby/jslib-media/src/webrtc/RtcManager';
|
|
10
|
+
|
|
11
|
+
interface VideoViewSelfProps {
|
|
12
|
+
stream: MediaStream;
|
|
13
|
+
muted?: boolean;
|
|
14
|
+
mirror?: boolean;
|
|
15
|
+
style?: React$1.CSSProperties;
|
|
16
|
+
onResize?: ({ width, height, stream }: {
|
|
17
|
+
width: number;
|
|
18
|
+
height: number;
|
|
19
|
+
stream: MediaStream;
|
|
20
|
+
}) => void;
|
|
21
|
+
onSetAspectRatio?: ({ aspectRatio }: {
|
|
22
|
+
aspectRatio: number;
|
|
23
|
+
}) => void;
|
|
24
|
+
}
|
|
25
|
+
type VideoViewProps = VideoViewSelfProps & React$1.DetailedHTMLProps<React$1.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>;
|
|
26
|
+
declare const _default: ({ muted, mirror, stream, onResize, onSetAspectRatio, ...rest }: VideoViewProps) => React$1.JSX.Element;
|
|
27
|
+
|
|
28
|
+
type Json = string | number | boolean | null | Array<Json> | {
|
|
29
|
+
[key: string]: Json;
|
|
30
|
+
};
|
|
31
|
+
interface ResponseOptions {
|
|
32
|
+
data?: Json;
|
|
33
|
+
headers?: Record<string, unknown>;
|
|
34
|
+
status?: number;
|
|
35
|
+
statusText?: string;
|
|
36
|
+
url?: string | null;
|
|
37
|
+
}
|
|
38
|
+
declare class Response {
|
|
39
|
+
data: Json;
|
|
40
|
+
headers: Record<string, unknown>;
|
|
41
|
+
status: number;
|
|
42
|
+
statusText: string;
|
|
43
|
+
url: string | null;
|
|
44
|
+
constructor(initialValues?: ResponseOptions);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
declare class EmbeddedFreeTierStatus {
|
|
48
|
+
isExhausted: boolean;
|
|
49
|
+
renewsAt: Date;
|
|
50
|
+
totalMinutesLimit: number;
|
|
51
|
+
totalMinutesUsed: number;
|
|
52
|
+
constructor({ isExhausted, renewsAt, totalMinutesLimit, totalMinutesUsed, }: {
|
|
53
|
+
isExhausted: boolean;
|
|
54
|
+
renewsAt: Date;
|
|
55
|
+
totalMinutesLimit: number;
|
|
56
|
+
totalMinutesUsed: number;
|
|
57
|
+
});
|
|
58
|
+
static fromJson(data: Record<string, unknown>): EmbeddedFreeTierStatus;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
interface AccountProps {
|
|
62
|
+
basePlanId: string | null;
|
|
63
|
+
isDeactivated: boolean;
|
|
64
|
+
isOnTrial: boolean;
|
|
65
|
+
onTrialUntil: Date | null;
|
|
66
|
+
trialStatus: string | null;
|
|
67
|
+
embeddedFreeTierStatus: EmbeddedFreeTierStatus | null;
|
|
68
|
+
}
|
|
69
|
+
declare class Account {
|
|
70
|
+
basePlanId: string | null;
|
|
71
|
+
embeddedFreeTierStatus: EmbeddedFreeTierStatus | null;
|
|
72
|
+
isDeactivated: boolean;
|
|
73
|
+
isOnTrial: boolean;
|
|
74
|
+
onTrialUntil: Date | null;
|
|
75
|
+
trialStatus: string | null;
|
|
76
|
+
constructor({ basePlanId, embeddedFreeTierStatus, isDeactivated, isOnTrial, onTrialUntil, trialStatus, }: AccountProps);
|
|
77
|
+
static fromJson(data: Record<string, unknown>): Account;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
interface OrganizationPermissionAction {
|
|
81
|
+
isAllowed: boolean;
|
|
82
|
+
isSupported: boolean;
|
|
83
|
+
}
|
|
84
|
+
interface FullOrganizationPermissions {
|
|
85
|
+
images: {
|
|
86
|
+
logoImageUrl: {
|
|
87
|
+
set: OrganizationPermissionAction;
|
|
88
|
+
reset: OrganizationPermissionAction;
|
|
89
|
+
};
|
|
90
|
+
roomBackgroundImageUrl: {
|
|
91
|
+
set: OrganizationPermissionAction;
|
|
92
|
+
reset: OrganizationPermissionAction;
|
|
93
|
+
};
|
|
94
|
+
roomKnockPageBackgroundImageUrl: {
|
|
95
|
+
set: OrganizationPermissionAction;
|
|
96
|
+
reset: OrganizationPermissionAction;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
invitations: {
|
|
100
|
+
add: OrganizationPermissionAction;
|
|
101
|
+
delete: OrganizationPermissionAction;
|
|
102
|
+
list: OrganizationPermissionAction;
|
|
103
|
+
};
|
|
104
|
+
roles: {
|
|
105
|
+
set: OrganizationPermissionAction;
|
|
106
|
+
remove: OrganizationPermissionAction;
|
|
107
|
+
removeSelf: OrganizationPermissionAction;
|
|
108
|
+
list: OrganizationPermissionAction;
|
|
109
|
+
};
|
|
110
|
+
users: {
|
|
111
|
+
signUpWithoutInvitation: OrganizationPermissionAction;
|
|
112
|
+
};
|
|
113
|
+
rooms: {
|
|
114
|
+
customize: OrganizationPermissionAction;
|
|
115
|
+
customizeSelf: OrganizationPermissionAction;
|
|
116
|
+
list: OrganizationPermissionAction;
|
|
117
|
+
lock: OrganizationPermissionAction;
|
|
118
|
+
unclaim: OrganizationPermissionAction;
|
|
119
|
+
unclaimSelf: OrganizationPermissionAction;
|
|
120
|
+
};
|
|
121
|
+
subscriptions: {
|
|
122
|
+
add: OrganizationPermissionAction;
|
|
123
|
+
list: OrganizationPermissionAction;
|
|
124
|
+
payLatestInvoice: OrganizationPermissionAction;
|
|
125
|
+
updatePlan: OrganizationPermissionAction;
|
|
126
|
+
};
|
|
127
|
+
browserExtension: {
|
|
128
|
+
install: OrganizationPermissionAction;
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
type OrganizationPermissions = Partial<FullOrganizationPermissions>;
|
|
132
|
+
interface OrganizationLimits {
|
|
133
|
+
maxNumberOfInvitationsAndUsers: number | null;
|
|
134
|
+
maxNumberOfClaimedRooms: number | null;
|
|
135
|
+
maxRoomLimitPerOrganization: number | null;
|
|
136
|
+
trialMinutesLimit: number | null;
|
|
137
|
+
includedUnits: number | null;
|
|
138
|
+
}
|
|
139
|
+
interface OrganizationOnboardingSurvey {
|
|
140
|
+
name: string;
|
|
141
|
+
value: unknown;
|
|
142
|
+
}
|
|
143
|
+
type OrganizationPreferences = Record<string, boolean | string | null | number>;
|
|
144
|
+
declare class Organization {
|
|
145
|
+
static GLOBAL_ORGANIZATION_ID: string;
|
|
146
|
+
organizationId: string;
|
|
147
|
+
organizationName: string;
|
|
148
|
+
subdomain: string;
|
|
149
|
+
permissions: OrganizationPermissions;
|
|
150
|
+
limits: OrganizationLimits;
|
|
151
|
+
account: Account | null;
|
|
152
|
+
logoImageUrl: string | null;
|
|
153
|
+
roomBackgroundImageUrl: string | null;
|
|
154
|
+
roomBackgroundThumbnailUrl: string | null;
|
|
155
|
+
roomKnockPageBackgroundImageUrl: string | null;
|
|
156
|
+
roomKnockPageBackgroundThumbnailUrl: string | null;
|
|
157
|
+
preferences: OrganizationPreferences | null;
|
|
158
|
+
onboardingSurvey: OrganizationOnboardingSurvey | null;
|
|
159
|
+
type: string | null;
|
|
160
|
+
constructor(properties: {
|
|
161
|
+
account: Account | null;
|
|
162
|
+
organizationId: string;
|
|
163
|
+
organizationName: string;
|
|
164
|
+
subdomain: string;
|
|
165
|
+
permissions: OrganizationPermissions;
|
|
166
|
+
limits: OrganizationLimits;
|
|
167
|
+
logoImageUrl: string | null;
|
|
168
|
+
roomBackgroundImageUrl: string | null;
|
|
169
|
+
roomBackgroundThumbnailUrl: string | null;
|
|
170
|
+
roomKnockPageBackgroundImageUrl: string | null;
|
|
171
|
+
roomKnockPageBackgroundThumbnailUrl: string | null;
|
|
172
|
+
preferences: OrganizationPreferences | null;
|
|
173
|
+
onboardingSurvey: OrganizationOnboardingSurvey | null;
|
|
174
|
+
type: string | null;
|
|
175
|
+
});
|
|
176
|
+
static fromJson(data: Json): Organization;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
type HttpClientRequestConfig = AxiosRequestConfig | {
|
|
180
|
+
[key: string]: unknown;
|
|
181
|
+
};
|
|
182
|
+
interface IHttpClient {
|
|
183
|
+
request(url: string, options: HttpClientRequestConfig): Promise<Response>;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Class used for making http calls. This is just a pure
|
|
187
|
+
* wrapper around the http lib that we decide to use,
|
|
188
|
+
* so that we can switch implementations.
|
|
189
|
+
*/
|
|
190
|
+
declare class HttpClient implements IHttpClient {
|
|
191
|
+
_baseUrl: string;
|
|
192
|
+
/**
|
|
193
|
+
* Creates an HttpClient instance.
|
|
194
|
+
*
|
|
195
|
+
* @param {string} [baseUrl] - The base URL where all requests are made.
|
|
196
|
+
*/
|
|
197
|
+
constructor({ baseUrl }: {
|
|
198
|
+
baseUrl: string;
|
|
199
|
+
});
|
|
200
|
+
private _requestAxios;
|
|
201
|
+
/**
|
|
202
|
+
* Wrapper for the axios API
|
|
203
|
+
*
|
|
204
|
+
* @param {string} url - Required. URL (appended to base URL) where API call will be made
|
|
205
|
+
* @param {object} options - Required. Contains the data needed for the fetch API
|
|
206
|
+
* @return {Promise<Response>} - A promise which will return a Response object (https://developer.mozilla.org/en-US/docs/Web/API/Response)
|
|
207
|
+
*/
|
|
208
|
+
request(url: string, options: HttpClientRequestConfig): Promise<Response>;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* ApiClient for doing multipart/form-data requests.
|
|
213
|
+
*/
|
|
214
|
+
declare class MultipartHttpClient implements IHttpClient {
|
|
215
|
+
_httpClient: IHttpClient;
|
|
216
|
+
constructor({ httpClient }: {
|
|
217
|
+
httpClient: IHttpClient;
|
|
218
|
+
});
|
|
219
|
+
/**
|
|
220
|
+
* Convert the provided object to a FormData object containing the same keys and values.
|
|
221
|
+
* @param {object} data - the data to convert.
|
|
222
|
+
* @returns {FormData}
|
|
223
|
+
*/
|
|
224
|
+
static dataToFormData(data: Record<string, string>): FormData;
|
|
225
|
+
/**
|
|
226
|
+
* Request a resource using multipart/form-data encoding.
|
|
227
|
+
*
|
|
228
|
+
* @param {string} url - the url to request
|
|
229
|
+
* @param {object} options - Required. Contains the data needed for the fetch API
|
|
230
|
+
* @return {Promise<Response>} - A promise which will return a Response object (https://developer.mozilla.org/en-US/docs/Web/API/Response)
|
|
231
|
+
*/
|
|
232
|
+
request(url: string, options?: HttpClientRequestConfig): Promise<Response>;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
interface CredentialsOptions {
|
|
236
|
+
uuid: string;
|
|
237
|
+
hmac: string;
|
|
238
|
+
userId?: string;
|
|
239
|
+
}
|
|
240
|
+
declare class Credentials {
|
|
241
|
+
credentials: {
|
|
242
|
+
uuid: CredentialsOptions["uuid"];
|
|
243
|
+
};
|
|
244
|
+
hmac: CredentialsOptions["hmac"];
|
|
245
|
+
userId: CredentialsOptions["userId"];
|
|
246
|
+
constructor(uuid: CredentialsOptions["uuid"], hmac: CredentialsOptions["hmac"], userId?: CredentialsOptions["userId"]);
|
|
247
|
+
toJson(): Json;
|
|
248
|
+
static fromJson(json: Json): Credentials;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
interface AuthenticatedHttpClientOptions {
|
|
252
|
+
httpClient: HttpClient;
|
|
253
|
+
fetchDeviceCredentials: () => Promise<Credentials | null>;
|
|
254
|
+
}
|
|
255
|
+
declare class AuthenticatedHttpClient {
|
|
256
|
+
private _httpClient;
|
|
257
|
+
private _fetchDeviceCredentials;
|
|
258
|
+
constructor({ httpClient, fetchDeviceCredentials }: AuthenticatedHttpClientOptions);
|
|
259
|
+
request(url: string, options: HttpClientRequestConfig): Promise<Response>;
|
|
260
|
+
}
|
|
261
|
+
interface ApiClientOptions {
|
|
262
|
+
baseUrl?: string;
|
|
263
|
+
fetchDeviceCredentials?: AuthenticatedHttpClientOptions["fetchDeviceCredentials"];
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Class used for all Whereby API calls.
|
|
267
|
+
*/
|
|
268
|
+
declare class ApiClient {
|
|
269
|
+
authenticatedHttpClient: AuthenticatedHttpClient;
|
|
270
|
+
authenticatedFormDataHttpClient: MultipartHttpClient;
|
|
271
|
+
/**
|
|
272
|
+
* Create an ApiClient instance.
|
|
273
|
+
*/
|
|
274
|
+
constructor({ baseUrl, fetchDeviceCredentials, }?: ApiClientOptions);
|
|
275
|
+
/**
|
|
276
|
+
* Wrapper for the fetch API
|
|
277
|
+
*/
|
|
278
|
+
request(url: string, options: HttpClientRequestConfig): Promise<Response>;
|
|
279
|
+
/**
|
|
280
|
+
* Performs a multipart request where data is multipart/form-data encoded.
|
|
281
|
+
*/
|
|
282
|
+
requestMultipart(url: string, options: HttpClientRequestConfig): Promise<Response>;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Related to device calls needed to obtain credentials
|
|
287
|
+
*/
|
|
288
|
+
declare class DeviceService {
|
|
289
|
+
_apiClient: ApiClient;
|
|
290
|
+
constructor({ apiClient }: {
|
|
291
|
+
apiClient: ApiClient;
|
|
292
|
+
});
|
|
293
|
+
/**
|
|
294
|
+
* Get's the device credentials needed for most of the other API services
|
|
295
|
+
*
|
|
296
|
+
* @return {Promise} A promise which is fulfilled or failed based on the
|
|
297
|
+
* response.
|
|
298
|
+
*/
|
|
299
|
+
getCredentials(): Promise<Credentials | null>;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
interface AbstractStore {
|
|
303
|
+
loadOrDefault(defaultValue: Json): Promise<Json>;
|
|
304
|
+
save(value: Json): Promise<void>;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
declare class CredentialsService extends EventEmitter {
|
|
308
|
+
_deviceService: DeviceService;
|
|
309
|
+
_credentialsStore: AbstractStore;
|
|
310
|
+
credentialsPromise?: Promise<Credentials | null>;
|
|
311
|
+
/**
|
|
312
|
+
* Service to manage Whereby's Rest API credentials.
|
|
313
|
+
*
|
|
314
|
+
* @param {ObjectStore} credentialsStore - Store to manage the credentials.
|
|
315
|
+
*/
|
|
316
|
+
constructor({ deviceService, credentialsStore, }: {
|
|
317
|
+
deviceService: DeviceService;
|
|
318
|
+
credentialsStore: AbstractStore;
|
|
319
|
+
});
|
|
320
|
+
static create({ baseUrl, storeName, storeType, }: {
|
|
321
|
+
baseUrl: string;
|
|
322
|
+
storeName?: string;
|
|
323
|
+
storeType?: "localStorage" | "chromeStorage";
|
|
324
|
+
}): CredentialsService;
|
|
325
|
+
/**
|
|
326
|
+
* Contacts the REST API to get new credentials. DO NOT USE directly, call getCredentials() instead.
|
|
327
|
+
*
|
|
328
|
+
* @see getCredentials
|
|
329
|
+
* @returns {Promise.<Credentials>} - Promise that resolves with the credentials.
|
|
330
|
+
*/
|
|
331
|
+
_fetchNewCredentialsFromApi(): Promise<Credentials | null>;
|
|
332
|
+
/**
|
|
333
|
+
* Returns the current credentials without triggering an API request to get new ones.
|
|
334
|
+
* If no credentials are currently available it will return null.
|
|
335
|
+
*
|
|
336
|
+
* @returns {?Credentials} - The credentials currently in use, null otherwise.
|
|
337
|
+
*/
|
|
338
|
+
getCurrentCredentials(): Promise<Credentials | null>;
|
|
339
|
+
/**
|
|
340
|
+
* Returns a promise that will contain the credentials for this client.
|
|
341
|
+
* If no credentials are available in local storage, new ones will be fetched from the server.
|
|
342
|
+
*
|
|
343
|
+
* @returns {Promise.<Credentials>} - Promise that resolves with the credentials.
|
|
344
|
+
*/
|
|
345
|
+
getCredentials(): Promise<Credentials | null>;
|
|
346
|
+
/**
|
|
347
|
+
* Saves new credentials which replace the existing ones and abort any pending request to get new ones.
|
|
348
|
+
*
|
|
349
|
+
* @param {Credentials} credentials - New credentials to store.
|
|
350
|
+
*/
|
|
351
|
+
saveCredentials(credentials: Credentials): Promise<Credentials>;
|
|
352
|
+
/**
|
|
353
|
+
* It will set the userId for the current credentials.
|
|
354
|
+
*
|
|
355
|
+
* @param userId - The user id to set.
|
|
356
|
+
*/
|
|
357
|
+
setUserId(userId: string | null): Promise<void>;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
type UserConsentAction = "accepted" | "rejected" | null;
|
|
361
|
+
type ConsentGrantRequest = {
|
|
362
|
+
readonly consentRevisionId: string;
|
|
363
|
+
readonly action: UserConsentAction;
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
declare class OrganizationService {
|
|
367
|
+
_apiClient: ApiClient;
|
|
368
|
+
constructor({ apiClient }: {
|
|
369
|
+
apiClient: ApiClient;
|
|
370
|
+
});
|
|
371
|
+
/**
|
|
372
|
+
* Creates an organization.
|
|
373
|
+
*/
|
|
374
|
+
createOrganization({ organizationName, subdomain, owner, }: {
|
|
375
|
+
organizationName: string;
|
|
376
|
+
subdomain: string;
|
|
377
|
+
owner: {
|
|
378
|
+
email: string;
|
|
379
|
+
displayName: string;
|
|
380
|
+
verificationCode: string;
|
|
381
|
+
consents?: ReadonlyArray<ConsentGrantRequest>;
|
|
382
|
+
} | {
|
|
383
|
+
idToken: string;
|
|
384
|
+
displayName: string;
|
|
385
|
+
consents?: ReadonlyArray<ConsentGrantRequest>;
|
|
386
|
+
};
|
|
387
|
+
}): Promise<string>;
|
|
388
|
+
/**
|
|
389
|
+
* Retrieves the organization based on the subdomain.
|
|
390
|
+
*/
|
|
391
|
+
getOrganizationBySubdomain(subdomain: string): Promise<Organization | null>;
|
|
392
|
+
/**
|
|
393
|
+
* Retrieves the organization based on the organizationId.
|
|
394
|
+
*
|
|
395
|
+
* Note: This endpoint should only be used to retrieve an organization when the device is linked
|
|
396
|
+
* to a user in that organization. Use getOrganizationBySubdomain instead if you just want the information
|
|
397
|
+
* about an organization that is mapped to a given subdomain.
|
|
398
|
+
*/
|
|
399
|
+
getOrganizationByOrganizationId(organizationId: string): Promise<Organization | null>;
|
|
400
|
+
/**
|
|
401
|
+
* Retrieves the organizations that contain a user
|
|
402
|
+
* matching provided the email+code or phoneNumber+code
|
|
403
|
+
* combination.
|
|
404
|
+
*/
|
|
405
|
+
getOrganizationsByContactPoint(options: {
|
|
406
|
+
email: string;
|
|
407
|
+
code: string;
|
|
408
|
+
} | {
|
|
409
|
+
phoneNumber: string;
|
|
410
|
+
code: string;
|
|
411
|
+
}): Promise<ReadonlyArray<Organization>>;
|
|
412
|
+
/**
|
|
413
|
+
* Retrieves the organizations that contain a user
|
|
414
|
+
* matching provided the idToken
|
|
415
|
+
*/
|
|
416
|
+
getOrganizationsByIdToken({ idToken }: {
|
|
417
|
+
idToken: string;
|
|
418
|
+
}): Promise<ReadonlyArray<Organization>>;
|
|
419
|
+
/**
|
|
420
|
+
* Retrieves the organizations containing a user
|
|
421
|
+
* with either the email or phoneNumber matching the logged in user.
|
|
422
|
+
*
|
|
423
|
+
* This is useful for showing the possible organization that the current
|
|
424
|
+
* user could log in to.
|
|
425
|
+
*/
|
|
426
|
+
getOrganizationsByLoggedInUser(): Promise<ReadonlyArray<Organization>>;
|
|
427
|
+
/**
|
|
428
|
+
* Checks if a subdomain is available and verifies its format.
|
|
429
|
+
*/
|
|
430
|
+
getSubdomainAvailability(subdomain: string): Promise<{
|
|
431
|
+
status: string;
|
|
432
|
+
}>;
|
|
433
|
+
/**
|
|
434
|
+
* Updates preferences of the organization.
|
|
435
|
+
*/
|
|
436
|
+
updatePreferences({ organizationId, preferences, }: {
|
|
437
|
+
organizationId: string;
|
|
438
|
+
preferences: OrganizationPreferences;
|
|
439
|
+
}): Promise<undefined>;
|
|
440
|
+
/**
|
|
441
|
+
* Delete organization
|
|
442
|
+
*/
|
|
443
|
+
deleteOrganization({ organizationId }: {
|
|
444
|
+
organizationId: string;
|
|
445
|
+
}): Promise<undefined>;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
interface RoomParticipantData {
|
|
449
|
+
displayName: string;
|
|
450
|
+
id: string;
|
|
451
|
+
stream?: MediaStream;
|
|
452
|
+
isAudioEnabled: boolean;
|
|
453
|
+
isVideoEnabled: boolean;
|
|
454
|
+
}
|
|
455
|
+
declare class RoomParticipant {
|
|
456
|
+
readonly displayName: string;
|
|
457
|
+
readonly id: string;
|
|
458
|
+
readonly stream?: MediaStream;
|
|
459
|
+
readonly isAudioEnabled: boolean;
|
|
460
|
+
readonly isLocalParticipant: boolean;
|
|
461
|
+
readonly isVideoEnabled: boolean;
|
|
462
|
+
constructor({ displayName, id, stream, isAudioEnabled, isVideoEnabled }: RoomParticipantData);
|
|
463
|
+
}
|
|
464
|
+
type StreamState = "new_accept" | "to_accept" | "old_accept" | "done_accept" | "to_unaccept" | "done_unaccept" | "auto";
|
|
465
|
+
interface Stream {
|
|
466
|
+
id: string;
|
|
467
|
+
state: StreamState;
|
|
468
|
+
}
|
|
469
|
+
interface RemoteParticipant {
|
|
470
|
+
id: string;
|
|
471
|
+
displayName: string;
|
|
472
|
+
isAudioEnabled: boolean;
|
|
473
|
+
isVideoEnabled: boolean;
|
|
474
|
+
isLocalParticipant: boolean;
|
|
475
|
+
stream: (MediaStream & {
|
|
476
|
+
inboundId?: string;
|
|
477
|
+
}) | null;
|
|
478
|
+
streams: Stream[];
|
|
479
|
+
newJoiner: boolean;
|
|
480
|
+
presentationStream: (MediaStream & {
|
|
481
|
+
inboundId?: string;
|
|
482
|
+
}) | null;
|
|
483
|
+
}
|
|
484
|
+
declare class LocalParticipant extends RoomParticipant {
|
|
485
|
+
readonly isLocalParticipant = true;
|
|
486
|
+
constructor({ displayName, id, stream, isAudioEnabled, isVideoEnabled }: RoomParticipantData);
|
|
487
|
+
}
|
|
488
|
+
interface WaitingParticipant {
|
|
489
|
+
id: string;
|
|
490
|
+
displayName: string | null;
|
|
491
|
+
}
|
|
492
|
+
interface Screenshare {
|
|
493
|
+
participantId: string;
|
|
494
|
+
id: string;
|
|
495
|
+
hasAudioTrack: boolean;
|
|
496
|
+
stream?: MediaStream;
|
|
497
|
+
isLocal: boolean;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* Reducer
|
|
502
|
+
*/
|
|
503
|
+
interface WaitingParticipantsState {
|
|
504
|
+
waitingParticipants: WaitingParticipant[];
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* Reducer
|
|
509
|
+
*/
|
|
510
|
+
interface StreamingState {
|
|
511
|
+
isStreaming: boolean;
|
|
512
|
+
error: unknown;
|
|
513
|
+
startedAt?: number;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* Reducer
|
|
518
|
+
*/
|
|
519
|
+
interface rtcAnalyticsState {
|
|
520
|
+
reportedValues: {
|
|
521
|
+
[key: string]: unknown;
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
interface LocalScreenshareState {
|
|
526
|
+
status: "" | "starting" | "active";
|
|
527
|
+
stream: MediaStream | null;
|
|
528
|
+
error: unknown | null;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
interface LocalParticipantState$1 extends LocalParticipantState {
|
|
532
|
+
isScreenSharing: boolean;
|
|
533
|
+
roleName: string;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* Reducer
|
|
538
|
+
*/
|
|
539
|
+
interface CloudRecordingState$1 {
|
|
540
|
+
isRecording: boolean;
|
|
541
|
+
error: unknown;
|
|
542
|
+
status?: "recording" | "requested" | "error";
|
|
543
|
+
startedAt?: number;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
type ChatMessage$1 = Pick<ChatMessage$2, "senderId" | "timestamp" | "text">;
|
|
547
|
+
/**
|
|
548
|
+
* Reducer
|
|
549
|
+
*/
|
|
550
|
+
interface ChatState {
|
|
551
|
+
chatMessages: ChatMessage$1[];
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* Reducer
|
|
556
|
+
*/
|
|
557
|
+
interface AppState {
|
|
558
|
+
wantsToJoin: boolean;
|
|
559
|
+
roomUrl: string | null;
|
|
560
|
+
roomName: string | null;
|
|
561
|
+
roomKey: string | null;
|
|
562
|
+
displayName: string | null;
|
|
563
|
+
sdkVersion: string | null;
|
|
564
|
+
externalId: string | null;
|
|
565
|
+
isNodeSdk: boolean;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* Reducer
|
|
570
|
+
*/
|
|
571
|
+
interface DeviceCredentialsState {
|
|
572
|
+
isFetching: boolean;
|
|
573
|
+
data?: Credentials | null;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
type LocalMediaOptions = {
|
|
577
|
+
disabled?: boolean;
|
|
578
|
+
audio: boolean;
|
|
579
|
+
video: boolean;
|
|
580
|
+
};
|
|
581
|
+
/**
|
|
582
|
+
* Reducer
|
|
583
|
+
*/
|
|
584
|
+
interface LocalMediaState$1 {
|
|
585
|
+
busyDeviceIds: string[];
|
|
586
|
+
cameraDeviceError?: unknown;
|
|
587
|
+
cameraEnabled: boolean;
|
|
588
|
+
currentCameraDeviceId?: string;
|
|
589
|
+
currentMicrophoneDeviceId?: string;
|
|
590
|
+
devices: MediaDeviceInfo[];
|
|
591
|
+
isSettingCameraDevice: boolean;
|
|
592
|
+
isSettingMicrophoneDevice: boolean;
|
|
593
|
+
isTogglingCamera: boolean;
|
|
594
|
+
microphoneDeviceError?: unknown;
|
|
595
|
+
microphoneEnabled: boolean;
|
|
596
|
+
options?: LocalMediaOptions;
|
|
597
|
+
status: "" | "stopped" | "starting" | "started" | "error";
|
|
598
|
+
startError?: unknown;
|
|
599
|
+
stream?: MediaStream;
|
|
600
|
+
isSwitchingStream: boolean;
|
|
601
|
+
onDeviceChange?: () => void;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* Reducer
|
|
606
|
+
*/
|
|
607
|
+
interface OrganizationState {
|
|
608
|
+
data: Organization | null | undefined;
|
|
609
|
+
isFetching: boolean;
|
|
610
|
+
error: unknown;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* Reducer
|
|
615
|
+
*/
|
|
616
|
+
interface RemoteParticipantState$1 {
|
|
617
|
+
remoteParticipants: RemoteParticipant[];
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
type ConnectionStatus$1 = "initializing" | "connecting" | "connected" | "reconnect" | "room_locked" | "knocking" | "disconnecting" | "disconnected" | "knock_rejected";
|
|
621
|
+
/**
|
|
622
|
+
* Reducer
|
|
623
|
+
*/
|
|
624
|
+
interface RoomConnectionState$1 {
|
|
625
|
+
session: {
|
|
626
|
+
createdAt: string;
|
|
627
|
+
id: string;
|
|
628
|
+
} | null;
|
|
629
|
+
status: ConnectionStatus$1;
|
|
630
|
+
error: unknown;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* Reducer
|
|
635
|
+
*/
|
|
636
|
+
interface StreamResolutionUpdate {
|
|
637
|
+
streamId: string;
|
|
638
|
+
width: number;
|
|
639
|
+
height: number;
|
|
640
|
+
}
|
|
641
|
+
interface RtcConnectionState {
|
|
642
|
+
dispatcherCreated: boolean;
|
|
643
|
+
error: unknown;
|
|
644
|
+
isCreatingDispatcher: boolean;
|
|
645
|
+
reportedStreamResolutions: {
|
|
646
|
+
[streamId: string]: Omit<StreamResolutionUpdate, "streamId">;
|
|
647
|
+
};
|
|
648
|
+
rtcManager: RtcManager | null;
|
|
649
|
+
rtcManagerDispatcher: RtcManagerDispatcher | null;
|
|
650
|
+
rtcManagerInitialized: boolean;
|
|
651
|
+
status: "" | "ready" | "reconnect";
|
|
652
|
+
isAcceptingStreams: boolean;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
/**
|
|
656
|
+
* Reducer
|
|
657
|
+
*/
|
|
658
|
+
interface SignalConnectionState {
|
|
659
|
+
deviceIdentified: boolean;
|
|
660
|
+
isIdentifyingDevice: boolean;
|
|
661
|
+
status: "connected" | "connecting" | "disconnected" | "reconnect" | "";
|
|
662
|
+
socket: _whereby_jslib_media_src_utils_ServerSocket | null;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
declare function createServices(): {
|
|
666
|
+
credentialsService: CredentialsService;
|
|
667
|
+
apiClient: ApiClient;
|
|
668
|
+
organizationService: OrganizationService;
|
|
669
|
+
fetchOrganizationFromRoomUrl: (roomUrl: string) => Promise<Organization | null>;
|
|
670
|
+
};
|
|
671
|
+
|
|
672
|
+
declare const createStore: ({ preloadedState, injectServices, }: {
|
|
673
|
+
preloadedState?: Partial<{
|
|
674
|
+
app: AppState;
|
|
675
|
+
chat: ChatState;
|
|
676
|
+
cloudRecording: CloudRecordingState$1;
|
|
677
|
+
deviceCredentials: DeviceCredentialsState;
|
|
678
|
+
localMedia: LocalMediaState$1;
|
|
679
|
+
localParticipant: LocalParticipantState$1;
|
|
680
|
+
localScreenshare: LocalScreenshareState;
|
|
681
|
+
organization: OrganizationState;
|
|
682
|
+
remoteParticipants: RemoteParticipantState$1;
|
|
683
|
+
roomConnection: RoomConnectionState$1;
|
|
684
|
+
rtcAnalytics: rtcAnalyticsState;
|
|
685
|
+
rtcConnection: RtcConnectionState;
|
|
686
|
+
signalConnection: SignalConnectionState;
|
|
687
|
+
streaming: StreamingState;
|
|
688
|
+
waitingParticipants: WaitingParticipantsState;
|
|
689
|
+
}> | undefined;
|
|
690
|
+
injectServices: ReturnType<typeof createServices>;
|
|
691
|
+
}) => _reduxjs_toolkit.EnhancedStore<{
|
|
692
|
+
app: AppState;
|
|
693
|
+
chat: ChatState;
|
|
694
|
+
cloudRecording: CloudRecordingState$1;
|
|
695
|
+
deviceCredentials: DeviceCredentialsState;
|
|
696
|
+
localMedia: LocalMediaState$1;
|
|
697
|
+
localParticipant: LocalParticipantState$1;
|
|
698
|
+
localScreenshare: LocalScreenshareState;
|
|
699
|
+
organization: OrganizationState;
|
|
700
|
+
remoteParticipants: RemoteParticipantState$1;
|
|
701
|
+
roomConnection: RoomConnectionState$1;
|
|
702
|
+
rtcAnalytics: rtcAnalyticsState;
|
|
703
|
+
rtcConnection: RtcConnectionState;
|
|
704
|
+
signalConnection: SignalConnectionState;
|
|
705
|
+
streaming: StreamingState;
|
|
706
|
+
waitingParticipants: WaitingParticipantsState;
|
|
707
|
+
}, redux.UnknownAction, _reduxjs_toolkit.Tuple<[redux.StoreEnhancer<{
|
|
708
|
+
dispatch: ((action: redux.Action<"listenerMiddleware/add">) => _reduxjs_toolkit.UnsubscribeListener) & redux_thunk.ThunkDispatch<{
|
|
709
|
+
app: AppState;
|
|
710
|
+
chat: ChatState;
|
|
711
|
+
cloudRecording: CloudRecordingState$1;
|
|
712
|
+
deviceCredentials: DeviceCredentialsState;
|
|
713
|
+
localMedia: LocalMediaState$1;
|
|
714
|
+
localParticipant: LocalParticipantState$1;
|
|
715
|
+
localScreenshare: LocalScreenshareState;
|
|
716
|
+
organization: OrganizationState;
|
|
717
|
+
remoteParticipants: RemoteParticipantState$1;
|
|
718
|
+
roomConnection: RoomConnectionState$1;
|
|
719
|
+
rtcAnalytics: rtcAnalyticsState;
|
|
720
|
+
rtcConnection: RtcConnectionState;
|
|
721
|
+
signalConnection: SignalConnectionState;
|
|
722
|
+
streaming: StreamingState;
|
|
723
|
+
waitingParticipants: WaitingParticipantsState;
|
|
724
|
+
}, {
|
|
725
|
+
services: {
|
|
726
|
+
credentialsService: CredentialsService;
|
|
727
|
+
apiClient: ApiClient;
|
|
728
|
+
organizationService: OrganizationService;
|
|
729
|
+
fetchOrganizationFromRoomUrl: (roomUrl: string) => Promise<Organization | null>;
|
|
730
|
+
};
|
|
731
|
+
}, redux.UnknownAction>;
|
|
732
|
+
}>, redux.StoreEnhancer]>>;
|
|
733
|
+
type Store = ReturnType<typeof createStore>;
|
|
734
|
+
|
|
735
|
+
declare const sdkVersion = "__SDK_VERSION__";
|
|
736
|
+
|
|
737
|
+
interface LocalMediaState {
|
|
738
|
+
currentCameraDeviceId?: string;
|
|
739
|
+
currentMicrophoneDeviceId?: string;
|
|
740
|
+
cameraDeviceError: unknown;
|
|
741
|
+
cameraDevices: MediaDeviceInfo[];
|
|
742
|
+
isSettingCameraDevice: boolean;
|
|
743
|
+
isSettingMicrophoneDevice: boolean;
|
|
744
|
+
isStarting: boolean;
|
|
745
|
+
localStream?: MediaStream;
|
|
746
|
+
microphoneDeviceError: unknown;
|
|
747
|
+
microphoneDevices: MediaDeviceInfo[];
|
|
748
|
+
speakerDevices: MediaDeviceInfo[];
|
|
749
|
+
startError: unknown;
|
|
750
|
+
}
|
|
751
|
+
interface LocalMediaActions {
|
|
752
|
+
setCameraDevice: (deviceId: string) => void;
|
|
753
|
+
setMicrophoneDevice: (deviceId: string) => void;
|
|
754
|
+
toggleCameraEnabled: (enabled?: boolean) => void;
|
|
755
|
+
toggleMicrophoneEnabled: (enabled?: boolean) => void;
|
|
756
|
+
}
|
|
757
|
+
type UseLocalMediaResult = {
|
|
758
|
+
state: LocalMediaState;
|
|
759
|
+
actions: LocalMediaActions;
|
|
760
|
+
store: Store;
|
|
761
|
+
};
|
|
762
|
+
type UseLocalMediaOptions = LocalMediaOptions;
|
|
763
|
+
|
|
764
|
+
type RemoteParticipantState = Omit<RemoteParticipant, "newJoiner" | "streams">;
|
|
765
|
+
type LocalParticipantState = LocalParticipant;
|
|
766
|
+
interface WaitingParticipantState {
|
|
767
|
+
id: string;
|
|
768
|
+
displayName: string | null;
|
|
769
|
+
}
|
|
770
|
+
interface ChatMessageState {
|
|
771
|
+
senderId: string;
|
|
772
|
+
timestamp: string;
|
|
773
|
+
text: string;
|
|
774
|
+
}
|
|
775
|
+
type ScreenshareState = Screenshare;
|
|
776
|
+
type LocalScreenshareStatus = "starting" | "active";
|
|
777
|
+
type ChatMessage = Pick<ChatMessage$2, "senderId" | "timestamp" | "text">;
|
|
778
|
+
type ConnectionStatus = "initializing" | "connecting" | "connected" | "reconnect" | "room_locked" | "knocking" | "disconnecting" | "disconnected" | "knock_rejected";
|
|
779
|
+
type CloudRecordingState = {
|
|
780
|
+
error?: string;
|
|
781
|
+
status: "recording" | "requested" | "error";
|
|
782
|
+
startedAt?: number;
|
|
783
|
+
};
|
|
784
|
+
type LiveStreamState = {
|
|
785
|
+
status: "streaming";
|
|
786
|
+
startedAt?: number;
|
|
787
|
+
};
|
|
788
|
+
interface RoomConnectionState {
|
|
789
|
+
chatMessages: ChatMessage[];
|
|
790
|
+
cloudRecording?: CloudRecordingState;
|
|
791
|
+
localScreenshareStatus?: LocalScreenshareStatus;
|
|
792
|
+
localParticipant?: LocalParticipantState;
|
|
793
|
+
remoteParticipants: RemoteParticipantState[];
|
|
794
|
+
screenshares: Screenshare[];
|
|
795
|
+
connectionStatus: ConnectionStatus;
|
|
796
|
+
liveStream?: LiveStreamState;
|
|
797
|
+
waitingParticipants: WaitingParticipantState[];
|
|
798
|
+
}
|
|
799
|
+
interface RoomConnectionOptions {
|
|
800
|
+
displayName?: string;
|
|
801
|
+
localMediaOptions?: LocalMediaOptions;
|
|
802
|
+
roomKey?: string;
|
|
803
|
+
localMedia?: UseLocalMediaResult;
|
|
804
|
+
externalId?: string;
|
|
805
|
+
}
|
|
806
|
+
interface UseRoomConnectionOptions extends Omit<RoomConnectionOptions, "localMedia"> {
|
|
807
|
+
localMedia?: UseLocalMediaResult;
|
|
808
|
+
}
|
|
809
|
+
interface RoomConnectionActions {
|
|
810
|
+
sendChatMessage(text: string): void;
|
|
811
|
+
knock(): void;
|
|
812
|
+
setDisplayName(displayName: string): void;
|
|
813
|
+
toggleCamera(enabled?: boolean): void;
|
|
814
|
+
toggleMicrophone(enabled?: boolean): void;
|
|
815
|
+
acceptWaitingParticipant(participantId: string): void;
|
|
816
|
+
rejectWaitingParticipant(participantId: string): void;
|
|
817
|
+
startCloudRecording(): void;
|
|
818
|
+
startScreenshare(): void;
|
|
819
|
+
stopCloudRecording(): void;
|
|
820
|
+
stopScreenshare(): void;
|
|
821
|
+
}
|
|
822
|
+
type VideoViewComponentProps = Omit<React.ComponentProps<typeof _default>, "onResize">;
|
|
823
|
+
interface RoomConnectionComponents {
|
|
824
|
+
VideoView: (props: VideoViewComponentProps) => ReturnType<typeof _default>;
|
|
825
|
+
}
|
|
826
|
+
type RoomConnectionRef = {
|
|
827
|
+
state: RoomConnectionState;
|
|
828
|
+
actions: RoomConnectionActions;
|
|
829
|
+
components: RoomConnectionComponents;
|
|
830
|
+
_ref: Store;
|
|
831
|
+
};
|
|
832
|
+
|
|
833
|
+
declare function useRoomConnection(roomUrl: string, roomConnectionOptions?: UseRoomConnectionOptions): RoomConnectionRef;
|
|
834
|
+
|
|
835
|
+
declare function useLocalMedia(optionsOrStream?: UseLocalMediaOptions | MediaStream): UseLocalMediaResult;
|
|
836
|
+
|
|
837
|
+
type Origin = {
|
|
838
|
+
top: number;
|
|
839
|
+
left: number;
|
|
840
|
+
};
|
|
841
|
+
type Bounds = {
|
|
842
|
+
width: number;
|
|
843
|
+
height: number;
|
|
844
|
+
};
|
|
845
|
+
|
|
846
|
+
interface GridProps {
|
|
847
|
+
roomConnection: RoomConnectionRef;
|
|
848
|
+
renderParticipant?: ({ cell, participant, }: {
|
|
849
|
+
cell: {
|
|
850
|
+
clientId: string;
|
|
851
|
+
bounds: Bounds;
|
|
852
|
+
origin: Origin;
|
|
853
|
+
};
|
|
854
|
+
participant: RemoteParticipantState | LocalParticipantState;
|
|
855
|
+
}) => React$1.ReactNode;
|
|
856
|
+
videoGridGap?: number;
|
|
857
|
+
}
|
|
858
|
+
declare function Grid({ roomConnection, renderParticipant, videoGridGap }: GridProps): React$1.JSX.Element;
|
|
859
|
+
|
|
860
|
+
export { type ChatMessageState as ChatMessage, type LocalParticipantState as LocalParticipant, type RemoteParticipantState as RemoteParticipant, type RoomConnectionState as RoomConnection, type ScreenshareState as Screenshare, type UseLocalMediaResult, Grid as VideoGrid, _default as VideoView, type WaitingParticipantState as WaitingParticipant, sdkVersion, useLocalMedia, useRoomConnection };
|