@100mslive/roomkit-react 0.1.12-alpha.0 → 0.1.13-alpha.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. package/dist/{HLSView-J2MIS3H2.js → HLSView-AIPLCDXY.js} +2 -2
  2. package/dist/Prebuilt/App.d.ts +0 -2
  3. package/dist/Prebuilt/AppContext.d.ts +0 -2
  4. package/dist/Prebuilt/common/constants.d.ts +110 -0
  5. package/dist/Prebuilt/components/AppData/AppData.d.ts +2 -0
  6. package/dist/Prebuilt/components/Chat/MwebChatOption.d.ts +7 -0
  7. package/dist/Prebuilt/components/Chat/Navigation.d.ts +8 -0
  8. package/dist/Prebuilt/components/Chat/PinnedMessage.d.ts +4 -0
  9. package/dist/Prebuilt/components/Footer/Footer.d.ts +3 -2
  10. package/dist/Prebuilt/components/Preview/PreviewJoin.d.ts +2 -1
  11. package/dist/Prebuilt/components/VirtualBackground/VBCollection.d.ts +2 -1
  12. package/dist/Prebuilt/components/VirtualBackground/VBPicker.d.ts +3 -0
  13. package/dist/Prebuilt/components/VirtualBackground/constants.d.ts +0 -6
  14. package/dist/Prebuilt/components/hooks/useChatBlacklist.d.ts +4 -0
  15. package/dist/Prebuilt/components/hooks/useSetPinnedMessages.d.ts +16 -0
  16. package/dist/Prebuilt/provider/roomLayoutProvider/hooks/useRoomLayoutScreen.d.ts +3 -2
  17. package/dist/Theme/stitches.config.d.ts +226 -226
  18. package/dist/{chunk-OYSYEA6R.js → chunk-5DCII2TP.js} +2248 -1269
  19. package/dist/chunk-5DCII2TP.js.map +7 -0
  20. package/dist/index.cjs.js +2943 -1902
  21. package/dist/index.cjs.js.map +4 -4
  22. package/dist/index.js +1 -1
  23. package/dist/meta.cjs.json +819 -313
  24. package/dist/meta.esbuild.json +826 -320
  25. package/package.json +8 -8
  26. package/src/Prebuilt/App.tsx +3 -14
  27. package/src/Prebuilt/AppContext.tsx +0 -2
  28. package/src/Prebuilt/common/{constants.js → constants.ts} +22 -20
  29. package/src/Prebuilt/components/AppData/{AppData.jsx → AppData.tsx} +8 -22
  30. package/src/Prebuilt/components/AppData/useUISettings.js +0 -4
  31. package/src/Prebuilt/components/AuthToken.jsx +4 -4
  32. package/src/Prebuilt/components/Chat/Chat.jsx +51 -73
  33. package/src/Prebuilt/components/Chat/ChatBody.jsx +219 -48
  34. package/src/Prebuilt/components/Chat/ChatFooter.tsx +50 -6
  35. package/src/Prebuilt/components/Chat/ChatStates.jsx +66 -0
  36. package/src/Prebuilt/components/Chat/MwebChatOption.tsx +24 -0
  37. package/src/Prebuilt/components/Chat/Navigation.tsx +60 -0
  38. package/src/Prebuilt/components/Chat/PinnedMessage.tsx +118 -0
  39. package/src/Prebuilt/components/Footer/Footer.tsx +4 -7
  40. package/src/Prebuilt/components/Header/common.jsx +1 -1
  41. package/src/Prebuilt/components/Preview/PreviewJoin.tsx +6 -8
  42. package/src/Prebuilt/components/RoleChangeRequest/RoleChangeRequestModal.tsx +4 -1
  43. package/src/Prebuilt/components/Settings/DeviceSettings.jsx +1 -1
  44. package/src/Prebuilt/components/SidePaneTabs.tsx +3 -2
  45. package/src/Prebuilt/components/Toast/ToastConfig.jsx +20 -0
  46. package/src/Prebuilt/components/VirtualBackground/VBCollection.tsx +4 -4
  47. package/src/Prebuilt/components/VirtualBackground/{VBPicker.jsx → VBPicker.tsx} +27 -18
  48. package/src/Prebuilt/components/VirtualBackground/constants.ts +0 -8
  49. package/src/Prebuilt/components/hooks/useAutoStartStreaming.tsx +10 -1
  50. package/src/Prebuilt/components/hooks/useChatBlacklist.ts +21 -0
  51. package/src/Prebuilt/components/hooks/useSetPinnedMessages.ts +76 -0
  52. package/src/Prebuilt/layouts/SidePane.tsx +1 -1
  53. package/src/Prebuilt/layouts/VideoStreamingSection.tsx +30 -2
  54. package/src/Prebuilt/plugins/whiteboard/PusherCommunicationProvider.js +1 -1
  55. package/src/Prebuilt/plugins/whiteboard/README.md +1 -1
  56. package/src/Prebuilt/primitives/DialogContent.jsx +1 -1
  57. package/src/Prebuilt/provider/roomLayoutProvider/constants/index.ts +12 -1
  58. package/src/Prebuilt/provider/roomLayoutProvider/hooks/useRoomLayoutScreen.ts +5 -1
  59. package/src/Theme/stitches.config.ts +1 -2
  60. package/dist/chunk-OYSYEA6R.js.map +0 -7
  61. package/src/Prebuilt/components/hooks/useSetPinnedMessage.js +0 -38
  62. package/src/Prebuilt/services/tokenService.js +0 -49
  63. /package/dist/{HLSView-J2MIS3H2.js.map → HLSView-AIPLCDXY.js.map} +0 -0
@@ -1,38 +0,0 @@
1
- // @ts-check
2
- import { useCallback } from 'react';
3
- import {
4
- selectPeerNameByID,
5
- selectSessionMetadata,
6
- useHMSActions,
7
- useHMSStore,
8
- useHMSVanillaStore,
9
- } from '@100mslive/react-sdk';
10
- import { ToastManager } from '../Toast/ToastManager';
11
- import { SESSION_STORE_KEY } from '../../common/constants';
12
-
13
- /**
14
- * set pinned chat message by updating the session store
15
- */
16
- export const useSetPinnedMessage = () => {
17
- const hmsActions = useHMSActions();
18
- const vanillaStore = useHMSVanillaStore();
19
- const pinnedMessage = useHMSStore(selectSessionMetadata);
20
-
21
- const setPinnedMessage = useCallback(
22
- /**
23
- * @param {import("@100mslive/react-sdk").HMSMessage | undefined} message
24
- */
25
- async message => {
26
- const peerName = vanillaStore.getState(selectPeerNameByID(message?.sender)) || message?.senderName;
27
- const newPinnedMessage = message ? (peerName ? `${peerName}: ${message.message}` : message.message) : null;
28
- if (newPinnedMessage !== pinnedMessage) {
29
- await hmsActions.sessionStore
30
- .set(SESSION_STORE_KEY.PINNED_MESSAGE, newPinnedMessage)
31
- .catch(err => ToastManager.addToast({ title: err.description }));
32
- }
33
- },
34
- [hmsActions, vanillaStore, pinnedMessage],
35
- );
36
-
37
- return { setPinnedMessage };
38
- };
@@ -1,49 +0,0 @@
1
- /**
2
- * @param {RequestInfo} url
3
- * @param {RequestInit} options
4
- * @returns {Promise<Response>}
5
- */
6
- const fetchWithRetry = async (url, options) => {
7
- const MAX_RETRIES = 4;
8
- let error = Error('something went wrong');
9
- for (let i = 0; i < MAX_RETRIES; i++) {
10
- try {
11
- return await fetch(url, options);
12
- } catch (err) {
13
- error = err;
14
- }
15
- }
16
- console.error('Fetch failed after max retries', { url, options });
17
- throw error;
18
- };
19
-
20
- export default async function getToken(tokenEndpoint, userId, role, roomId) {
21
- try {
22
- const response = await fetchWithRetry(`${tokenEndpoint}api/token`, {
23
- method: 'POST',
24
- body: JSON.stringify({
25
- role,
26
- room_id: roomId,
27
- user_id: userId,
28
- }),
29
- });
30
-
31
- if (!response.ok) {
32
- let error = new Error('Request failed!');
33
- error.response = response;
34
- throw error;
35
- }
36
-
37
- const data = await response.json();
38
- const { token } = data;
39
- // response will be sucess and token is null when url is valid but response
40
- // domain is not present in 100ms
41
- if (token === null) {
42
- throw Error(data.msg);
43
- }
44
- return token;
45
- } catch (err) {
46
- console.error(err);
47
- throw err;
48
- }
49
- }