@whereby.com/browser-sdk 2.0.0-alpha → 2.0.0-alpha10

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.
Files changed (73) hide show
  1. package/README.md +39 -2
  2. package/dist/lib.cjs +5868 -0
  3. package/dist/lib.esm.js +5850 -0
  4. package/dist/types.d.ts +308 -0
  5. package/dist/v2-alpha10.js +43 -0
  6. package/package.json +12 -6
  7. package/.eslintrc +0 -23
  8. package/.github/actions/build/action.yml +0 -17
  9. package/.github/workflows/deploy.yml +0 -102
  10. package/.github/workflows/test.yml +0 -24
  11. package/.prettierignore +0 -7
  12. package/.prettierrc +0 -4
  13. package/.storybook/main.cjs +0 -16
  14. package/.storybook/preview.js +0 -9
  15. package/jest.config.js +0 -6
  16. package/rollup.config.js +0 -70
  17. package/src/lib/RoomConnection.ts +0 -516
  18. package/src/lib/RoomParticipant.ts +0 -77
  19. package/src/lib/__tests__/embed.unit.ts +0 -77
  20. package/src/lib/api/ApiClient.ts +0 -111
  21. package/src/lib/api/Credentials.ts +0 -45
  22. package/src/lib/api/HttpClient.ts +0 -95
  23. package/src/lib/api/MultipartHttpClient.ts +0 -53
  24. package/src/lib/api/OrganizationApiClient.ts +0 -64
  25. package/src/lib/api/Response.ts +0 -34
  26. package/src/lib/api/credentialsService/index.ts +0 -159
  27. package/src/lib/api/credentialsService/test/index.spec.ts +0 -181
  28. package/src/lib/api/deviceService/index.ts +0 -42
  29. package/src/lib/api/deviceService/tests/index.spec.ts +0 -74
  30. package/src/lib/api/extractUtils.ts +0 -160
  31. package/src/lib/api/index.ts +0 -8
  32. package/src/lib/api/localStorageWrapper/index.ts +0 -15
  33. package/src/lib/api/models/Account.ts +0 -48
  34. package/src/lib/api/models/Meeting.ts +0 -42
  35. package/src/lib/api/models/Organization.ts +0 -186
  36. package/src/lib/api/models/Room.ts +0 -44
  37. package/src/lib/api/models/account/EmbeddedFreeTierStatus.ts +0 -34
  38. package/src/lib/api/models/tests/Account.spec.ts +0 -128
  39. package/src/lib/api/models/tests/Organization.spec.ts +0 -161
  40. package/src/lib/api/models/tests/Room.spec.ts +0 -74
  41. package/src/lib/api/modules/AbstractStore.ts +0 -18
  42. package/src/lib/api/modules/ChromeStorageStore.ts +0 -44
  43. package/src/lib/api/modules/LocalStorageStore.ts +0 -57
  44. package/src/lib/api/modules/tests/ChromeStorageStore.spec.ts +0 -67
  45. package/src/lib/api/modules/tests/LocalStorageStore.spec.ts +0 -79
  46. package/src/lib/api/modules/tests/__mocks__/storage.ts +0 -24
  47. package/src/lib/api/organizationService/index.ts +0 -284
  48. package/src/lib/api/organizationService/tests/index.spec.ts +0 -781
  49. package/src/lib/api/organizationServiceCache/index.ts +0 -28
  50. package/src/lib/api/organizationServiceCache/tests/index.spec.ts +0 -101
  51. package/src/lib/api/parameterAssertUtils.ts +0 -166
  52. package/src/lib/api/roomService/index.ts +0 -310
  53. package/src/lib/api/roomService/tests/index.spec.ts +0 -668
  54. package/src/lib/api/test/ApiClient.spec.ts +0 -139
  55. package/src/lib/api/test/HttpClient.spec.ts +0 -120
  56. package/src/lib/api/test/MultipartHttpClient.spec.ts +0 -145
  57. package/src/lib/api/test/OrganizationApiClient.spec.ts +0 -132
  58. package/src/lib/api/test/extractUtils.spec.ts +0 -357
  59. package/src/lib/api/test/helpers.ts +0 -41
  60. package/src/lib/api/test/parameterAssertUtils.spec.ts +0 -265
  61. package/src/lib/api/types.ts +0 -6
  62. package/src/lib/embed.ts +0 -172
  63. package/src/lib/index.ts +0 -3
  64. package/src/lib/react/VideoElement.tsx +0 -16
  65. package/src/lib/react/index.ts +0 -3
  66. package/src/lib/react/useLocalMedia.ts +0 -25
  67. package/src/lib/react/useRoomConnection.ts +0 -92
  68. package/src/lib/reducer.ts +0 -142
  69. package/src/stories/custom-ui.stories.tsx +0 -133
  70. package/src/stories/prebuilt-ui.stories.tsx +0 -131
  71. package/src/stories/styles.css +0 -74
  72. package/src/types.d.ts +0 -175
  73. package/tsconfig.json +0 -30
package/README.md CHANGED
@@ -20,6 +20,42 @@ yarn add @whereby.com/browser-sdk
20
20
 
21
21
  ### React hooks
22
22
 
23
+ #### useLocalMedia
24
+ The `useLocalMedia` hook enables preview and selection of local devices (camera & microphone) prior to establishing a connection within a Whereby room. Use this hook to build rich pre-call
25
+ experiences, allowing end users to confirm their device selection up-front. This hook works seamlessly with the `useRoomConnection` hook described below.
26
+
27
+ ```
28
+ import { useLocalMedia, VideoView } from “@whereby.com/browser-sdk”;
29
+
30
+ function MyPreCallUX() {
31
+ const localMedia = useLocalMedia({ audio: false, video: true });
32
+
33
+ const { currentCameraDeviceId, cameraDevices, localStream } = localMedia.state;
34
+ const { setCameraDevice, toggleCameraEnabled } = localMedia.actions;
35
+ const { VideoView } = components;
36
+
37
+ return <div className="preCallView">
38
+ { /* Render any UI, making use of state */ }
39
+ { cameraDevices.map((d) => (
40
+ <p
41
+ key={d.deviceId}
42
+ onClick={() => {
43
+ if (d.deviceId !== currentCameraDeviceId) {
44
+ setCameraDevice(d.deviceId);
45
+ }
46
+ }}
47
+ >
48
+ {d.label}
49
+ </p>
50
+ )) }
51
+ <VideoView muted stream={localStream} />
52
+ </div>;
53
+ }
54
+
55
+ ```
56
+
57
+
58
+ #### useRoomConnection
23
59
  The `useRoomConnection` hook provides a way to connect participants in a given room, subscribe to state updates, and perform actions on the connection, like toggling camera or microphone.
24
60
 
25
61
  ```
@@ -29,10 +65,11 @@ function MyCallUX( { roomUrl, localStream }) {
29
65
  const [state, actions, components ] = useRoomConnection(
30
66
  "<room_url>"
31
67
  {
32
- localMediaConstraints: {
68
+ localMedia: null, // Supply localMedia from `useLocalMedia` hook, or constraints below
69
+ localMediaConstraints: {
33
70
  audio: true,
34
71
  video: true,
35
- },
72
+ }
36
73
  }
37
74
  );
38
75