@stream-io/video-react-sdk 1.34.0 → 1.34.1

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 (27) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/{background-filters-Zu84SkRR.cjs.js → background-filters-DdQqSx4T.cjs.js} +7 -3
  3. package/dist/background-filters-DdQqSx4T.cjs.js.map +1 -0
  4. package/dist/{background-filters-RdXfNf6_.es.js → background-filters-g6ozIvlN.es.js} +7 -3
  5. package/dist/background-filters-g6ozIvlN.es.js.map +1 -0
  6. package/dist/{embedded-BackgroundFilters-Zu84SkRR.cjs.js → embedded-BackgroundFilters-DdQqSx4T.cjs.js} +7 -3
  7. package/dist/embedded-BackgroundFilters-DdQqSx4T.cjs.js.map +1 -0
  8. package/dist/{embedded-BackgroundFilters-RdXfNf6_.es.js → embedded-BackgroundFilters-g6ozIvlN.es.js} +7 -3
  9. package/dist/embedded-BackgroundFilters-g6ozIvlN.es.js.map +1 -0
  10. package/dist/embedded.cjs.js +37 -34
  11. package/dist/embedded.cjs.js.map +1 -1
  12. package/dist/embedded.es.js +37 -34
  13. package/dist/embedded.es.js.map +1 -1
  14. package/dist/index.cjs.js +42 -37
  15. package/dist/index.cjs.js.map +1 -1
  16. package/dist/index.es.js +42 -37
  17. package/dist/index.es.js.map +1 -1
  18. package/dist/src/components/BackgroundFilters/types.d.ts +6 -1
  19. package/dist/src/components/CallControls/RecordCallButton.d.ts +6 -5
  20. package/package.json +4 -4
  21. package/src/components/BackgroundFilters/BackgroundFilters.tsx +6 -0
  22. package/src/components/BackgroundFilters/types.ts +7 -0
  23. package/src/components/CallControls/RecordCallButton.tsx +26 -13
  24. package/dist/background-filters-RdXfNf6_.es.js.map +0 -1
  25. package/dist/background-filters-Zu84SkRR.cjs.js.map +0 -1
  26. package/dist/embedded-BackgroundFilters-RdXfNf6_.es.js.map +0 -1
  27. package/dist/embedded-BackgroundFilters-Zu84SkRR.cjs.js.map +0 -1
package/dist/index.cjs.js CHANGED
@@ -828,7 +828,7 @@ const AvatarFallback = ({ className, names, style, }) => {
828
828
  return (jsxRuntime.jsx("div", { className: clsx('str-video__avatar--initials-fallback', className), style: style, children: jsxRuntime.jsxs("div", { children: [names[0][0], names[1]?.[0]] }) }));
829
829
  };
830
830
 
831
- const BackgroundFiltersProviderImpl = react.lazy(() => Promise.resolve().then(function () { return require('./background-filters-Zu84SkRR.cjs.js'); }).then((m) => ({
831
+ const BackgroundFiltersProviderImpl = react.lazy(() => Promise.resolve().then(function () { return require('./background-filters-DdQqSx4T.cjs.js'); }).then((m) => ({
832
832
  default: m.BackgroundFiltersProvider,
833
833
  })));
834
834
  /**
@@ -1042,23 +1042,53 @@ const WithTooltip = ({ title, tooltipClassName, tooltipPlacement, tooltipDisable
1042
1042
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Tooltip, { referenceElement: tooltipAnchor, visible: tooltipActuallyVisible, tooltipClassName: tooltipClassName, tooltipPlacement: tooltipPlacement, children: title || '' }), jsxRuntime.jsx("div", { ref: setTooltipAnchor, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, ...props })] }));
1043
1043
  };
1044
1044
 
1045
- const RecordEndConfirmation = () => {
1045
+ /**
1046
+ * Wraps an event handler, silencing and logging exceptions (excluding the NotAllowedError
1047
+ * DOMException, which is a normal situation handled by the SDK)
1048
+ *
1049
+ * @param props component props, including the onError callback
1050
+ * @param handler event handler to wrap
1051
+ */
1052
+ const createCallControlHandler = (props, handler) => {
1053
+ return async () => {
1054
+ try {
1055
+ await handler();
1056
+ }
1057
+ catch (error) {
1058
+ if (props.onError) {
1059
+ props.onError(error);
1060
+ return;
1061
+ }
1062
+ if (!isNotAllowedError(error)) {
1063
+ console.error('Call control handler failed', error);
1064
+ }
1065
+ }
1066
+ };
1067
+ };
1068
+ function isNotAllowedError(error) {
1069
+ return error instanceof DOMException && error.name === 'NotAllowedError';
1070
+ }
1071
+
1072
+ const RecordEndConfirmation = (props) => {
1046
1073
  const { t } = videoReactBindings.useI18n();
1047
1074
  const { toggleCallRecording, isAwaitingResponse } = videoReactBindings.useToggleCallRecording();
1048
1075
  const { close } = useMenuContext();
1049
- return (jsxRuntime.jsxs("div", { className: "str-video__end-recording__confirmation", children: [jsxRuntime.jsxs("div", { className: "str-video__end-recording__header", children: [jsxRuntime.jsx(Icon, { icon: "recording-on" }), jsxRuntime.jsx("h2", { className: "str-video__end-recording__heading", children: t('End recording') })] }), jsxRuntime.jsx("p", { className: "str-video__end-recording__description", children: t('Are you sure you want end the recording?') }), jsxRuntime.jsxs("div", { className: "str-video__end-recording__actions", children: [jsxRuntime.jsx(CompositeButton, { variant: "secondary", onClick: close, children: t('Cancel') }), jsxRuntime.jsx(CompositeButton, { variant: "primary", onClick: toggleCallRecording, children: isAwaitingResponse ? jsxRuntime.jsx(LoadingIndicator, {}) : t('End recording') })] })] }));
1076
+ const handleClick = createCallControlHandler(props, toggleCallRecording);
1077
+ return (jsxRuntime.jsxs("div", { className: "str-video__end-recording__confirmation", children: [jsxRuntime.jsxs("div", { className: "str-video__end-recording__header", children: [jsxRuntime.jsx(Icon, { icon: "recording-on" }), jsxRuntime.jsx("h2", { className: "str-video__end-recording__heading", children: t('End recording') })] }), jsxRuntime.jsx("p", { className: "str-video__end-recording__description", children: t('Are you sure you want end the recording?') }), jsxRuntime.jsxs("div", { className: "str-video__end-recording__actions", children: [jsxRuntime.jsx(CompositeButton, { variant: "secondary", onClick: close, children: t('Cancel') }), jsxRuntime.jsx(CompositeButton, { variant: "primary", onClick: isAwaitingResponse ? undefined : handleClick, children: isAwaitingResponse ? jsxRuntime.jsx(LoadingIndicator, {}) : t('End recording') })] })] }));
1050
1078
  };
1051
1079
  const ToggleEndRecordingMenuButton = react.forwardRef(function ToggleEndRecordingMenuButton(props, ref) {
1052
1080
  return (jsxRuntime.jsx(CompositeButton, { ref: ref, active: true, variant: "secondary", "data-testid": "recording-stop-button", children: jsxRuntime.jsx(Icon, { icon: "recording-off" }) }));
1053
1081
  });
1054
- const RecordCallConfirmationButton = ({ caption, }) => {
1082
+ const RecordCallConfirmationButton = (props) => {
1083
+ const { caption } = props;
1055
1084
  const { t } = videoReactBindings.useI18n();
1056
1085
  const { toggleCallRecording, isAwaitingResponse, isCallRecordingInProgress } = videoReactBindings.useToggleCallRecording();
1086
+ const handleClick = createCallControlHandler(props, toggleCallRecording);
1057
1087
  if (isCallRecordingInProgress) {
1058
1088
  return (jsxRuntime.jsx(videoReactBindings.Restricted, { requiredGrants: [
1059
1089
  videoClient.OwnCapability.START_RECORD_CALL,
1060
1090
  videoClient.OwnCapability.STOP_RECORD_CALL,
1061
- ], children: jsxRuntime.jsx(MenuToggle, { ToggleButton: ToggleEndRecordingMenuButton, visualType: exports.MenuVisualType.PORTAL, children: jsxRuntime.jsx(RecordEndConfirmation, {}) }) }));
1091
+ ], children: jsxRuntime.jsx(MenuToggle, { ToggleButton: ToggleEndRecordingMenuButton, visualType: exports.MenuVisualType.PORTAL, children: jsxRuntime.jsx(RecordEndConfirmation, { onError: props.onError }) }) }));
1062
1092
  }
1063
1093
  const title = isAwaitingResponse
1064
1094
  ? t('Waiting for recording to start...')
@@ -1066,11 +1096,13 @@ const RecordCallConfirmationButton = ({ caption, }) => {
1066
1096
  return (jsxRuntime.jsx(videoReactBindings.Restricted, { requiredGrants: [
1067
1097
  videoClient.OwnCapability.START_RECORD_CALL,
1068
1098
  videoClient.OwnCapability.STOP_RECORD_CALL,
1069
- ], children: jsxRuntime.jsx(WithTooltip, { title: title, children: jsxRuntime.jsx(CompositeButton, { active: isCallRecordingInProgress, caption: caption, variant: "secondary", "data-testid": "recording-start-button", onClick: isAwaitingResponse ? undefined : toggleCallRecording, children: isAwaitingResponse ? (jsxRuntime.jsx(LoadingIndicator, {})) : (jsxRuntime.jsx(Icon, { icon: "recording-off" })) }) }) }));
1099
+ ], children: jsxRuntime.jsx(WithTooltip, { title: title, children: jsxRuntime.jsx(CompositeButton, { active: isCallRecordingInProgress, caption: caption, variant: "secondary", "data-testid": "recording-start-button", onClick: isAwaitingResponse ? undefined : handleClick, children: isAwaitingResponse ? (jsxRuntime.jsx(LoadingIndicator, {})) : (jsxRuntime.jsx(Icon, { icon: "recording-off" })) }) }) }));
1070
1100
  };
1071
- const RecordCallButton = ({ caption }) => {
1101
+ const RecordCallButton = (props) => {
1102
+ const { caption } = props;
1072
1103
  const { t } = videoReactBindings.useI18n();
1073
1104
  const { toggleCallRecording, isAwaitingResponse, isCallRecordingInProgress } = videoReactBindings.useToggleCallRecording();
1105
+ const handleClick = createCallControlHandler(props, toggleCallRecording);
1074
1106
  let title = caption ?? t('Record call');
1075
1107
  if (isAwaitingResponse) {
1076
1108
  title = isCallRecordingInProgress
@@ -1082,7 +1114,7 @@ const RecordCallButton = ({ caption }) => {
1082
1114
  videoClient.OwnCapability.STOP_RECORD_CALL,
1083
1115
  ], children: jsxRuntime.jsx(CompositeButton, { active: isCallRecordingInProgress, caption: caption, variant: "secondary", "data-testid": isCallRecordingInProgress
1084
1116
  ? 'recording-stop-button'
1085
- : 'recording-start-button', title: title, onClick: isAwaitingResponse ? undefined : toggleCallRecording, children: isAwaitingResponse ? (jsxRuntime.jsx(LoadingIndicator, {})) : (jsxRuntime.jsx(Icon, { icon: isCallRecordingInProgress ? 'recording-on' : 'recording-off' })) }) }));
1117
+ : 'recording-start-button', title: title, onClick: isAwaitingResponse ? undefined : handleClick, children: isAwaitingResponse ? (jsxRuntime.jsx(LoadingIndicator, {})) : (jsxRuntime.jsx(Icon, { icon: isCallRecordingInProgress ? 'recording-on' : 'recording-off' })) }) }));
1086
1118
  };
1087
1119
 
1088
1120
  const defaultEmojiReactionMap = {
@@ -1157,33 +1189,6 @@ const DefaultReactionsMenu = ({ reactions, layout = 'horizontal', }) => {
1157
1189
  }, children: reaction.emoji_code && defaultEmojiReactionMap[reaction.emoji_code] }, reaction.emoji_code))) }));
1158
1190
  };
1159
1191
 
1160
- /**
1161
- * Wraps an event handler, silencing and logging exceptions (excluding the NotAllowedError
1162
- * DOMException, which is a normal situation handled by the SDK)
1163
- *
1164
- * @param props component props, including the onError callback
1165
- * @param handler event handler to wrap
1166
- */
1167
- const createCallControlHandler = (props, handler) => {
1168
- return async () => {
1169
- try {
1170
- await handler();
1171
- }
1172
- catch (error) {
1173
- if (props.onError) {
1174
- props.onError(error);
1175
- return;
1176
- }
1177
- if (!isNotAllowedError(error)) {
1178
- console.error('Call control handler failed', error);
1179
- }
1180
- }
1181
- };
1182
- };
1183
- function isNotAllowedError(error) {
1184
- return error instanceof DOMException && error.name === 'NotAllowedError';
1185
- }
1186
-
1187
1192
  const ScreenShareButton = (props) => {
1188
1193
  const { t } = videoReactBindings.useI18n();
1189
1194
  const { caption, optimisticUpdates } = props;
@@ -1347,7 +1352,7 @@ const SpeakerTest = (props) => {
1347
1352
  const audioElementRef = react.useRef(null);
1348
1353
  const [isPlaying, setIsPlaying] = react.useState(false);
1349
1354
  const { t } = videoReactBindings.useI18n();
1350
- const { audioUrl = `https://unpkg.com/${"@stream-io/video-react-sdk"}@${"1.34.0"}/assets/piano.mp3`, } = props;
1355
+ const { audioUrl = `https://unpkg.com/${"@stream-io/video-react-sdk"}@${"1.34.1"}/assets/piano.mp3`, } = props;
1351
1356
  // Update audio output device when selection changes
1352
1357
  react.useEffect(() => {
1353
1358
  const audio = audioElementRef.current;
@@ -3170,7 +3175,7 @@ const checkCanJoinEarly = (startsAt, joinAheadTimeSeconds) => {
3170
3175
  return Date.now() >= +startsAt - (joinAheadTimeSeconds ?? 0) * 1000;
3171
3176
  };
3172
3177
 
3173
- const [major, minor, patch] = ("1.34.0").split('.');
3178
+ const [major, minor, patch] = ("1.34.1").split('.');
3174
3179
  videoClient.setSdkInfo({
3175
3180
  type: videoClient.SfuModels.SdkType.REACT,
3176
3181
  major,