@naviedu/room-platform-react 0.0.19 → 0.0.21

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 (5) hide show
  1. package/README.md +27 -34
  2. package/index.d.ts +39 -341
  3. package/index.esm.js +13860 -13657
  4. package/package.json +1 -1
  5. package/styles.css +57 -1
package/README.md CHANGED
@@ -85,7 +85,6 @@ layout that allows the room to occupy the viewport.
85
85
  | `launchToken` | Yes | Initial server-issued launch ticket. |
86
86
  | `onLaunchTicketRequired` | Yes | Returns `{ launchToken }` when the current ticket or access session must be renewed. |
87
87
  | `extensions` | No | Host-provided top-bar, workspace, sidebar, monitor, and participant extensions. |
88
- | `integrations` | No | Chat and whiteboard configuration. |
89
88
  | `isPracticeMode` | No | Enables practice-room presentation behavior. |
90
89
  | `onError` | No | Receives connection, media, and action errors. |
91
90
  | `onLifecycleEvent` | No | Receives exchange, renewal, and reconnect lifecycle events. |
@@ -121,39 +120,33 @@ Lifecycle events are `exchange.succeeded`, `exchange.failed`,
121
120
  `renewal.succeeded`, `renewal.failed`, `reconnect.succeeded`, and
122
121
  `reconnect.failed`.
123
122
 
124
- ## Chat and whiteboard integrations
125
-
126
- Integrations are optional. The host supplies already-authorized configuration;
127
- the room package does not issue chat or whiteboard credentials.
128
-
129
- ```tsx
130
- <RoomPlatformRoom
131
- // ...required props
132
- integrations={{
133
- chat: {
134
- endpoint: 'https://api.example.com/chat',
135
- realtimeEndpoint: 'wss://realtime.example.com/chat',
136
- token: chatToken,
137
- tokenExpiresAt: chatTokenExpiresAt,
138
- refreshToken: refreshChatToken,
139
- refreshTokenExpiresAt: refreshChatTokenExpiresAt,
140
- rooms: chatRooms,
141
- currentRoomId: roomId,
142
- },
143
- whiteboard: {
144
- joinState: whiteboardJoinState,
145
- runtime: {
146
- realtimeEndpoint: whiteboardRealtimeEndpoint,
147
- recoveryPort: whiteboardRecoveryPort,
148
- },
149
- },
150
- }}
151
- />
152
- ```
153
-
154
- When chat is configured, the default sidebar includes the chat tab and unread
155
- badge. When whiteboard access is available, a shared screen can display the
156
- whiteboard surface. Omit either integration when the host does not use it.
123
+ ## Chat and whiteboard boundary
124
+
125
+ Chat and Whiteboard are owned by the Room Platform exchange. The host only
126
+ passes the launch ticket and public Room Platform API base URL shown above;
127
+ there is no public `integrations` prop.
128
+
129
+ After the launch ticket exchange succeeds and LiveKit connects, the package
130
+ hydrates the Chat and Whiteboard projection returned by Room Platform. The
131
+ projection contains only the short-lived, already-authorized runtime data
132
+ needed by the package. On renewal, the complete projection is replaced.
133
+
134
+ Each integration degrades independently. An `available: false` Chat or
135
+ Whiteboard projection disables only that surface; LiveKit, the other
136
+ integration, and private-room invite, accept, and media flows remain usable.
137
+ LiveKit exchange/connection failure is the only fatal case for mounting the
138
+ room integrations.
139
+
140
+ Consumers must not provide or derive Chat/Whiteboard credentials, internal or
141
+ service endpoints, integration room IDs, or permission objects. Do not expose
142
+ app/HMAC secrets or call Chat/Whiteboard services directly from the host. The
143
+ Room Platform exchange is the trust boundary and supplies the public runtime
144
+ projection after server-side authorization.
145
+
146
+ Whiteboard uses the exchanged Room Platform `roomId` for its room context and
147
+ is created lazily only when Whiteboard is available and a screen share starts.
148
+ Stopping a share deactivates its board; every new share receives a new
149
+ `shareSessionKey`. No board is mounted before sharing begins.
157
150
 
158
151
  ## Extensions
159
152
 
package/index.d.ts CHANGED
@@ -18,90 +18,6 @@ declare const buttonVariants: (props?: {
18
18
  size?: "xs" | "sm" | "lg" | "default" | "xl" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | "icon-xl";
19
19
  } & ClassProp) => string;
20
20
 
21
- declare type ChatClassNames = {
22
- root?: string;
23
- roomList?: string;
24
- roomTab?: string;
25
- panel?: string;
26
- messageList?: string;
27
- messageItem?: string;
28
- composer?: string;
29
- forwardDialog?: string;
30
- connectionStatus?: string;
31
- };
32
-
33
- declare interface ChatForwardedFromDto {
34
- sourceAppId: string;
35
- sourceWorkspaceId: string;
36
- sourceRoomId: string;
37
- sourceMessageId: string;
38
- sourceAuthorSnapshot: {
39
- subject: string;
40
- displayName?: string;
41
- };
42
- sourceCreatedAt: string;
43
- }
44
-
45
- declare interface ChatMessageDto {
46
- id: string;
47
- appId: string;
48
- workspaceId: string;
49
- roomId: string;
50
- authorSubject: string;
51
- authorDisplayName?: string;
52
- text: string;
53
- status: 'active' | 'deleted' | 'hidden';
54
- createdAt: string;
55
- updatedAt?: string;
56
- forwardedFrom?: ChatForwardedFromDto;
57
- }
58
-
59
- declare type ChatPermission = (typeof chatPermissions)[number];
60
-
61
- declare const chatPermissions: readonly ["read", "send", "delete_own", "edit_own", "moderate", "forward", "manage_room"];
62
-
63
- declare type ChatProviderProps = {
64
- endpoint: string;
65
- realtimeEndpoint: string;
66
- token: string;
67
- tokenExpiresAt?: string;
68
- refreshToken: string;
69
- refreshTokenExpiresAt?: string;
70
- rooms: ChatRoomDescriptor[];
71
- currentRoomId?: string;
72
- mode?: 'tabs' | 'compact' | 'full_panel' | 'readonly';
73
- className?: string;
74
- classNames?: ChatClassNames;
75
- tokens?: ChatThemeTokens;
76
- historyPageSize?: number;
77
- isVisible?: boolean;
78
- initialMessages?: Record<string, ChatMessageDto[]>;
79
- messageActionWindowMs?: number;
80
- now?: () => Date;
81
- onError?: (error: Error) => void;
82
- children?: ReactNode;
83
- };
84
-
85
- declare interface ChatRoomDescriptor {
86
- roomId: string;
87
- roomType: ChatRoomType;
88
- label?: string;
89
- permissions: ChatPermission[];
90
- }
91
-
92
- declare type ChatRoomType = (typeof chatRoomTypes)[number];
93
-
94
- declare const chatRoomTypes: readonly ["group", "direct", "staff", "system"];
95
-
96
- declare type ChatThemeTokens = {
97
- colorPrimary?: string;
98
- colorSurface?: string;
99
- colorBorder?: string;
100
- colorText?: string;
101
- radius?: string | number;
102
- fontFamily?: string;
103
- };
104
-
105
21
  declare type ClassProp = {
106
22
  class: ClassValue;
107
23
  className?: never;
@@ -136,12 +52,6 @@ export declare const monitorCameraVideoClassName = "h-full w-full object-cover -
136
52
 
137
53
  declare type OmitUndefined<T> = T extends undefined ? never : T;
138
54
 
139
- declare interface OperationCommittedEvent {
140
- boardId: string;
141
- revision: number;
142
- operation: WhiteboardCommittedOperation;
143
- }
144
-
145
55
  export declare function RoomActionButton({ icon, state, ...props }: ComponentProps<typeof Button> & {
146
56
  icon: ReactNode;
147
57
  state: RoomActionState;
@@ -295,11 +205,34 @@ declare const RoomPlatformCapability: {
295
205
  readonly PRIVATE_ROOM_INVITE: "private_room:invite";
296
206
  readonly PRIVATE_ROOM_RESPOND: "private_room:respond";
297
207
  readonly PRIVATE_ROOM_CLOSE: "private_room:close";
208
+ readonly WHITEBOARD_WRITE: "whiteboard:write";
298
209
  readonly WHITEBOARD_CLEAR: "whiteboard:clear";
299
210
  };
300
211
 
301
212
  declare type RoomPlatformCapabilityName = (typeof RoomPlatformCapability)[keyof typeof RoomPlatformCapability];
302
213
 
214
+ declare type RoomPlatformChatIntegration = {
215
+ available: true;
216
+ apiEndpoint: string;
217
+ realtimeEndpoint: string;
218
+ token: string;
219
+ tokenExpiresAt: string;
220
+ refreshToken: string;
221
+ refreshTokenExpiresAt: string;
222
+ rooms: readonly RoomPlatformChatRoom[];
223
+ currentRoomId: string;
224
+ } | {
225
+ available: false;
226
+ unavailableReason: 'CHAT_TOKEN_EXCHANGE_FAILED';
227
+ };
228
+
229
+ declare interface RoomPlatformChatRoom {
230
+ roomId: string;
231
+ roomType: 'group';
232
+ label?: string;
233
+ permissions: string[];
234
+ }
235
+
303
236
  export declare type RoomPlatformCompletionActionConfig = {
304
237
  onConfirm: () => Promise<void>;
305
238
  disabled?: boolean;
@@ -435,6 +368,7 @@ export declare type RoomPlatformGatewayAccess = {
435
368
  accessSessionExpiresAt: string;
436
369
  accessSessionToken: string;
437
370
  capabilities: RoomPlatformCapabilityName[];
371
+ integrations?: RoomPlatformIntegrations;
438
372
  liveKit: {
439
373
  participantIdentity: string;
440
374
  roomName: string;
@@ -449,13 +383,10 @@ export declare const RoomPlatformGatewayErrorCode: {
449
383
  readonly LAUNCH_TICKET_INVALID: "ROOM_PLATFORM_LAUNCH_TICKET_INVALID";
450
384
  };
451
385
 
452
- export declare type RoomPlatformIntegrations = {
453
- chat?: Pick<ChatProviderProps, 'endpoint' | 'realtimeEndpoint' | 'token' | 'tokenExpiresAt' | 'refreshToken' | 'refreshTokenExpiresAt' | 'rooms' | 'currentRoomId'>;
454
- whiteboard?: {
455
- joinState: WhiteboardJoinState;
456
- runtime: Pick<WhiteboardRuntimeOptions, 'realtimeEndpoint' | 'recoveryPort'>;
457
- };
458
- };
386
+ export declare interface RoomPlatformIntegrations {
387
+ chat: RoomPlatformChatIntegration;
388
+ whiteboard: RoomPlatformWhiteboardIntegration;
389
+ }
459
390
 
460
391
  export declare type RoomPlatformLifecycleEvent = 'exchange.succeeded' | 'exchange.failed' | 'renewal.succeeded' | 'renewal.failed' | 'reconnect.succeeded' | 'reconnect.failed';
461
392
 
@@ -633,9 +564,9 @@ export declare type RoomPlatformRoomProps = {
633
564
  apiBaseUrl: string;
634
565
  completionAction?: RoomPlatformCompletionActionConfig;
635
566
  extensions?: RoomPlatformExtensions;
636
- integrations?: RoomPlatformIntegrations;
637
567
  launchToken: string;
638
568
  isPracticeMode?: boolean;
569
+ shadowDom?: boolean;
639
570
  sizing?: RoomPlatformSizing;
640
571
  onError?: (event: RoomPlatformErrorEvent) => void;
641
572
  onLifecycleEvent?: (event: RoomPlatformLifecycleEvent) => void;
@@ -715,6 +646,16 @@ declare type RoomPlatformVideoTracksProps = {
715
646
  status?: RoomPlatformConnectionStatus;
716
647
  };
717
648
 
649
+ declare type RoomPlatformWhiteboardIntegration = {
650
+ available: true;
651
+ apiEndpoint: string;
652
+ realtimeEndpoint: string;
653
+ auth: WhiteboardJoinAuth;
654
+ } | {
655
+ available: false;
656
+ unavailableReason: 'TOKEN_EXCHANGE_FAILED' | 'WHITEBOARD_UNAVAILABLE';
657
+ };
658
+
718
659
  declare interface RoomPrivateRoomConnection {
719
660
  roomName: string;
720
661
  token: string;
@@ -740,14 +681,6 @@ declare interface RoomPrivateRoomState {
740
681
 
741
682
  declare type RoomPrivateRoomStatus = 'ringing' | 'active';
742
683
 
743
- declare interface SocketLike {
744
- auth?: unknown;
745
- connect: () => void;
746
- disconnect: () => void;
747
- emit: (event: string, payload?: unknown, acknowledgement?: (response: unknown) => void) => void;
748
- on: (event: string, handler: (payload: unknown) => void) => void;
749
- }
750
-
751
684
  export declare function useRoomPlatform(): RoomPlatformContextValue;
752
685
 
753
686
  declare function useRoomPlatformCameraBackground({ localVideoTrack }: UseRoomPlatformCameraBackgroundInput): {
@@ -807,249 +740,14 @@ export declare function useRoomPresence(): RoomParticipantPresence[];
807
740
 
808
741
  declare type VariantProps<Component extends (...args: any) => any> = Omit<OmitUndefined<Parameters<Component>[0]>, "class" | "className">;
809
742
 
810
- declare const WHITEBOARD_ANNOTATION_ERASE_OPERATION: "annotation.object.erase";
811
-
812
- declare const WHITEBOARD_ANNOTATION_UPSERT_OPERATION: "annotation.object.upsert";
813
-
814
- declare const WHITEBOARD_CLEAR_OPERATION: "clear";
815
-
816
- declare const WHITEBOARD_RESTORE_CLEAR_OPERATION: "restore_clear";
817
-
818
- declare interface WhiteboardAnnotationEraseOperation extends WhiteboardOperationEnvelope {
819
- type: typeof WHITEBOARD_ANNOTATION_ERASE_OPERATION;
820
- payload: WhiteboardAnnotationErasePayload;
821
- }
822
-
823
- declare interface WhiteboardAnnotationErasePayload extends Record<string, unknown> {
824
- objectId: string;
825
- }
826
-
827
- declare type WhiteboardAnnotationSceneObject = WhiteboardAnnotationStrokeSceneObject | WhiteboardAnnotationShapeSceneObject;
828
-
829
- declare type WhiteboardAnnotationShapeSceneObject = WhiteboardSceneObject & {
830
- objectType: 'annotation.shape';
831
- payload: WhiteboardShapeObjectPayload;
832
- };
833
-
834
- declare type WhiteboardAnnotationStrokeSceneObject = WhiteboardSceneObject & {
835
- objectType: 'annotation.stroke';
836
- payload: WhiteboardStrokeObjectPayload;
837
- };
838
-
839
- declare interface WhiteboardAnnotationUpsertOperation extends WhiteboardOperationEnvelope {
840
- type: typeof WHITEBOARD_ANNOTATION_UPSERT_OPERATION;
841
- payload: WhiteboardAnnotationUpsertPayload;
842
- }
843
-
844
- declare interface WhiteboardAnnotationUpsertPayload extends Record<string, unknown> {
845
- object: WhiteboardAnnotationSceneObject;
846
- }
847
-
848
- declare interface WhiteboardBootstrapRequest {
849
- token: string;
850
- boardId: string;
851
- }
852
-
853
- declare interface WhiteboardBootstrapResponse {
854
- boardId: string;
855
- shareSessionKey: string;
856
- headRevision: number;
857
- objects: WhiteboardSceneObject[];
858
- }
859
-
860
- declare interface WhiteboardClearOperation extends WhiteboardOperationEnvelope {
861
- type: typeof WHITEBOARD_CLEAR_OPERATION;
862
- payload?: undefined;
863
- }
864
-
865
- declare type WhiteboardCommittedOperation = WhiteboardAnnotationUpsertOperation | WhiteboardAnnotationEraseOperation | WhiteboardClearOperation | WhiteboardRestoreClearOperation;
866
-
867
- declare interface WhiteboardDeltaItem {
868
- revision: number;
869
- createdAt: string;
870
- actorSubject?: string | null;
871
- operation: WhiteboardCommittedOperation;
872
- }
873
-
874
- declare interface WhiteboardDeltaRequest {
875
- token: string;
876
- boardId: string;
877
- afterRevision: number;
878
- limit?: number;
879
- }
880
-
881
- declare interface WhiteboardDeltaResponse {
882
- boardId: string;
883
- fromRevision: number;
884
- toRevision: number;
885
- headRevision: number;
886
- hasMore: boolean;
887
- operations: WhiteboardDeltaItem[];
888
- }
889
-
890
- declare type WhiteboardFreehandKind = (typeof whiteboardFreehandKinds)[number];
891
-
892
- declare const whiteboardFreehandKinds: readonly ["pen", "highlighter", "marker"];
893
-
894
743
  declare interface WhiteboardJoinAuth {
895
744
  permissions: WhiteboardPermission[];
896
745
  token: string;
897
746
  tokenExpiresAt: string;
898
747
  }
899
748
 
900
- declare type WhiteboardJoinState = {
901
- available: true;
902
- auth: WhiteboardJoinAuth;
903
- } | {
904
- available: false;
905
- unavailableReason: WhiteboardUnavailableReason;
906
- };
907
-
908
- declare interface WhiteboardNormalizedPoint {
909
- x: number;
910
- y: number;
911
- }
912
-
913
- declare interface WhiteboardOperationEnvelope {
914
- operationId: string;
915
- type: string;
916
- payload?: Record<string, unknown>;
917
- }
918
-
919
749
  declare type WhiteboardPermission = (typeof whiteboardPermissions)[number];
920
750
 
921
751
  declare const whiteboardPermissions: readonly ["whiteboard:view", "whiteboard:write", "whiteboard:clear"];
922
752
 
923
- declare interface WhiteboardRecoveryPort {
924
- bootstrap: (request: WhiteboardBootstrapRequest, signal: AbortSignal) => Promise<WhiteboardBootstrapResponse>;
925
- delta: (request: WhiteboardDeltaRequest, signal: AbortSignal) => Promise<WhiteboardDeltaResponse>;
926
- }
927
-
928
- declare interface WhiteboardRecoveryState {
929
- bootstrap: WhiteboardBootstrapResponse;
930
- deltas: WhiteboardDeltaResponse[];
931
- discardLocalHistory?: boolean;
932
- mode?: 'incremental' | 'replace';
933
- settledOperationIds?: string[];
934
- }
935
-
936
- declare interface WhiteboardRestoreClearOperation extends WhiteboardOperationEnvelope {
937
- type: typeof WHITEBOARD_RESTORE_CLEAR_OPERATION;
938
- payload: {
939
- clearOperationId: string;
940
- objects: WhiteboardAnnotationSceneObject[];
941
- };
942
- }
943
-
944
- declare interface WhiteboardRuntimeBoardState {
945
- activeShareSessionKey?: string;
946
- boardId?: string;
947
- confirmedRevision: number;
948
- headRevision: number;
949
- pendingOperationCount: number;
950
- }
951
-
952
- declare interface WhiteboardRuntimeCommittedEvent extends OperationCommittedEvent {
953
- reconcileStrategy: 'replayable';
954
- }
955
-
956
- declare type WhiteboardRuntimeDiagnostic = {
957
- type: 'submit_ack';
958
- operationId: string;
959
- revision: number;
960
- latencyMs: number;
961
- queueDepth: number;
962
- } | {
963
- type: 'relay_echo';
964
- operationId: string;
965
- revision: number;
966
- latencyMs: number;
967
- } | {
968
- type: 'delta_request';
969
- reason: 'initial_gap' | 'reconnect' | 'runtime_gap';
970
- afterRevision: number;
971
- } | {
972
- type: 'queue_depth';
973
- depth: number;
974
- } | {
975
- type: 'terminal_rollback';
976
- operationCount: number;
977
- };
978
-
979
- declare interface WhiteboardRuntimeOptions {
980
- onBoardStateChange?: (state: WhiteboardRuntimeBoardState) => void;
981
- onCommittedEvent?: (event: WhiteboardRuntimeCommittedEvent) => void;
982
- onDiagnostic?: (diagnostic: WhiteboardRuntimeDiagnostic) => void;
983
- onRecoveryStateChange?: (recovery: WhiteboardRecoveryState | undefined) => void;
984
- onRecoveryStatusChange?: (status: 'idle' | 'restoring' | 'recovered' | 'failed') => void;
985
- onSubmitStatusChange?: (status: WhiteboardSubmitStatus) => void;
986
- realtimeEndpoint?: string;
987
- recoveryPort?: WhiteboardRecoveryPort;
988
- socketFactory?: (endpoint: string, options: {
989
- auth: {
990
- token: string;
991
- };
992
- path: string;
993
- }) => SocketLike;
994
- }
995
-
996
- declare interface WhiteboardSceneObject {
997
- objectId: string;
998
- objectType: string;
999
- latestRevision: number;
1000
- payload: Record<string, unknown>;
1001
- }
1002
-
1003
- declare type WhiteboardShapeKind = (typeof whiteboardShapeKinds)[number];
1004
-
1005
- declare const whiteboardShapeKinds: readonly ["line", "arrow", "double-arrow", "rectangle", "shaded-rectangle", "filled-rectangle", "circle", "shaded-circle", "filled-circle", "diamond", "shaded-diamond", "filled-diamond"];
1006
-
1007
- declare interface WhiteboardShapeObjectPayload extends Record<string, unknown> {
1008
- kind: WhiteboardShapeKind;
1009
- color: string;
1010
- widthPreset: WhiteboardStrokeWidthPreset;
1011
- start: WhiteboardNormalizedPoint;
1012
- end: WhiteboardNormalizedPoint;
1013
- }
1014
-
1015
- declare interface WhiteboardStrokeObjectPayload extends Record<string, unknown> {
1016
- kind: WhiteboardFreehandKind;
1017
- color: string;
1018
- widthPreset: WhiteboardStrokeWidthPreset;
1019
- points: WhiteboardNormalizedPoint[];
1020
- vanishAt?: string;
1021
- }
1022
-
1023
- declare type WhiteboardStrokeWidthPreset = (typeof whiteboardStrokeWidthPresets)[number];
1024
-
1025
- declare const whiteboardStrokeWidthPresets: readonly ["xs", "sm", "md", "lg"];
1026
-
1027
- declare type WhiteboardSubmitStatus = {
1028
- state: 'idle';
1029
- } | {
1030
- state: 'submitting';
1031
- operationId: string;
1032
- } | {
1033
- state: 'accepted';
1034
- operationId: string;
1035
- } | {
1036
- state: 'conflict';
1037
- operationId: string;
1038
- expectedBaseRevision: number;
1039
- } | {
1040
- state: 'forbidden';
1041
- operationId: string;
1042
- } | {
1043
- state: 'board_not_ready';
1044
- operationId: string;
1045
- } | {
1046
- state: 'unavailable';
1047
- operationId: string;
1048
- retryAfterMs?: number;
1049
- };
1050
-
1051
- declare type WhiteboardUnavailableReason = (typeof whiteboardUnavailableReasons)[number];
1052
-
1053
- declare const whiteboardUnavailableReasons: readonly ["TOKEN_EXCHANGE_FAILED", "WHITEBOARD_UNAVAILABLE"];
1054
-
1055
753
  export { }