@naviedu/room-platform-react 0.0.2 → 0.0.3-8.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.
Files changed (70) hide show
  1. package/README.md +43 -39
  2. package/index.d.ts +766 -32
  3. package/index.esm.js +19618 -7889
  4. package/package.json +4 -7
  5. package/styles.css +199 -24
  6. package/assets/ATTRIBUTION.md +0 -46
  7. package/assets/presets/alpine-lake-mirror.jpg +0 -0
  8. package/assets/presets/alpine-lake.jpg +0 -0
  9. package/assets/presets/canyon-view-mirror.jpg +0 -0
  10. package/assets/presets/canyon-view.jpg +0 -0
  11. package/assets/presets/desert-dunes-mirror.jpg +0 -0
  12. package/assets/presets/desert-dunes.jpg +0 -0
  13. package/assets/presets/flower-meadow-mirror.jpg +0 -0
  14. package/assets/presets/flower-meadow.jpg +0 -0
  15. package/assets/presets/forest-road-mirror.jpg +0 -0
  16. package/assets/presets/forest-road.jpg +0 -0
  17. package/assets/presets/naviedu-mirror.jpg +0 -0
  18. package/assets/presets/naviedu.jpg +0 -0
  19. package/assets/presets/ocean-cliffs-mirror.jpg +0 -0
  20. package/assets/presets/ocean-cliffs.jpg +0 -0
  21. package/assets/presets/tropical-beach-mirror.jpg +0 -0
  22. package/assets/presets/tropical-beach.jpg +0 -0
  23. package/assets/presets/waterfall-mist-mirror.jpg +0 -0
  24. package/assets/presets/waterfall-mist.jpg +0 -0
  25. package/extensions/room-platform-extensions.d.ts +0 -8
  26. package/room-action-button.d.ts +0 -11
  27. package/room-participant-actions.d.ts +0 -9
  28. package/room-participant-list.d.ts +0 -7
  29. package/room-participant-tab.d.ts +0 -6
  30. package/room-platform-active-speaker.d.ts +0 -4
  31. package/room-platform-background-settings.d.ts +0 -15
  32. package/room-platform-camera-background-presets.d.ts +0 -8
  33. package/room-platform-camera-background-storage.d.ts +0 -38
  34. package/room-platform-control-anchor.d.ts +0 -10
  35. package/room-platform-control-bar.d.ts +0 -11
  36. package/room-platform-control-state.d.ts +0 -12
  37. package/room-platform-current-operation-strip.d.ts +0 -13
  38. package/room-platform-device-selection.d.ts +0 -7
  39. package/room-platform-device-settings.d.ts +0 -8
  40. package/room-platform-local-preview.d.ts +0 -6
  41. package/room-platform-media-controls.d.ts +0 -1
  42. package/room-platform-media-runtime.d.ts +0 -2
  43. package/room-platform-monitor-stage.d.ts +0 -7
  44. package/room-platform-monitor-video-tile.d.ts +0 -20
  45. package/room-platform-monitor-viewer.d.ts +0 -8
  46. package/room-platform-private-room-connection.d.ts +0 -11
  47. package/room-platform-private-room-context.d.ts +0 -8
  48. package/room-platform-private-room-control-bar.d.ts +0 -12
  49. package/room-platform-private-room-experience.d.ts +0 -14
  50. package/room-platform-private-room-overlay.d.ts +0 -7
  51. package/room-platform-private-room-stage.d.ts +0 -9
  52. package/room-platform-private-room-status-banner.d.ts +0 -8
  53. package/room-platform-provider.d.ts +0 -35
  54. package/room-platform-room.d.ts +0 -2
  55. package/room-platform-screen-share-whiteboard-frame.d.ts +0 -11
  56. package/room-platform-shell.d.ts +0 -17
  57. package/room-platform-speak-queue.d.ts +0 -16
  58. package/room-platform-stage-selection.d.ts +0 -14
  59. package/room-platform-stage.d.ts +0 -13
  60. package/room-platform-surface-boundary.d.ts +0 -13
  61. package/room-platform-top-bar.d.ts +0 -7
  62. package/room-platform-types.d.ts +0 -154
  63. package/room-platform-ui-primitives.d.ts +0 -60
  64. package/room-platform-video-tile.d.ts +0 -13
  65. package/room-platform-video-tracks.d.ts +0 -6
  66. package/use-room-platform-camera-background.d.ts +0 -34
  67. package/use-room-platform-private-room-control-actions.d.ts +0 -21
  68. package/use-room-platform-private-room.d.ts +0 -43
  69. package/use-room-platform-stage.d.ts +0 -2
  70. package/use-room-presence.d.ts +0 -2
package/README.md CHANGED
@@ -27,14 +27,12 @@ runtime dependencies are installed automatically with the package.
27
27
 
28
28
  ## Basic usage
29
29
 
30
- Import the package stylesheet once, then render `RoomPlatformRoom` with the
31
- launch ticket returned by your backend:
30
+ Render `RoomPlatformRoom` with the launch ticket returned by your backend:
32
31
 
33
32
  ```tsx
34
33
  'use client'
35
34
 
36
35
  import { type RoomLaunchTicketRenewalReason, RoomPlatformRoom } from '@naviedu/room-platform-react'
37
- import '@naviedu/room-platform-react/styles.css'
38
36
 
39
37
  type RoomTicketResponse = { launchToken: string }
40
38
 
@@ -61,6 +59,10 @@ export function Room({ launchToken }: { launchToken: string }) {
61
59
  }
62
60
  ```
63
61
 
62
+ `RoomPlatformRoom` renders its default room UI in an isolated Shadow Root and installs the package stylesheet itself. Do not import `@naviedu/room-platform-react/styles.css` for the default component.
63
+
64
+ `RoomPlatformProvider` is advanced composition only; a consumer using it instead of `RoomPlatformRoom` owns its own DOM and stylesheet boundary.
65
+
64
66
  `apiBaseUrl` is the URL prefix before `/rooms`. The package calls these routes
65
67
  relative to it:
66
68
 
@@ -83,15 +85,21 @@ layout that allows the room to occupy the viewport.
83
85
  | `launchToken` | Yes | Initial server-issued launch ticket. |
84
86
  | `onLaunchTicketRequired` | Yes | Returns `{ launchToken }` when the current ticket or access session must be renewed. |
85
87
  | `extensions` | No | Host-provided top-bar, workspace, sidebar, monitor, and participant extensions. |
86
- | `integrations` | No | Chat and whiteboard configuration. |
87
- | `isPracticeMode` | No | Enables practice-room presentation behavior. |
88
- | `showLocalPreview` | No | Shows the local preview in the sidebar. Defaults to `true`. |
89
- | `primaryCameraSelector` | No | Selects the primary camera track when the default selection is not suitable. |
90
88
  | `onError` | No | Receives connection, media, and action errors. |
91
89
  | `onLifecycleEvent` | No | Receives exchange, renewal, and reconnect lifecycle events. |
92
90
  | `onExit` | No | Called when the user chooses to leave the room. |
93
91
  | `children` | No | Replaces the default workspace while keeping the provider and room runtime. |
94
92
 
93
+ The default teaching stage selects the available participant camera carrying
94
+ the canonical `room:moderate` capability. Screen share remains primary and the
95
+ moderator camera becomes its overlay. If no moderator camera is available, the
96
+ stage keeps its waiting state and never promotes a student camera. The local
97
+ sidebar preview is hidden only when that selected moderator camera is local;
98
+ its existing desktop breakpoint remains unchanged.
99
+
100
+ The public room keeps one canonical local camera track. It may be preview-only
101
+ before publication, and preview visibility never grants `media:publish_video`.
102
+
95
103
  ### Error and lifecycle callbacks
96
104
 
97
105
  ```tsx
@@ -114,45 +122,42 @@ Lifecycle events are `exchange.succeeded`, `exchange.failed`,
114
122
  `renewal.succeeded`, `renewal.failed`, `reconnect.succeeded`, and
115
123
  `reconnect.failed`.
116
124
 
117
- ## Chat and whiteboard integrations
125
+ ## Chat and whiteboard boundary
118
126
 
119
- Integrations are optional. The host supplies already-authorized configuration;
120
- the room package does not issue chat or whiteboard credentials.
127
+ Chat and Whiteboard are owned by the Room Platform exchange. The host only
128
+ passes the launch ticket and public Room Platform API base URL shown above;
129
+ there is no public `integrations` prop.
121
130
 
122
- ```tsx
123
- <RoomPlatformRoom
124
- // ...required props
125
- integrations={{
126
- chat: {
127
- endpoint: 'https://api.example.com/chat',
128
- realtimeEndpoint: 'wss://realtime.example.com/chat',
129
- token: chatToken,
130
- tokenExpiresAt: chatTokenExpiresAt,
131
- refreshToken: refreshChatToken,
132
- refreshTokenExpiresAt: refreshChatTokenExpiresAt,
133
- rooms: chatRooms,
134
- currentRoomId: roomId,
135
- },
136
- whiteboard: {
137
- joinState: whiteboardJoinState,
138
- runtime: {
139
- realtimeEndpoint: whiteboardRealtimeEndpoint,
140
- recoveryPort: whiteboardRecoveryPort,
141
- },
142
- },
143
- }}
144
- />
145
- ```
131
+ After the launch ticket exchange succeeds and LiveKit connects, the package
132
+ hydrates the Chat and Whiteboard projection returned by Room Platform. The
133
+ projection contains only the short-lived, already-authorized runtime data
134
+ needed by the package. On renewal, the complete projection is replaced.
146
135
 
147
- When chat is configured, the default sidebar includes the chat tab and unread
148
- badge. When whiteboard access is available, a shared screen can display the
149
- whiteboard surface. Omit either integration when the host does not use it.
136
+ Each integration degrades independently. An `available: false` Chat or
137
+ Whiteboard projection disables only that surface; LiveKit, the other
138
+ integration, and private-room invite, accept, and media flows remain usable.
139
+ LiveKit exchange/connection failure is the only fatal case for mounting the
140
+ room integrations.
141
+
142
+ Consumers must not provide or derive Chat/Whiteboard credentials, internal or
143
+ service endpoints, integration room IDs, or permission objects. Do not expose
144
+ app/HMAC secrets or call Chat/Whiteboard services directly from the host. The
145
+ Room Platform exchange is the trust boundary and supplies the public runtime
146
+ projection after server-side authorization.
147
+
148
+ Whiteboard uses the exchanged Room Platform `roomId` for its room context and
149
+ is created lazily only when Whiteboard is available and a screen share starts.
150
+ Stopping a share deactivates its board; every new share receives a new
151
+ `shareSessionKey`. No board is mounted before sharing begins.
150
152
 
151
153
  ## Extensions
152
154
 
153
155
  Extensions keep host-specific UI outside the shared room implementation. Every
154
156
  extension receives `RoomPlatformExtensionProps`:
155
157
 
158
+ Host extensions with independent framework CSS must own their own DOM and
159
+ stylesheet boundary.
160
+
156
161
  ```tsx
157
162
  import type { RoomPlatformExtensionProps } from '@naviedu/room-platform-react'
158
163
 
@@ -178,7 +183,6 @@ function HostToolbar({ actions, capabilities, connectionStatus, roomId }: RoomPl
178
183
  topBarTrailing: HostToolbar,
179
184
  sidebarTabs: [{ id: 'materials', title: 'Materials', component: HostMaterialsTab }],
180
185
  mainWorkspace: {
181
- placement: 'alongside-stage',
182
186
  component: HostWorkspace,
183
187
  },
184
188
  }}
@@ -188,7 +192,7 @@ function HostToolbar({ actions, capabilities, connectionStatus, roomId }: RoomPl
188
192
  Available extension slots are:
189
193
 
190
194
  - `topBarLeading` and `topBarTrailing`
191
- - `mainWorkspace` with `overlay` or `alongside-stage` placement
195
+ - `mainWorkspace` for the practice workspace overlay
192
196
  - `sidebarTabs`
193
197
  - `participantTab` in `default` or `replace` mode
194
198
  - `monitor` with a host-provided participant roster and eligibility flag