@stream-io/video-react-sdk 0.4.26 → 0.5.0

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 (91) hide show
  1. package/CHANGELOG.md +297 -238
  2. package/README.md +5 -5
  3. package/dist/css/styles.css +952 -481
  4. package/dist/css/styles.css.map +1 -1
  5. package/dist/index.cjs.js +946 -639
  6. package/dist/index.cjs.js.map +1 -1
  7. package/dist/index.es.js +939 -639
  8. package/dist/index.es.js.map +1 -1
  9. package/dist/src/components/Button/CompositeButton.d.ts +9 -11
  10. package/dist/src/components/Button/index.d.ts +0 -1
  11. package/dist/src/components/CallControls/CallStatsButton.d.ts +3 -0
  12. package/dist/src/components/CallControls/CancelCallButton.d.ts +1 -0
  13. package/dist/src/components/CallControls/ReactionsButton.d.ts +2 -1
  14. package/dist/src/components/CallControls/RecordCallButton.d.ts +4 -1
  15. package/dist/src/components/CallControls/ToggleAudioButton.d.ts +3 -9
  16. package/dist/src/components/CallControls/ToggleAudioOutputButton.d.ts +2 -5
  17. package/dist/src/components/CallControls/ToggleVideoButton.d.ts +3 -9
  18. package/dist/src/components/CallParticipantsList/CallParticipantListHeader.d.ts +3 -1
  19. package/dist/src/components/CallParticipantsList/CallParticipantListingItem.d.ts +0 -5
  20. package/dist/src/components/CallStats/CallStats.d.ts +25 -2
  21. package/dist/src/components/DeviceSettings/DeviceSelector.d.ts +6 -1
  22. package/dist/src/components/DeviceSettings/DeviceSelectorAudio.d.ts +4 -2
  23. package/dist/src/components/DeviceSettings/DeviceSelectorVideo.d.ts +2 -1
  24. package/dist/src/components/DeviceSettings/DeviceSettings.d.ts +5 -1
  25. package/dist/src/components/DropdownSelect/DropdownSelect.d.ts +14 -0
  26. package/dist/src/components/DropdownSelect/index.d.ts +1 -0
  27. package/dist/src/components/Icon/Icon.d.ts +2 -1
  28. package/dist/src/components/Menu/GenericMenu.d.ts +4 -2
  29. package/dist/src/components/Menu/MenuToggle.d.ts +15 -2
  30. package/dist/src/components/Notification/Notification.d.ts +1 -0
  31. package/dist/src/components/Notification/RecordingInProgressNotification.d.ts +5 -0
  32. package/dist/src/components/Notification/SpeakingWhileMutedNotification.d.ts +3 -1
  33. package/dist/src/components/Notification/index.d.ts +1 -0
  34. package/dist/src/components/index.d.ts +2 -0
  35. package/dist/src/core/components/ParticipantView/DefaultParticipantViewUI.d.ts +7 -1
  36. package/dist/src/core/components/ParticipantView/ParticipantActionsContextMenu.d.ts +1 -0
  37. package/dist/src/core/components/ParticipantView/ParticipantViewContext.d.ts +3 -3
  38. package/dist/src/core/components/ParticipantView/index.d.ts +1 -0
  39. package/dist/src/hooks/useFloatingUIPreset.d.ts +4 -1
  40. package/dist/src/translations/index.d.ts +9 -0
  41. package/package.json +7 -9
  42. package/src/components/Button/CompositeButton.tsx +78 -26
  43. package/src/components/Button/IconButton.tsx +22 -21
  44. package/src/components/Button/index.ts +0 -1
  45. package/src/components/CallControls/AcceptCallButton.tsx +1 -0
  46. package/src/components/CallControls/CallControls.tsx +2 -2
  47. package/src/components/CallControls/CallStatsButton.tsx +24 -7
  48. package/src/components/CallControls/CancelCallButton.tsx +102 -3
  49. package/src/components/CallControls/ReactionsButton.tsx +37 -17
  50. package/src/components/CallControls/RecordCallButton.tsx +131 -21
  51. package/src/components/CallControls/ScreenShareButton.tsx +29 -15
  52. package/src/components/CallControls/ToggleAudioButton.tsx +76 -31
  53. package/src/components/CallControls/ToggleAudioOutputButton.tsx +14 -10
  54. package/src/components/CallControls/ToggleVideoButton.tsx +83 -33
  55. package/src/components/CallParticipantsList/CallParticipantListHeader.tsx +9 -6
  56. package/src/components/CallParticipantsList/CallParticipantListingItem.tsx +17 -281
  57. package/src/components/CallParticipantsList/CallParticipantsList.tsx +2 -32
  58. package/src/components/CallRecordingList/CallRecordingList.tsx +24 -6
  59. package/src/components/CallRecordingList/CallRecordingListHeader.tsx +6 -2
  60. package/src/components/CallRecordingList/CallRecordingListItem.tsx +18 -41
  61. package/src/components/CallStats/CallStats.tsx +167 -10
  62. package/src/components/CallStats/CallStatsLatencyChart.tsx +73 -44
  63. package/src/components/DeviceSettings/DeviceSelector.tsx +107 -12
  64. package/src/components/DeviceSettings/DeviceSelectorAudio.tsx +13 -5
  65. package/src/components/DeviceSettings/DeviceSelectorVideo.tsx +10 -4
  66. package/src/components/DeviceSettings/DeviceSettings.tsx +40 -28
  67. package/src/components/DropdownSelect/DropdownSelect.tsx +214 -0
  68. package/src/components/DropdownSelect/index.ts +1 -0
  69. package/src/components/Icon/Icon.tsx +7 -2
  70. package/src/components/Menu/GenericMenu.tsx +25 -3
  71. package/src/components/Menu/MenuToggle.tsx +79 -14
  72. package/src/components/Notification/Notification.tsx +8 -0
  73. package/src/components/Notification/PermissionNotification.tsx +2 -1
  74. package/src/components/Notification/RecordingInProgressNotification.tsx +40 -0
  75. package/src/components/Notification/SpeakingWhileMutedNotification.tsx +9 -1
  76. package/src/components/Notification/index.ts +1 -0
  77. package/src/components/Permissions/PermissionRequests.tsx +9 -21
  78. package/src/components/Search/hooks/useSearch.ts +5 -1
  79. package/src/components/index.ts +2 -0
  80. package/src/core/components/ParticipantView/DefaultParticipantViewUI.tsx +71 -57
  81. package/src/core/components/ParticipantView/ParticipantActionsContextMenu.tsx +241 -0
  82. package/src/core/components/ParticipantView/ParticipantView.tsx +2 -2
  83. package/src/core/components/ParticipantView/ParticipantViewContext.tsx +3 -3
  84. package/src/core/components/ParticipantView/index.ts +1 -0
  85. package/src/core/components/Video/BaseVideo.tsx +1 -1
  86. package/src/core/components/Video/DefaultVideoPlaceholder.tsx +19 -5
  87. package/src/hooks/useFloatingUIPreset.ts +3 -2
  88. package/src/hooks/useRequestPermission.ts +2 -1
  89. package/src/translations/en.json +9 -0
  90. package/dist/src/components/Button/CopyToClipboardButton.d.ts +0 -27
  91. package/src/components/Button/CopyToClipboardButton.tsx +0 -129
@@ -24,6 +24,7 @@
24
24
  "Waiting for recording to start...": "Waiting for recording to start...",
25
25
  "Record call": "Record call",
26
26
  "Reactions": "Reactions",
27
+ "Statistics": "Statistics",
27
28
  "You can now share your screen.": "You can now share your screen.",
28
29
  "Awaiting for an approval to share screen.": "Awaiting for an approval to share screen.",
29
30
  "You can no longer share your screen.": "You can no longer share your screen.",
@@ -37,6 +38,12 @@
37
38
  "Me": "Me",
38
39
  "Unknown": "Unknown",
39
40
  "Toggle device menu": "Toggle device menu",
41
+ "Call Recordings": "Call Recordings",
42
+ "Refresh": "Refresh",
43
+ "Check your browser video permissions": "Check your browser video permissions",
44
+ "Video publishing is disabled by the system": "Video publishing is disabled by the system",
45
+ "You have no permission to share your video": "You have no permission to share your video",
46
+ "You have no permission to share your audio": "You have no permission to share your audio",
40
47
 
41
48
  "You are presenting your screen": "You are presenting your screen",
42
49
  "Stop Screen Sharing": "Stop Screen Sharing",
@@ -69,6 +76,8 @@
69
76
  "Disable screen sharing": "Disable screen sharing",
70
77
  "Enter": "Enter",
71
78
  "Leave": "Leave",
79
+ "Leave call": "Leave call",
80
+ "End call for all": "End call for all",
72
81
  "{{ direction }} fullscreen": "{{ direction }} fullscreen",
73
82
  "{{ direction }} picture-in-picture": "{{ direction }} picture-in-picture",
74
83
 
@@ -1,27 +0,0 @@
1
- import { ComponentProps, ComponentPropsWithRef, ComponentType, ForwardedRef } from 'react';
2
- import { Placement } from '@floating-ui/react';
3
- type CopyToClipboardButtonProps = ComponentProps<'button'> & {
4
- /** Custom button component implementation. Will be rendered instead of native button element */
5
- Button?: ComponentType<ComponentPropsWithRef<'button'> & {
6
- ref: ForwardedRef<HTMLButtonElement>;
7
- }>;
8
- /** Custom function to override the logic of generating the call invitation link */
9
- copyValue: (() => string) | string;
10
- /** Callback invoked if the copy-to-clipboard action fails */
11
- onError?: (button: HTMLButtonElement, e: Error) => void;
12
- /** Callback invoked if the copy-to-clipboard action succeeds */
13
- onSuccess?: (button: HTMLButtonElement) => void;
14
- };
15
- export declare const CopyToClipboardButton: import("react").ForwardRefExoticComponent<Omit<CopyToClipboardButtonProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
16
- type CopyToClipboardButtonWithPopupProps = Exclude<CopyToClipboardButtonProps, 'onError' | 'onSuccess'> & {
17
- dismissAfterMs?: number;
18
- /** String displayed when copy-to-clipboard action fails */
19
- onErrorMessage?: string;
20
- /** String displayed when copy-to-clipboard succeeds fails */
21
- onSuccessMessage?: string;
22
- /** Class applied to the popup container element */
23
- popupClassName?: string;
24
- popupPlacement?: Placement;
25
- };
26
- export declare const CopyToClipboardButtonWithPopup: ({ dismissAfterMs, onErrorMessage, onSuccessMessage, popupClassName, popupPlacement, ...restProps }: CopyToClipboardButtonWithPopupProps) => import("react/jsx-runtime").JSX.Element;
27
- export {};
@@ -1,129 +0,0 @@
1
- import {
2
- ComponentProps,
3
- ComponentPropsWithRef,
4
- ComponentType,
5
- ForwardedRef,
6
- forwardRef,
7
- MouseEventHandler,
8
- useCallback,
9
- useState,
10
- } from 'react';
11
- import clsx from 'clsx';
12
- import { Placement } from '@floating-ui/react';
13
-
14
- import { Tooltip } from '../Tooltip';
15
-
16
- type CopyToClipboardButtonProps = ComponentProps<'button'> & {
17
- /** Custom button component implementation. Will be rendered instead of native button element */
18
- Button?: ComponentType<
19
- ComponentPropsWithRef<'button'> & { ref: ForwardedRef<HTMLButtonElement> }
20
- >;
21
- /** Custom function to override the logic of generating the call invitation link */
22
- copyValue: (() => string) | string;
23
- /** Callback invoked if the copy-to-clipboard action fails */
24
- onError?: (button: HTMLButtonElement, e: Error) => void;
25
- /** Callback invoked if the copy-to-clipboard action succeeds */
26
- onSuccess?: (button: HTMLButtonElement) => void;
27
- };
28
-
29
- export const CopyToClipboardButton = forwardRef<
30
- HTMLButtonElement,
31
- CopyToClipboardButtonProps
32
- >(
33
- (
34
- { Button, className, copyValue, onClick, onError, onSuccess, ...restProps },
35
- ref,
36
- ) => {
37
- const handleClick: MouseEventHandler<HTMLButtonElement> = useCallback(
38
- async (event) => {
39
- if (onClick) onClick(event);
40
- const value = typeof copyValue === 'function' ? copyValue() : copyValue;
41
- try {
42
- await navigator?.clipboard.writeText(value);
43
- onSuccess?.(event.target as HTMLButtonElement);
44
- } catch (error) {
45
- onError?.(event.target as HTMLButtonElement, error as Error);
46
- }
47
- },
48
- [copyValue, onClick, onError, onSuccess],
49
- );
50
-
51
- const props = {
52
- ...restProps,
53
- ref: ref,
54
- className: clsx('str-video__copy-to-clipboard-button', className),
55
- onClick: handleClick,
56
- };
57
-
58
- return Button ? <Button {...props} /> : <button {...props} />;
59
- },
60
- );
61
-
62
- type CopyToClipboardButtonWithPopupProps = Exclude<
63
- CopyToClipboardButtonProps,
64
- 'onError' | 'onSuccess'
65
- > & {
66
- dismissAfterMs?: number;
67
- /** String displayed when copy-to-clipboard action fails */
68
- onErrorMessage?: string;
69
- /** String displayed when copy-to-clipboard succeeds fails */
70
- onSuccessMessage?: string;
71
- /** Class applied to the popup container element */
72
- popupClassName?: string;
73
- // todo: We should replace Placement for internal type
74
- popupPlacement?: Placement;
75
- };
76
-
77
- export const CopyToClipboardButtonWithPopup = ({
78
- dismissAfterMs = 1500,
79
- onErrorMessage = 'Failed to copy',
80
- onSuccessMessage = 'Copied to clipboard',
81
- popupClassName,
82
- popupPlacement,
83
- ...restProps
84
- }: CopyToClipboardButtonWithPopupProps) => {
85
- const [tooltipText, setTooltipText] = useState('');
86
- const [tooltipAnchor, setTooltipAnchor] = useState<HTMLButtonElement | null>(
87
- null,
88
- );
89
-
90
- const setTemporaryPopup = useCallback(
91
- (popupText: string) => {
92
- setTooltipText(popupText);
93
- setTimeout(() => setTooltipText(''), dismissAfterMs);
94
- },
95
- [dismissAfterMs],
96
- );
97
-
98
- const onSuccess = useCallback(
99
- () => setTemporaryPopup(onSuccessMessage),
100
- [onSuccessMessage, setTemporaryPopup],
101
- );
102
-
103
- const onError = useCallback(
104
- () => setTemporaryPopup(onErrorMessage),
105
- [onErrorMessage, setTemporaryPopup],
106
- );
107
-
108
- return (
109
- <>
110
- <Tooltip
111
- tooltipClassName={clsx(
112
- 'str-video__copy-to-clipboard-button__popup',
113
- popupClassName,
114
- )}
115
- tooltipPlacement={popupPlacement}
116
- referenceElement={tooltipAnchor}
117
- visible={!!tooltipText}
118
- >
119
- {tooltipText}
120
- </Tooltip>
121
- <CopyToClipboardButton
122
- {...restProps}
123
- onError={onError}
124
- onSuccess={onSuccess}
125
- ref={setTooltipAnchor}
126
- />
127
- </>
128
- );
129
- };