@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.
- package/dist/{HLSView-PWVM4OIP.js → HLSView-IENE4HRP.js} +2 -2
- package/dist/Prebuilt/App.d.ts +0 -2
- package/dist/Prebuilt/AppContext.d.ts +0 -2
- package/dist/Prebuilt/common/constants.d.ts +110 -0
- package/dist/Prebuilt/components/AppData/AppData.d.ts +2 -0
- package/dist/Prebuilt/components/Chat/MwebChatOption.d.ts +7 -0
- package/dist/Prebuilt/components/Chat/Navigation.d.ts +8 -0
- package/dist/Prebuilt/components/Chat/PinnedMessage.d.ts +4 -0
- package/dist/Prebuilt/components/Footer/Footer.d.ts +3 -2
- package/dist/Prebuilt/components/Notifications/ChatNotifications.d.ts +2 -0
- package/dist/Prebuilt/components/Preview/PreviewJoin.d.ts +2 -1
- package/dist/Prebuilt/components/VirtualBackground/VBCollection.d.ts +2 -1
- package/dist/Prebuilt/components/VirtualBackground/VBPicker.d.ts +3 -0
- package/dist/Prebuilt/components/VirtualBackground/constants.d.ts +0 -6
- package/dist/Prebuilt/components/hooks/useChatBlacklist.d.ts +4 -0
- package/dist/Prebuilt/components/hooks/useSetPinnedMessages.d.ts +16 -0
- package/dist/Prebuilt/provider/roomLayoutProvider/hooks/useRoomLayoutScreen.d.ts +3 -2
- package/dist/{chunk-WREKGNP6.js → chunk-U4AB6X6M.js} +2178 -1148
- package/dist/chunk-U4AB6X6M.js.map +7 -0
- package/dist/index.cjs.js +2746 -1638
- package/dist/index.cjs.js.map +4 -4
- package/dist/index.js +1 -1
- package/dist/meta.cjs.json +803 -208
- package/dist/meta.esbuild.json +812 -217
- package/package.json +8 -7
- package/src/Prebuilt/App.tsx +3 -14
- package/src/Prebuilt/AppContext.tsx +0 -2
- package/src/Prebuilt/common/{constants.js → constants.ts} +22 -20
- package/src/Prebuilt/components/AppData/{AppData.jsx → AppData.tsx} +8 -22
- package/src/Prebuilt/components/AppData/useUISettings.js +0 -4
- package/src/Prebuilt/components/AuthToken.jsx +15 -5
- package/src/Prebuilt/components/Chat/Chat.jsx +49 -73
- package/src/Prebuilt/components/Chat/ChatBody.jsx +241 -51
- package/src/Prebuilt/components/Chat/ChatFooter.tsx +56 -6
- package/src/Prebuilt/components/Chat/ChatStates.jsx +68 -0
- package/src/Prebuilt/components/Chat/MwebChatOption.tsx +24 -0
- package/src/Prebuilt/components/Chat/Navigation.tsx +60 -0
- package/src/Prebuilt/components/Chat/PinnedMessage.tsx +116 -0
- package/src/Prebuilt/components/Footer/Footer.tsx +4 -7
- package/src/Prebuilt/components/Header/common.jsx +1 -1
- package/src/Prebuilt/components/Notifications/ChatNotifications.tsx +34 -0
- package/src/Prebuilt/components/Notifications/Notifications.tsx +2 -0
- package/src/Prebuilt/components/Polls/Voting/QuestionCard.jsx +6 -4
- package/src/Prebuilt/components/Polls/Voting/TimedVoting.jsx +3 -2
- package/src/Prebuilt/components/Polls/common/VoteCount.jsx +6 -4
- package/src/Prebuilt/components/Preview/PreviewJoin.tsx +7 -9
- package/src/Prebuilt/components/RoleChangeRequest/RoleChangeRequestModal.tsx +4 -1
- package/src/Prebuilt/components/Settings/DeviceSettings.jsx +1 -1
- package/src/Prebuilt/components/SidePaneTabs.tsx +3 -2
- package/src/Prebuilt/components/Toast/ToastConfig.jsx +1 -0
- package/src/Prebuilt/components/VirtualBackground/VBCollection.tsx +4 -4
- package/src/Prebuilt/components/VirtualBackground/{VBPicker.jsx → VBPicker.tsx} +64 -44
- package/src/Prebuilt/components/VirtualBackground/constants.ts +0 -8
- package/src/Prebuilt/components/hooks/useAutoStartStreaming.tsx +10 -1
- package/src/Prebuilt/components/hooks/useChatBlacklist.ts +21 -0
- package/src/Prebuilt/components/hooks/useSetPinnedMessages.ts +75 -0
- package/src/Prebuilt/components/hooks/useUserPreferences.jsx +1 -0
- package/src/Prebuilt/layouts/SidePane.tsx +1 -1
- package/src/Prebuilt/layouts/VideoStreamingSection.tsx +16 -8
- package/src/Prebuilt/plugins/whiteboard/PusherCommunicationProvider.js +1 -1
- package/src/Prebuilt/plugins/whiteboard/README.md +1 -1
- package/src/Prebuilt/primitives/DialogContent.jsx +1 -1
- package/src/Prebuilt/provider/roomLayoutProvider/constants/index.ts +12 -1
- package/src/Prebuilt/provider/roomLayoutProvider/hooks/useRoomLayoutScreen.ts +5 -1
- package/dist/chunk-WREKGNP6.js.map +0 -7
- package/src/Prebuilt/components/hooks/useSetPinnedMessage.js +0 -38
- package/src/Prebuilt/services/tokenService.js +0 -49
- /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
|
-
}
|
File without changes
|