@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.
- package/dist/{HLSView-J2MIS3H2.js → HLSView-AIPLCDXY.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/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/Theme/stitches.config.d.ts +226 -226
- package/dist/{chunk-OYSYEA6R.js → chunk-5DCII2TP.js} +2248 -1269
- package/dist/chunk-5DCII2TP.js.map +7 -0
- package/dist/index.cjs.js +2943 -1902
- package/dist/index.cjs.js.map +4 -4
- package/dist/index.js +1 -1
- package/dist/meta.cjs.json +819 -313
- package/dist/meta.esbuild.json +826 -320
- package/package.json +8 -8
- 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 +4 -4
- package/src/Prebuilt/components/Chat/Chat.jsx +51 -73
- package/src/Prebuilt/components/Chat/ChatBody.jsx +219 -48
- package/src/Prebuilt/components/Chat/ChatFooter.tsx +50 -6
- package/src/Prebuilt/components/Chat/ChatStates.jsx +66 -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 +118 -0
- package/src/Prebuilt/components/Footer/Footer.tsx +4 -7
- package/src/Prebuilt/components/Header/common.jsx +1 -1
- package/src/Prebuilt/components/Preview/PreviewJoin.tsx +6 -8
- 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 +20 -0
- package/src/Prebuilt/components/VirtualBackground/VBCollection.tsx +4 -4
- package/src/Prebuilt/components/VirtualBackground/{VBPicker.jsx → VBPicker.tsx} +27 -18
- 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 +76 -0
- package/src/Prebuilt/layouts/SidePane.tsx +1 -1
- package/src/Prebuilt/layouts/VideoStreamingSection.tsx +30 -2
- 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/src/Theme/stitches.config.ts +1 -2
- package/dist/chunk-OYSYEA6R.js.map +0 -7
- package/src/Prebuilt/components/hooks/useSetPinnedMessage.js +0 -38
- package/src/Prebuilt/services/tokenService.js +0 -49
- /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
|
-
}
|
File without changes
|