@100mslive/roomkit-react 0.3.19-alpha.2 → 0.3.19-alpha.21

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 (43) hide show
  1. package/dist/{HLSView-BRZ2FW7O.js → HLSView-LQU6IEZQ.js} +2 -2
  2. package/dist/{HLSView-UXA322ED.css → HLSView-SQ7GMQJS.css} +3 -3
  3. package/dist/{HLSView-UXA322ED.css.map → HLSView-SQ7GMQJS.css.map} +1 -1
  4. package/dist/Modal/Dialog.d.ts +3 -1
  5. package/dist/Prebuilt/components/EndCallFeedback/Feedback.d.ts +2 -0
  6. package/dist/Prebuilt/components/EndCallFeedback/FeedbackForm.d.ts +28 -0
  7. package/dist/Prebuilt/components/EndCallFeedback/ThankyouView.d.ts +2 -0
  8. package/dist/Prebuilt/components/VirtualBackground/VBCollection.d.ts +1 -1
  9. package/dist/Prebuilt/components/VirtualBackground/VBHandler.d.ts +6 -6
  10. package/dist/Prebuilt/provider/roomLayoutProvider/hooks/useRoomLayoutScreen.d.ts +1 -0
  11. package/dist/{chunk-KR2DZJO5.js → chunk-IRF6KLC6.js} +1363 -831
  12. package/dist/chunk-IRF6KLC6.js.map +7 -0
  13. package/dist/index.cjs.css +2 -2
  14. package/dist/index.cjs.css.map +1 -1
  15. package/dist/index.cjs.js +1849 -1291
  16. package/dist/index.cjs.js.map +4 -4
  17. package/dist/index.css +2 -2
  18. package/dist/index.css.map +1 -1
  19. package/dist/index.js +1 -1
  20. package/dist/meta.cjs.json +323 -90
  21. package/dist/meta.esbuild.json +334 -101
  22. package/package.json +8 -8
  23. package/src/Modal/Dialog.tsx +13 -2
  24. package/src/Prebuilt/App.tsx +3 -0
  25. package/src/Prebuilt/AppStateContext.tsx +1 -2
  26. package/src/Prebuilt/Prebuilt.stories.tsx +1 -0
  27. package/src/Prebuilt/common/PeersSorter.ts +2 -1
  28. package/src/Prebuilt/components/EndCallFeedback/Feedback.tsx +71 -0
  29. package/src/Prebuilt/components/EndCallFeedback/FeedbackForm.tsx +381 -0
  30. package/src/Prebuilt/components/EndCallFeedback/ThankyouView.tsx +44 -0
  31. package/src/Prebuilt/components/LeaveScreen.tsx +2 -0
  32. package/src/Prebuilt/components/PIP/PIPChat.tsx +11 -4
  33. package/src/Prebuilt/components/VideoLayouts/RoleProminence.tsx +2 -9
  34. package/src/Prebuilt/components/VirtualBackground/VBCollection.tsx +3 -1
  35. package/src/Prebuilt/components/VirtualBackground/VBHandler.tsx +26 -4
  36. package/src/Prebuilt/components/VirtualBackground/VBPicker.tsx +58 -38
  37. package/src/Prebuilt/components/VirtualBackground/VBToggle.tsx +2 -1
  38. package/src/Prebuilt/plugins/CaptionsViewer.tsx +4 -1
  39. package/src/Prebuilt/provider/roomLayoutProvider/hooks/useRoomLayoutScreen.ts +1 -0
  40. package/dist/Prebuilt/components/VirtualBackground/util.d.ts +0 -1
  41. package/dist/chunk-KR2DZJO5.js.map +0 -7
  42. package/src/Prebuilt/components/VirtualBackground/util.tsx +0 -13
  43. /package/dist/{HLSView-BRZ2FW7O.js.map → HLSView-LQU6IEZQ.js.map} +0 -0
@@ -5,7 +5,6 @@ import { config as cssConfig } from '../../../Theme';
5
5
  import { InsetTile } from '../InsetTile';
6
6
  import { Pagination } from '../Pagination';
7
7
  import { SecondaryTiles } from '../SecondaryTiles';
8
- import { LayoutMode } from '../Settings/LayoutSettings';
9
8
  import { Grid } from './Grid';
10
9
  import { LayoutProps } from './interface';
11
10
  import { ProminenceLayout } from './ProminenceLayout';
@@ -25,7 +24,6 @@ export function RoleProminence({
25
24
  }: LayoutProps) {
26
25
  const { prominentPeers, secondaryPeers } = useRoleProminencePeers(prominentRoles, peers, isInsetEnabled);
27
26
  const localPeer = useHMSStore(selectLocalPeer);
28
- const layoutMode = useUISettings(UI_SETTINGS.layoutMode);
29
27
  const isMobile = useMedia(cssConfig.media.md);
30
28
  let maxTileCount = useUISettings(UI_SETTINGS.maxTileCount);
31
29
  maxTileCount = isMobile ? 4 : maxTileCount;
@@ -47,7 +45,7 @@ export function RoleProminence({
47
45
  }, [pageSize, onPageSize]);
48
46
 
49
47
  return (
50
- <ProminenceLayout.Root hasSidebar={layoutMode === LayoutMode.SIDEBAR}>
48
+ <ProminenceLayout.Root>
51
49
  <ProminenceLayout.ProminentSection>
52
50
  <Grid ref={ref} tiles={pagesWithTiles[page]} />
53
51
  </ProminenceLayout.ProminentSection>
@@ -61,12 +59,7 @@ export function RoleProminence({
61
59
  numPages={pagesWithTiles.length}
62
60
  />
63
61
  )}
64
- <SecondaryTiles
65
- peers={layoutMode === LayoutMode.SPOTLIGHT ? [] : secondaryPeers}
66
- isInsetEnabled={isInsetEnabled}
67
- edgeToEdge={edgeToEdge}
68
- hasSidebar={layoutMode === LayoutMode.SIDEBAR}
69
- />
62
+ <SecondaryTiles peers={secondaryPeers} isInsetEnabled={isInsetEnabled} edgeToEdge={edgeToEdge} />
70
63
  {isInsetEnabled && localPeer && prominentPeers.length > 0 && !prominentPeers.includes(localPeer) && <InsetTile />}
71
64
  </ProminenceLayout.Root>
72
65
  );
@@ -1,5 +1,7 @@
1
1
  import React from 'react';
2
- import { HMSVirtualBackgroundTypes } from '@100mslive/hms-virtual-background';
2
+ // Open issue with eslint-plugin-import https://github.com/import-js/eslint-plugin-import/issues/1810
3
+ // eslint-disable-next-line
4
+ import { HMSVirtualBackgroundTypes } from '@100mslive/hms-virtual-background/hmsvbplugin';
3
5
  import { Box } from '../../../Layout';
4
6
  import { Text } from '../../../Text';
5
7
  import { VBOption } from './VBOption';
@@ -1,14 +1,25 @@
1
- import { HMSEffectsPlugin, HMSVBPlugin, HMSVirtualBackgroundTypes } from '@100mslive/hms-virtual-background';
1
+ // Open issue with eslint-plugin-import https://github.com/import-js/eslint-plugin-import/issues/1810
2
+ // eslint-disable-next-line
3
+ import { HMSVBPlugin, HMSVirtualBackgroundTypes } from '@100mslive/hms-virtual-background/hmsvbplugin';
4
+ import { parsedUserAgent } from '@100mslive/react-sdk';
5
+ import { isSafari } from '../../common/constants';
2
6
  export class VBPlugin {
3
7
  private hmsPlugin?: HMSVBPlugin;
4
- private effectsPlugin?: HMSEffectsPlugin;
8
+ private effectsPlugin?: any;
5
9
 
6
- initialisePlugin = (effectsSDKKey?: string, onInit?: () => void) => {
10
+ initialisePlugin = async (effectsSDKKey?: string, onInit?: () => void) => {
7
11
  if (this.getVBObject()) {
8
12
  return;
9
13
  }
10
14
  if (effectsSDKKey) {
11
- this.effectsPlugin = new HMSEffectsPlugin(effectsSDKKey, onInit);
15
+ try {
16
+ // eslint-disable-next-line
17
+ const effects = await import('@100mslive/hms-virtual-background/hmseffectsplugin');
18
+ this.effectsPlugin = new effects.HMSEffectsPlugin(effectsSDKKey, onInit);
19
+ } catch (error) {
20
+ console.error('Failed to initialise HMSEffectsPlugin:', error, 'Using HMSVBPlugin');
21
+ this.hmsPlugin = new HMSVBPlugin(HMSVirtualBackgroundTypes.NONE, HMSVirtualBackgroundTypes.NONE);
22
+ }
12
23
  } else {
13
24
  this.hmsPlugin = new HMSVBPlugin(HMSVirtualBackgroundTypes.NONE, HMSVirtualBackgroundTypes.NONE);
14
25
  }
@@ -91,6 +102,17 @@ export class VBPlugin {
91
102
  this.effectsPlugin = undefined;
92
103
  this.hmsPlugin = undefined;
93
104
  };
105
+
106
+ isEffectsSupported = () => {
107
+ if (!isSafari) {
108
+ return true;
109
+ }
110
+ const browserVersion = parsedUserAgent?.getBrowser()?.version || '16';
111
+ if (browserVersion && parseInt(browserVersion.split('.')[0]) < 17) {
112
+ return false;
113
+ }
114
+ return true;
115
+ };
94
116
  }
95
117
 
96
118
  export const VBHandler = new VBPlugin();
@@ -1,12 +1,15 @@
1
- import React, { useEffect, useState } from 'react';
1
+ import React, { useEffect, useRef, useState } from 'react';
2
2
  import { useMedia } from 'react-use';
3
3
  import {
4
+ HMSMediaStreamPlugin,
4
5
  selectAppData,
5
6
  selectEffectsKey,
6
7
  selectIsEffectsEnabled,
7
8
  selectLocalPeerRole,
8
9
  } from '@100mslive/hms-video-store';
9
- import { HMSEffectsPlugin, HMSVBPlugin, HMSVirtualBackgroundTypes } from '@100mslive/hms-virtual-background';
10
+ // Open issue with eslint-plugin-import https://github.com/import-js/eslint-plugin-import/issues/1810
11
+ // eslint-disable-next-line
12
+ import { HMSVBPlugin, HMSVirtualBackgroundTypes } from '@100mslive/hms-virtual-background/hmsvbplugin';
10
13
  import { VirtualBackgroundMedia } from '@100mslive/types-prebuilt/elements/virtual_background';
11
14
  import {
12
15
  HMSRoomState,
@@ -22,7 +25,6 @@ import {
22
25
  import { BlurPersonHighIcon, CrossCircleIcon, CrossIcon } from '@100mslive/react-icons';
23
26
  import { Box, config as cssConfig, Flex, Loading, Slider, Video } from '../../../index';
24
27
  import { Text } from '../../../Text';
25
- import { doesBrowserSupportEffectsSDK } from './util';
26
28
  import { VBCollection } from './VBCollection';
27
29
  import { VBHandler } from './VBHandler';
28
30
  // @ts-ignore
@@ -46,7 +48,7 @@ export const VBPicker = ({ backgroundMedia = [] }: { backgroundMedia: VirtualBac
46
48
  const [blurAmount, setBlurAmount] = useState(VBHandler.getBlurAmount() || 0.5);
47
49
  const roomState = useHMSStore(selectRoomState);
48
50
  const isLargeRoom = useHMSStore(selectIsLargeRoom);
49
- const [isBlurSupported, setIsBlurSupported] = useState(false);
51
+ const isEffectsSupported = VBHandler.isEffectsSupported();
50
52
  const isEffectsEnabled = useHMSStore(selectIsEffectsEnabled);
51
53
  const effectsKey = useHMSStore(selectEffectsKey);
52
54
  const isMobile = useMedia(cssConfig.media.md);
@@ -54,54 +56,72 @@ export const VBPicker = ({ backgroundMedia = [] }: { backgroundMedia: VirtualBac
54
56
  const isPluginAdded = useHMSStore(selectIsLocalVideoPluginPresent(VBHandler?.getName() || ''));
55
57
  const background = useHMSStore(selectAppData(APP_DATA.background));
56
58
  const mediaList = backgroundMedia.map((media: VirtualBackgroundMedia) => media.url || '');
59
+ const pluginLoadingRef = useRef(false);
57
60
 
58
61
  const inPreview = roomState === HMSRoomState.Preview;
59
62
  // Hidden in preview as the effect will be visible in the preview tile
60
63
  const showVideoTile = isVideoOn && isLargeRoom && !inPreview;
61
64
 
62
65
  useEffect(() => {
63
- if (!track?.id) {
64
- return;
65
- }
66
- const isEffectsSupported = doesBrowserSupportEffectsSDK();
67
- setIsBlurSupported(isEffectsSupported);
68
- const vbObject = VBHandler.getVBObject();
69
- if (!isPluginAdded && !vbObject) {
70
- setLoadingEffects(true);
71
- let vbObject = VBHandler.getVBObject();
72
- if (!vbObject) {
73
- VBHandler.initialisePlugin(isEffectsEnabled && effectsKey ? effectsKey : '', () => setLoadingEffects(false));
74
- vbObject = VBHandler.getVBObject();
66
+ const addHMSVBPlugin = async () => {
67
+ setLoadingEffects(false);
68
+ if (!role) {
69
+ return;
70
+ }
71
+ await VBHandler.initialisePlugin();
72
+ await hmsActions.addPluginToVideoTrack(
73
+ VBHandler.getVBObject() as HMSVBPlugin,
74
+ Math.floor(role.publishParams.video.frameRate / 2),
75
+ );
76
+ };
77
+ const initializeVirtualBackground = async () => {
78
+ if (!track?.id || pluginLoadingRef.current || isPluginAdded) {
79
+ return;
80
+ }
81
+
82
+ try {
83
+ pluginLoadingRef.current = true;
75
84
  if (isEffectsEnabled && isEffectsSupported && effectsKey) {
76
- hmsActions.addPluginsToVideoStream([vbObject as HMSEffectsPlugin]);
77
- } else {
78
- setLoadingEffects(false);
79
- if (!role) {
80
- return;
85
+ setLoadingEffects(true);
86
+ await VBHandler.initialisePlugin(effectsKey, () => {
87
+ setLoadingEffects(false);
88
+ });
89
+ const vbInstance = VBHandler.getVBObject();
90
+ if (vbInstance.getName() === 'HMSEffects') {
91
+ hmsActions.addPluginsToVideoStream([VBHandler.getVBObject() as HMSMediaStreamPlugin]);
92
+ } else {
93
+ await addHMSVBPlugin();
81
94
  }
82
- hmsActions.addPluginToVideoTrack(vbObject as HMSVBPlugin, Math.floor(role.publishParams.video.frameRate / 2));
95
+ } else {
96
+ await addHMSVBPlugin();
83
97
  }
84
- }
85
- const handleDefaultBackground = async () => {
86
- switch (background) {
87
- case HMSVirtualBackgroundTypes.NONE: {
88
- break;
89
- }
90
- case HMSVirtualBackgroundTypes.BLUR: {
91
- await VBHandler.setBlur(blurAmount);
92
- break;
98
+
99
+ const handleDefaultBackground = async () => {
100
+ switch (background) {
101
+ case HMSVirtualBackgroundTypes.NONE:
102
+ break;
103
+ case HMSVirtualBackgroundTypes.BLUR:
104
+ await VBHandler.setBlur(blurAmount);
105
+ break;
106
+ default:
107
+ await VBHandler.setBackground(background);
93
108
  }
94
- default:
95
- await VBHandler.setBackground(background);
96
- }
97
- };
98
- handleDefaultBackground();
99
- }
109
+ };
110
+
111
+ await handleDefaultBackground();
112
+ } catch (error) {
113
+ console.error('Error initializing virtual background:', error);
114
+ setLoadingEffects(false);
115
+ }
116
+ };
117
+
118
+ initializeVirtualBackground();
100
119
  }, [
101
120
  hmsActions,
102
121
  role,
103
122
  isPluginAdded,
104
123
  isEffectsEnabled,
124
+ isEffectsSupported,
105
125
  effectsKey,
106
126
  track?.id,
107
127
  background,
@@ -170,7 +190,7 @@ export const VBPicker = ({ backgroundMedia = [] }: { backgroundMedia: VirtualBac
170
190
  await VBHandler?.setBlur(blurAmount);
171
191
  hmsActions.setAppData(APP_DATA.background, HMSVirtualBackgroundTypes.BLUR);
172
192
  },
173
- supported: isBlurSupported,
193
+ supported: isEffectsSupported && isEffectsEnabled,
174
194
  },
175
195
  ]}
176
196
  activeBackground={background}
@@ -1,5 +1,6 @@
1
1
  import React, { useEffect } from 'react';
2
- import { HMSVirtualBackgroundTypes } from '@100mslive/hms-virtual-background';
2
+ // eslint-disable-next-line
3
+ import { HMSVirtualBackgroundTypes } from '@100mslive/hms-virtual-background/hmsvbplugin';
3
4
  import {
4
5
  selectAppData,
5
6
  selectIsEffectsEnabled,
@@ -144,7 +144,10 @@ class Queue {
144
144
  }
145
145
 
146
146
  class CaptionMaintainerQueue {
147
- captionData: Queue = new Queue();
147
+ captionData: Queue;
148
+ constructor() {
149
+ this.captionData = new Queue();
150
+ }
148
151
  push(data: HMSTranscript[] = []) {
149
152
  data.forEach((value: HMSTranscript) => {
150
153
  this.captionData.enqueue(value);
@@ -77,6 +77,7 @@ export function useRoomLayoutLeaveScreen() {
77
77
  const isLeaveScreenEnabled = !!screenProps;
78
78
  return {
79
79
  isLeaveScreenEnabled,
80
+ feedback: screenProps?.default?.elements?.feedback,
80
81
  };
81
82
  }
82
83
 
@@ -1 +0,0 @@
1
- export declare const doesBrowserSupportEffectsSDK: () => boolean;