@naviedu/room-platform-react 0.0.18 → 0.0.20

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 +52 -342
  3. package/index.esm.js +15230 -14700
  4. package/package.json +1 -1
  5. package/styles.css +1 -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,45 @@ 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
+
236
+ export declare type RoomPlatformCompletionActionConfig = {
237
+ onConfirm: () => Promise<void>;
238
+ disabled?: boolean;
239
+ disabledReason?: string;
240
+ label?: string;
241
+ confirmationTitle?: string;
242
+ confirmationDescription?: string;
243
+ confirmationActionLabel?: string;
244
+ errorMessage?: string;
245
+ };
246
+
303
247
  export declare type RoomPlatformConnectionStatus = 'connecting' | 'connected' | 'reconnecting' | 'error';
304
248
 
305
249
  declare type RoomPlatformContextValue = {
@@ -424,6 +368,7 @@ export declare type RoomPlatformGatewayAccess = {
424
368
  accessSessionExpiresAt: string;
425
369
  accessSessionToken: string;
426
370
  capabilities: RoomPlatformCapabilityName[];
371
+ integrations?: RoomPlatformIntegrations;
427
372
  liveKit: {
428
373
  participantIdentity: string;
429
374
  roomName: string;
@@ -438,13 +383,10 @@ export declare const RoomPlatformGatewayErrorCode: {
438
383
  readonly LAUNCH_TICKET_INVALID: "ROOM_PLATFORM_LAUNCH_TICKET_INVALID";
439
384
  };
440
385
 
441
- export declare type RoomPlatformIntegrations = {
442
- chat?: Pick<ChatProviderProps, 'endpoint' | 'realtimeEndpoint' | 'token' | 'tokenExpiresAt' | 'refreshToken' | 'refreshTokenExpiresAt' | 'rooms' | 'currentRoomId'>;
443
- whiteboard?: {
444
- joinState: WhiteboardJoinState;
445
- runtime: Pick<WhiteboardRuntimeOptions, 'realtimeEndpoint' | 'recoveryPort'>;
446
- };
447
- };
386
+ export declare interface RoomPlatformIntegrations {
387
+ chat: RoomPlatformChatIntegration;
388
+ whiteboard: RoomPlatformWhiteboardIntegration;
389
+ }
448
390
 
449
391
  export declare type RoomPlatformLifecycleEvent = 'exchange.succeeded' | 'exchange.failed' | 'renewal.succeeded' | 'renewal.failed' | 'reconnect.succeeded' | 'reconnect.failed';
450
392
 
@@ -620,8 +562,8 @@ export declare function RoomPlatformRoom(props: RoomPlatformRoomProps): JSX.Elem
620
562
 
621
563
  export declare type RoomPlatformRoomProps = {
622
564
  apiBaseUrl: string;
565
+ completionAction?: RoomPlatformCompletionActionConfig;
623
566
  extensions?: RoomPlatformExtensions;
624
- integrations?: RoomPlatformIntegrations;
625
567
  launchToken: string;
626
568
  isPracticeMode?: boolean;
627
569
  sizing?: RoomPlatformSizing;
@@ -674,10 +616,11 @@ export declare function RoomPlatformSpeakQueue({ activeSpeakerParticipantIdentit
674
616
  raisedHandParticipantIdentities: readonly string[];
675
617
  }): JSX.Element;
676
618
 
677
- export declare function RoomPlatformTopBar({ monitorSelector, topBarLeading, topBarTrailing }: RoomPlatformTopBarProps): JSX.Element;
619
+ export declare function RoomPlatformTopBar({ monitorSelector, completionAction, topBarLeading, topBarTrailing, }: RoomPlatformTopBarProps): JSX.Element;
678
620
 
679
621
  export declare type RoomPlatformTopBarProps = {
680
622
  monitorSelector?: ReactNode;
623
+ completionAction?: ReactNode;
681
624
  topBarLeading?: ReactNode;
682
625
  topBarTrailing?: ReactNode;
683
626
  };
@@ -702,6 +645,16 @@ declare type RoomPlatformVideoTracksProps = {
702
645
  status?: RoomPlatformConnectionStatus;
703
646
  };
704
647
 
648
+ declare type RoomPlatformWhiteboardIntegration = {
649
+ available: true;
650
+ apiEndpoint: string;
651
+ realtimeEndpoint: string;
652
+ auth: WhiteboardJoinAuth;
653
+ } | {
654
+ available: false;
655
+ unavailableReason: 'TOKEN_EXCHANGE_FAILED' | 'WHITEBOARD_UNAVAILABLE';
656
+ };
657
+
705
658
  declare interface RoomPrivateRoomConnection {
706
659
  roomName: string;
707
660
  token: string;
@@ -727,14 +680,6 @@ declare interface RoomPrivateRoomState {
727
680
 
728
681
  declare type RoomPrivateRoomStatus = 'ringing' | 'active';
729
682
 
730
- declare interface SocketLike {
731
- auth?: unknown;
732
- connect: () => void;
733
- disconnect: () => void;
734
- emit: (event: string, payload?: unknown, acknowledgement?: (response: unknown) => void) => void;
735
- on: (event: string, handler: (payload: unknown) => void) => void;
736
- }
737
-
738
683
  export declare function useRoomPlatform(): RoomPlatformContextValue;
739
684
 
740
685
  declare function useRoomPlatformCameraBackground({ localVideoTrack }: UseRoomPlatformCameraBackgroundInput): {
@@ -794,249 +739,14 @@ export declare function useRoomPresence(): RoomParticipantPresence[];
794
739
 
795
740
  declare type VariantProps<Component extends (...args: any) => any> = Omit<OmitUndefined<Parameters<Component>[0]>, "class" | "className">;
796
741
 
797
- declare const WHITEBOARD_ANNOTATION_ERASE_OPERATION: "annotation.object.erase";
798
-
799
- declare const WHITEBOARD_ANNOTATION_UPSERT_OPERATION: "annotation.object.upsert";
800
-
801
- declare const WHITEBOARD_CLEAR_OPERATION: "clear";
802
-
803
- declare const WHITEBOARD_RESTORE_CLEAR_OPERATION: "restore_clear";
804
-
805
- declare interface WhiteboardAnnotationEraseOperation extends WhiteboardOperationEnvelope {
806
- type: typeof WHITEBOARD_ANNOTATION_ERASE_OPERATION;
807
- payload: WhiteboardAnnotationErasePayload;
808
- }
809
-
810
- declare interface WhiteboardAnnotationErasePayload extends Record<string, unknown> {
811
- objectId: string;
812
- }
813
-
814
- declare type WhiteboardAnnotationSceneObject = WhiteboardAnnotationStrokeSceneObject | WhiteboardAnnotationShapeSceneObject;
815
-
816
- declare type WhiteboardAnnotationShapeSceneObject = WhiteboardSceneObject & {
817
- objectType: 'annotation.shape';
818
- payload: WhiteboardShapeObjectPayload;
819
- };
820
-
821
- declare type WhiteboardAnnotationStrokeSceneObject = WhiteboardSceneObject & {
822
- objectType: 'annotation.stroke';
823
- payload: WhiteboardStrokeObjectPayload;
824
- };
825
-
826
- declare interface WhiteboardAnnotationUpsertOperation extends WhiteboardOperationEnvelope {
827
- type: typeof WHITEBOARD_ANNOTATION_UPSERT_OPERATION;
828
- payload: WhiteboardAnnotationUpsertPayload;
829
- }
830
-
831
- declare interface WhiteboardAnnotationUpsertPayload extends Record<string, unknown> {
832
- object: WhiteboardAnnotationSceneObject;
833
- }
834
-
835
- declare interface WhiteboardBootstrapRequest {
836
- token: string;
837
- boardId: string;
838
- }
839
-
840
- declare interface WhiteboardBootstrapResponse {
841
- boardId: string;
842
- shareSessionKey: string;
843
- headRevision: number;
844
- objects: WhiteboardSceneObject[];
845
- }
846
-
847
- declare interface WhiteboardClearOperation extends WhiteboardOperationEnvelope {
848
- type: typeof WHITEBOARD_CLEAR_OPERATION;
849
- payload?: undefined;
850
- }
851
-
852
- declare type WhiteboardCommittedOperation = WhiteboardAnnotationUpsertOperation | WhiteboardAnnotationEraseOperation | WhiteboardClearOperation | WhiteboardRestoreClearOperation;
853
-
854
- declare interface WhiteboardDeltaItem {
855
- revision: number;
856
- createdAt: string;
857
- actorSubject?: string | null;
858
- operation: WhiteboardCommittedOperation;
859
- }
860
-
861
- declare interface WhiteboardDeltaRequest {
862
- token: string;
863
- boardId: string;
864
- afterRevision: number;
865
- limit?: number;
866
- }
867
-
868
- declare interface WhiteboardDeltaResponse {
869
- boardId: string;
870
- fromRevision: number;
871
- toRevision: number;
872
- headRevision: number;
873
- hasMore: boolean;
874
- operations: WhiteboardDeltaItem[];
875
- }
876
-
877
- declare type WhiteboardFreehandKind = (typeof whiteboardFreehandKinds)[number];
878
-
879
- declare const whiteboardFreehandKinds: readonly ["pen", "highlighter", "marker"];
880
-
881
742
  declare interface WhiteboardJoinAuth {
882
743
  permissions: WhiteboardPermission[];
883
744
  token: string;
884
745
  tokenExpiresAt: string;
885
746
  }
886
747
 
887
- declare type WhiteboardJoinState = {
888
- available: true;
889
- auth: WhiteboardJoinAuth;
890
- } | {
891
- available: false;
892
- unavailableReason: WhiteboardUnavailableReason;
893
- };
894
-
895
- declare interface WhiteboardNormalizedPoint {
896
- x: number;
897
- y: number;
898
- }
899
-
900
- declare interface WhiteboardOperationEnvelope {
901
- operationId: string;
902
- type: string;
903
- payload?: Record<string, unknown>;
904
- }
905
-
906
748
  declare type WhiteboardPermission = (typeof whiteboardPermissions)[number];
907
749
 
908
750
  declare const whiteboardPermissions: readonly ["whiteboard:view", "whiteboard:write", "whiteboard:clear"];
909
751
 
910
- declare interface WhiteboardRecoveryPort {
911
- bootstrap: (request: WhiteboardBootstrapRequest, signal: AbortSignal) => Promise<WhiteboardBootstrapResponse>;
912
- delta: (request: WhiteboardDeltaRequest, signal: AbortSignal) => Promise<WhiteboardDeltaResponse>;
913
- }
914
-
915
- declare interface WhiteboardRecoveryState {
916
- bootstrap: WhiteboardBootstrapResponse;
917
- deltas: WhiteboardDeltaResponse[];
918
- discardLocalHistory?: boolean;
919
- mode?: 'incremental' | 'replace';
920
- settledOperationIds?: string[];
921
- }
922
-
923
- declare interface WhiteboardRestoreClearOperation extends WhiteboardOperationEnvelope {
924
- type: typeof WHITEBOARD_RESTORE_CLEAR_OPERATION;
925
- payload: {
926
- clearOperationId: string;
927
- objects: WhiteboardAnnotationSceneObject[];
928
- };
929
- }
930
-
931
- declare interface WhiteboardRuntimeBoardState {
932
- activeShareSessionKey?: string;
933
- boardId?: string;
934
- confirmedRevision: number;
935
- headRevision: number;
936
- pendingOperationCount: number;
937
- }
938
-
939
- declare interface WhiteboardRuntimeCommittedEvent extends OperationCommittedEvent {
940
- reconcileStrategy: 'replayable';
941
- }
942
-
943
- declare type WhiteboardRuntimeDiagnostic = {
944
- type: 'submit_ack';
945
- operationId: string;
946
- revision: number;
947
- latencyMs: number;
948
- queueDepth: number;
949
- } | {
950
- type: 'relay_echo';
951
- operationId: string;
952
- revision: number;
953
- latencyMs: number;
954
- } | {
955
- type: 'delta_request';
956
- reason: 'initial_gap' | 'reconnect' | 'runtime_gap';
957
- afterRevision: number;
958
- } | {
959
- type: 'queue_depth';
960
- depth: number;
961
- } | {
962
- type: 'terminal_rollback';
963
- operationCount: number;
964
- };
965
-
966
- declare interface WhiteboardRuntimeOptions {
967
- onBoardStateChange?: (state: WhiteboardRuntimeBoardState) => void;
968
- onCommittedEvent?: (event: WhiteboardRuntimeCommittedEvent) => void;
969
- onDiagnostic?: (diagnostic: WhiteboardRuntimeDiagnostic) => void;
970
- onRecoveryStateChange?: (recovery: WhiteboardRecoveryState | undefined) => void;
971
- onRecoveryStatusChange?: (status: 'idle' | 'restoring' | 'recovered' | 'failed') => void;
972
- onSubmitStatusChange?: (status: WhiteboardSubmitStatus) => void;
973
- realtimeEndpoint?: string;
974
- recoveryPort?: WhiteboardRecoveryPort;
975
- socketFactory?: (endpoint: string, options: {
976
- auth: {
977
- token: string;
978
- };
979
- path: string;
980
- }) => SocketLike;
981
- }
982
-
983
- declare interface WhiteboardSceneObject {
984
- objectId: string;
985
- objectType: string;
986
- latestRevision: number;
987
- payload: Record<string, unknown>;
988
- }
989
-
990
- declare type WhiteboardShapeKind = (typeof whiteboardShapeKinds)[number];
991
-
992
- declare const whiteboardShapeKinds: readonly ["line", "arrow", "double-arrow", "rectangle", "shaded-rectangle", "filled-rectangle", "circle", "shaded-circle", "filled-circle", "diamond", "shaded-diamond", "filled-diamond"];
993
-
994
- declare interface WhiteboardShapeObjectPayload extends Record<string, unknown> {
995
- kind: WhiteboardShapeKind;
996
- color: string;
997
- widthPreset: WhiteboardStrokeWidthPreset;
998
- start: WhiteboardNormalizedPoint;
999
- end: WhiteboardNormalizedPoint;
1000
- }
1001
-
1002
- declare interface WhiteboardStrokeObjectPayload extends Record<string, unknown> {
1003
- kind: WhiteboardFreehandKind;
1004
- color: string;
1005
- widthPreset: WhiteboardStrokeWidthPreset;
1006
- points: WhiteboardNormalizedPoint[];
1007
- vanishAt?: string;
1008
- }
1009
-
1010
- declare type WhiteboardStrokeWidthPreset = (typeof whiteboardStrokeWidthPresets)[number];
1011
-
1012
- declare const whiteboardStrokeWidthPresets: readonly ["xs", "sm", "md", "lg"];
1013
-
1014
- declare type WhiteboardSubmitStatus = {
1015
- state: 'idle';
1016
- } | {
1017
- state: 'submitting';
1018
- operationId: string;
1019
- } | {
1020
- state: 'accepted';
1021
- operationId: string;
1022
- } | {
1023
- state: 'conflict';
1024
- operationId: string;
1025
- expectedBaseRevision: number;
1026
- } | {
1027
- state: 'forbidden';
1028
- operationId: string;
1029
- } | {
1030
- state: 'board_not_ready';
1031
- operationId: string;
1032
- } | {
1033
- state: 'unavailable';
1034
- operationId: string;
1035
- retryAfterMs?: number;
1036
- };
1037
-
1038
- declare type WhiteboardUnavailableReason = (typeof whiteboardUnavailableReasons)[number];
1039
-
1040
- declare const whiteboardUnavailableReasons: readonly ["TOKEN_EXCHANGE_FAILED", "WHITEBOARD_UNAVAILABLE"];
1041
-
1042
752
  export { }