@100mslive/roomkit-react 0.1.12 → 0.1.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. package/dist/{HLSView-PWVM4OIP.js → HLSView-IENE4HRP.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/Notifications/ChatNotifications.d.ts +2 -0
  11. package/dist/Prebuilt/components/Preview/PreviewJoin.d.ts +2 -1
  12. package/dist/Prebuilt/components/VirtualBackground/VBCollection.d.ts +2 -1
  13. package/dist/Prebuilt/components/VirtualBackground/VBPicker.d.ts +3 -0
  14. package/dist/Prebuilt/components/VirtualBackground/constants.d.ts +0 -6
  15. package/dist/Prebuilt/components/hooks/useChatBlacklist.d.ts +4 -0
  16. package/dist/Prebuilt/components/hooks/useSetPinnedMessages.d.ts +16 -0
  17. package/dist/Prebuilt/provider/roomLayoutProvider/hooks/useRoomLayoutScreen.d.ts +3 -2
  18. package/dist/{chunk-WREKGNP6.js → chunk-U4AB6X6M.js} +2178 -1148
  19. package/dist/chunk-U4AB6X6M.js.map +7 -0
  20. package/dist/index.cjs.js +2746 -1638
  21. package/dist/index.cjs.js.map +4 -4
  22. package/dist/index.js +1 -1
  23. package/dist/meta.cjs.json +803 -208
  24. package/dist/meta.esbuild.json +812 -217
  25. package/package.json +8 -7
  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 +15 -5
  32. package/src/Prebuilt/components/Chat/Chat.jsx +49 -73
  33. package/src/Prebuilt/components/Chat/ChatBody.jsx +241 -51
  34. package/src/Prebuilt/components/Chat/ChatFooter.tsx +56 -6
  35. package/src/Prebuilt/components/Chat/ChatStates.jsx +68 -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 +116 -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/Notifications/ChatNotifications.tsx +34 -0
  42. package/src/Prebuilt/components/Notifications/Notifications.tsx +2 -0
  43. package/src/Prebuilt/components/Polls/Voting/QuestionCard.jsx +6 -4
  44. package/src/Prebuilt/components/Polls/Voting/TimedVoting.jsx +3 -2
  45. package/src/Prebuilt/components/Polls/common/VoteCount.jsx +6 -4
  46. package/src/Prebuilt/components/Preview/PreviewJoin.tsx +7 -9
  47. package/src/Prebuilt/components/RoleChangeRequest/RoleChangeRequestModal.tsx +4 -1
  48. package/src/Prebuilt/components/Settings/DeviceSettings.jsx +1 -1
  49. package/src/Prebuilt/components/SidePaneTabs.tsx +3 -2
  50. package/src/Prebuilt/components/Toast/ToastConfig.jsx +1 -0
  51. package/src/Prebuilt/components/VirtualBackground/VBCollection.tsx +4 -4
  52. package/src/Prebuilt/components/VirtualBackground/{VBPicker.jsx → VBPicker.tsx} +64 -44
  53. package/src/Prebuilt/components/VirtualBackground/constants.ts +0 -8
  54. package/src/Prebuilt/components/hooks/useAutoStartStreaming.tsx +10 -1
  55. package/src/Prebuilt/components/hooks/useChatBlacklist.ts +21 -0
  56. package/src/Prebuilt/components/hooks/useSetPinnedMessages.ts +75 -0
  57. package/src/Prebuilt/components/hooks/useUserPreferences.jsx +1 -0
  58. package/src/Prebuilt/layouts/SidePane.tsx +1 -1
  59. package/src/Prebuilt/layouts/VideoStreamingSection.tsx +16 -8
  60. package/src/Prebuilt/plugins/whiteboard/PusherCommunicationProvider.js +1 -1
  61. package/src/Prebuilt/plugins/whiteboard/README.md +1 -1
  62. package/src/Prebuilt/primitives/DialogContent.jsx +1 -1
  63. package/src/Prebuilt/provider/roomLayoutProvider/constants/index.ts +12 -1
  64. package/src/Prebuilt/provider/roomLayoutProvider/hooks/useRoomLayoutScreen.ts +5 -1
  65. package/dist/chunk-WREKGNP6.js.map +0 -7
  66. package/src/Prebuilt/components/hooks/useSetPinnedMessage.js +0 -38
  67. package/src/Prebuilt/services/tokenService.js +0 -49
  68. /package/dist/{HLSView-PWVM4OIP.js.map → HLSView-IENE4HRP.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
- }