@selfcommunity/react-ui 0.8.0-live.73 → 0.8.0-live.74
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.
- package/lib/cjs/components/EventForm/EventAddress.js +5 -1
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.js +15 -10
- package/lib/cjs/components/LiveStreamRoom/LiveStreamVideoConference/useLiveStreamCheck.js +10 -1
- package/lib/cjs/components/LiveStreamRoom/constants.d.ts +1 -1
- package/lib/cjs/components/LiveStreamRoom/constants.js +1 -1
- package/lib/esm/components/EventForm/EventAddress.js +5 -1
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/VideoConference.js +15 -10
- package/lib/esm/components/LiveStreamRoom/LiveStreamVideoConference/useLiveStreamCheck.js +10 -1
- package/lib/esm/components/LiveStreamRoom/constants.d.ts +1 -1
- package/lib/esm/components/LiveStreamRoom/constants.js +1 -1
- package/lib/umd/react-ui.js +1 -1
- package/package.json +7 -7
|
@@ -79,7 +79,11 @@ function EventAddress(inProps) {
|
|
|
79
79
|
react_core_1.SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER in preferences &&
|
|
80
80
|
preferences[react_core_1.SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value &&
|
|
81
81
|
preferences[react_core_1.SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value === types_1.SCCommunitySubscriptionTier.FREE_TRIAL, [preferences]);
|
|
82
|
-
const canViewLiveTab = (0, react_1.useMemo)(() => {
|
|
82
|
+
const canViewLiveTab = (0, react_1.useMemo)(() => {
|
|
83
|
+
var _a, _b;
|
|
84
|
+
return (!isFreeTrialTier || (isFreeTrialTier && (scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) && (scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user.id) === 1)) &&
|
|
85
|
+
(((_b = (_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission) === null || _b === void 0 ? void 0 : _b.create_live_stream) || event.live_stream);
|
|
86
|
+
}, [(_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission, event]);
|
|
83
87
|
// HANDLERS
|
|
84
88
|
const handleChange = (_event, newValue) => {
|
|
85
89
|
setLocation(newValue);
|
|
@@ -26,6 +26,7 @@ function VideoConference(_a) {
|
|
|
26
26
|
unreadMessages: 0,
|
|
27
27
|
showSettings: showSettings || false
|
|
28
28
|
});
|
|
29
|
+
const [focusInitialized, setFocusInitialized] = React.useState(false);
|
|
29
30
|
const lastAutoFocusedScreenShareTrack = React.useRef(null);
|
|
30
31
|
const tracks = (0, components_react_1.useTracks)([
|
|
31
32
|
{ source: livekit_client_1.Track.Source.Camera, withPlaceholder: true },
|
|
@@ -53,7 +54,7 @@ function VideoConference(_a) {
|
|
|
53
54
|
// HOOKS
|
|
54
55
|
(0, useLiveStreamCheck_1.useLivestreamCheck)();
|
|
55
56
|
(0, react_1.useEffect)(() => {
|
|
56
|
-
var _a, _b, _c, _d, _e, _f
|
|
57
|
+
var _a, _b, _c, _d, _e, _f;
|
|
57
58
|
// If screen share tracks are published, and no pin is set explicitly, auto set the screen share.
|
|
58
59
|
if (screenShareTracks.some((track) => track.publication.isSubscribed) && lastAutoFocusedScreenShareTrack.current === null) {
|
|
59
60
|
components_core_1.log.debug('Auto set screen share focus:', { newScreenShareTrack: screenShareTracks[0] });
|
|
@@ -72,7 +73,16 @@ function VideoConference(_a) {
|
|
|
72
73
|
(_f = (_e = layoutContext.pin).dispatch) === null || _f === void 0 ? void 0 : _f.call(_e, { msg: 'set_pin', trackReference: updatedFocusTrack });
|
|
73
74
|
}
|
|
74
75
|
}
|
|
75
|
-
|
|
76
|
+
}, [
|
|
77
|
+
screenShareTracks.map((ref) => `${ref.publication.trackSid}_${ref.publication.isSubscribed}`).join(),
|
|
78
|
+
(_c = focusTrack === null || focusTrack === void 0 ? void 0 : focusTrack.publication) === null || _c === void 0 ? void 0 : _c.trackSid,
|
|
79
|
+
tracks,
|
|
80
|
+
participants,
|
|
81
|
+
speakerFocused
|
|
82
|
+
]);
|
|
83
|
+
(0, react_1.useEffect)(() => {
|
|
84
|
+
var _a, _b;
|
|
85
|
+
if (speakerFocused && !focusInitialized) {
|
|
76
86
|
const speaker = participants.find((pt) => {
|
|
77
87
|
return pt.name === speakerFocused.username;
|
|
78
88
|
});
|
|
@@ -83,16 +93,11 @@ function VideoConference(_a) {
|
|
|
83
93
|
}
|
|
84
94
|
return false;
|
|
85
95
|
});
|
|
86
|
-
(
|
|
96
|
+
(_b = (_a = layoutContext.pin).dispatch) === null || _b === void 0 ? void 0 : _b.call(_a, { msg: 'set_pin', trackReference: updatedFocusTrack });
|
|
97
|
+
setFocusInitialized(true);
|
|
87
98
|
}
|
|
88
99
|
}
|
|
89
|
-
}, [
|
|
90
|
-
screenShareTracks.map((ref) => `${ref.publication.trackSid}_${ref.publication.isSubscribed}`).join(),
|
|
91
|
-
(_c = focusTrack === null || focusTrack === void 0 ? void 0 : focusTrack.publication) === null || _c === void 0 ? void 0 : _c.trackSid,
|
|
92
|
-
tracks,
|
|
93
|
-
participants,
|
|
94
|
-
speakerFocused
|
|
95
|
-
]);
|
|
100
|
+
}, [tracks, participants, speakerFocused]);
|
|
96
101
|
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "lk-video-conference" }, props, { children: [(0, components_core_1.isWeb)() && ((0, jsx_runtime_1.jsxs)(components_react_1.LayoutContextProvider, Object.assign({ value: layoutContext, onPinChange: handleFocusStateChange, onWidgetChange: widgetUpdate }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "lk-video-conference-inner" }, { children: [!focusTrack ? ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "lk-grid-layout-wrapper" }, { children: (0, jsx_runtime_1.jsx)(components_react_1.GridLayout, Object.assign({ tracks: tracks }, { children: (0, jsx_runtime_1.jsx)(ParticipantTile_1.ParticipantTile, {}) })) }))) : ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "lk-focus-layout-wrapper" }, { children: hideParticipantsList ? ((0, jsx_runtime_1.jsx)(FocusLayout_1.FocusLayoutContainerNoParticipants, { children: focusTrack && (0, jsx_runtime_1.jsx)(FocusLayout_1.FocusLayout, { trackRef: focusTrack }) })) : ((0, jsx_runtime_1.jsxs)(FocusLayout_1.FocusLayoutContainer, { children: [(0, jsx_runtime_1.jsx)(components_react_1.CarouselLayout, Object.assign({ tracks: carouselTracks }, { children: (0, jsx_runtime_1.jsx)(ParticipantTile_1.ParticipantTile, {}) })), focusTrack && (0, jsx_runtime_1.jsx)(FocusLayout_1.FocusLayout, { trackRef: focusTrack })] })) }))), (0, jsx_runtime_1.jsx)(ControlBar_1.ControlBar, { controls: Object.assign({
|
|
97
102
|
chat: !disableChat,
|
|
98
103
|
microphone: !disableMicrophone,
|
|
@@ -49,6 +49,9 @@ function useLivestreamCheck(warningThreshold = constants_1.WARNING_THRESHOLD_EXP
|
|
|
49
49
|
setIsExpired(true);
|
|
50
50
|
clearInterval(intervalRef.current);
|
|
51
51
|
}
|
|
52
|
+
else if (isExpiringSoon) {
|
|
53
|
+
setIsExpiringSoon(false);
|
|
54
|
+
}
|
|
52
55
|
})
|
|
53
56
|
.catch((error) => {
|
|
54
57
|
console.error('Error fetching live status:', error);
|
|
@@ -75,6 +78,9 @@ function useLivestreamCheck(warningThreshold = constants_1.WARNING_THRESHOLD_EXP
|
|
|
75
78
|
}
|
|
76
79
|
return;
|
|
77
80
|
}
|
|
81
|
+
else if (isExpiringSoon) {
|
|
82
|
+
setIsExpiringSoon(false);
|
|
83
|
+
}
|
|
78
84
|
__DEBUG && console.log('Checking live speaker...');
|
|
79
85
|
const speaker = participants.find((pt) => {
|
|
80
86
|
return pt.name === liveStream.host.username;
|
|
@@ -93,11 +99,14 @@ function useLivestreamCheck(warningThreshold = constants_1.WARNING_THRESHOLD_EXP
|
|
|
93
99
|
buttonProps.onClick();
|
|
94
100
|
}
|
|
95
101
|
}
|
|
102
|
+
else if (isExpiringSoon) {
|
|
103
|
+
setIsExpiringSoon(false);
|
|
104
|
+
}
|
|
96
105
|
__DEBUG && console.log('Checking live status resources...');
|
|
97
106
|
fetchLivestreamStatus();
|
|
98
107
|
}, [isExpired, isExpiringSoon, buttonProps, participants]);
|
|
99
108
|
(0, react_1.useEffect)(() => {
|
|
100
|
-
intervalRef.current = setInterval(check, constants_1.LIVE_CHECKING_INTERVAL *
|
|
109
|
+
intervalRef.current = setInterval(check, constants_1.LIVE_CHECKING_INTERVAL * 60000);
|
|
101
110
|
return () => intervalRef.current && clearInterval(intervalRef.current);
|
|
102
111
|
}, [isExpired, isExpiringSoon]);
|
|
103
112
|
return { timeRemaining, isExpiringSoon, isExpired };
|
|
@@ -7,7 +7,7 @@ export declare const defaultVideoOptions: {
|
|
|
7
7
|
* Checking live status on VideoLiveConference
|
|
8
8
|
* In minutes
|
|
9
9
|
*/
|
|
10
|
-
export declare const LIVE_CHECKING_INTERVAL =
|
|
10
|
+
export declare const LIVE_CHECKING_INTERVAL = 1;
|
|
11
11
|
/**
|
|
12
12
|
* Warning threshold expiring soon
|
|
13
13
|
* In minutes
|
|
@@ -77,7 +77,11 @@ export default function EventAddress(inProps) {
|
|
|
77
77
|
SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER in preferences &&
|
|
78
78
|
preferences[SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value &&
|
|
79
79
|
preferences[SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value === SCCommunitySubscriptionTier.FREE_TRIAL, [preferences]);
|
|
80
|
-
const canViewLiveTab = useMemo(() => {
|
|
80
|
+
const canViewLiveTab = useMemo(() => {
|
|
81
|
+
var _a, _b;
|
|
82
|
+
return (!isFreeTrialTier || (isFreeTrialTier && (scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) && (scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user.id) === 1)) &&
|
|
83
|
+
(((_b = (_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission) === null || _b === void 0 ? void 0 : _b.create_live_stream) || event.live_stream);
|
|
84
|
+
}, [(_a = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _a === void 0 ? void 0 : _a.permission, event]);
|
|
81
85
|
// HANDLERS
|
|
82
86
|
const handleChange = (_event, newValue) => {
|
|
83
87
|
setLocation(newValue);
|
|
@@ -23,6 +23,7 @@ export function VideoConference(_a) {
|
|
|
23
23
|
unreadMessages: 0,
|
|
24
24
|
showSettings: showSettings || false
|
|
25
25
|
});
|
|
26
|
+
const [focusInitialized, setFocusInitialized] = React.useState(false);
|
|
26
27
|
const lastAutoFocusedScreenShareTrack = React.useRef(null);
|
|
27
28
|
const tracks = useTracks([
|
|
28
29
|
{ source: Track.Source.Camera, withPlaceholder: true },
|
|
@@ -50,7 +51,7 @@ export function VideoConference(_a) {
|
|
|
50
51
|
// HOOKS
|
|
51
52
|
useLivestreamCheck();
|
|
52
53
|
useEffect(() => {
|
|
53
|
-
var _a, _b, _c, _d, _e, _f
|
|
54
|
+
var _a, _b, _c, _d, _e, _f;
|
|
54
55
|
// If screen share tracks are published, and no pin is set explicitly, auto set the screen share.
|
|
55
56
|
if (screenShareTracks.some((track) => track.publication.isSubscribed) && lastAutoFocusedScreenShareTrack.current === null) {
|
|
56
57
|
log.debug('Auto set screen share focus:', { newScreenShareTrack: screenShareTracks[0] });
|
|
@@ -69,7 +70,16 @@ export function VideoConference(_a) {
|
|
|
69
70
|
(_f = (_e = layoutContext.pin).dispatch) === null || _f === void 0 ? void 0 : _f.call(_e, { msg: 'set_pin', trackReference: updatedFocusTrack });
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
|
-
|
|
73
|
+
}, [
|
|
74
|
+
screenShareTracks.map((ref) => `${ref.publication.trackSid}_${ref.publication.isSubscribed}`).join(),
|
|
75
|
+
(_c = focusTrack === null || focusTrack === void 0 ? void 0 : focusTrack.publication) === null || _c === void 0 ? void 0 : _c.trackSid,
|
|
76
|
+
tracks,
|
|
77
|
+
participants,
|
|
78
|
+
speakerFocused
|
|
79
|
+
]);
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
var _a, _b;
|
|
82
|
+
if (speakerFocused && !focusInitialized) {
|
|
73
83
|
const speaker = participants.find((pt) => {
|
|
74
84
|
return pt.name === speakerFocused.username;
|
|
75
85
|
});
|
|
@@ -80,16 +90,11 @@ export function VideoConference(_a) {
|
|
|
80
90
|
}
|
|
81
91
|
return false;
|
|
82
92
|
});
|
|
83
|
-
(
|
|
93
|
+
(_b = (_a = layoutContext.pin).dispatch) === null || _b === void 0 ? void 0 : _b.call(_a, { msg: 'set_pin', trackReference: updatedFocusTrack });
|
|
94
|
+
setFocusInitialized(true);
|
|
84
95
|
}
|
|
85
96
|
}
|
|
86
|
-
}, [
|
|
87
|
-
screenShareTracks.map((ref) => `${ref.publication.trackSid}_${ref.publication.isSubscribed}`).join(),
|
|
88
|
-
(_c = focusTrack === null || focusTrack === void 0 ? void 0 : focusTrack.publication) === null || _c === void 0 ? void 0 : _c.trackSid,
|
|
89
|
-
tracks,
|
|
90
|
-
participants,
|
|
91
|
-
speakerFocused
|
|
92
|
-
]);
|
|
97
|
+
}, [tracks, participants, speakerFocused]);
|
|
93
98
|
return (_jsxs("div", Object.assign({ className: "lk-video-conference" }, props, { children: [isWeb() && (_jsxs(LayoutContextProvider, Object.assign({ value: layoutContext, onPinChange: handleFocusStateChange, onWidgetChange: widgetUpdate }, { children: [_jsxs("div", Object.assign({ className: "lk-video-conference-inner" }, { children: [!focusTrack ? (_jsx("div", Object.assign({ className: "lk-grid-layout-wrapper" }, { children: _jsx(GridLayout, Object.assign({ tracks: tracks }, { children: _jsx(ParticipantTile, {}) })) }))) : (_jsx("div", Object.assign({ className: "lk-focus-layout-wrapper" }, { children: hideParticipantsList ? (_jsx(FocusLayoutContainerNoParticipants, { children: focusTrack && _jsx(FocusLayout, { trackRef: focusTrack }) })) : (_jsxs(FocusLayoutContainer, { children: [_jsx(CarouselLayout, Object.assign({ tracks: carouselTracks }, { children: _jsx(ParticipantTile, {}) })), focusTrack && _jsx(FocusLayout, { trackRef: focusTrack })] })) }))), _jsx(ControlBar, { controls: Object.assign({
|
|
94
99
|
chat: !disableChat,
|
|
95
100
|
microphone: !disableMicrophone,
|
|
@@ -46,6 +46,9 @@ export function useLivestreamCheck(warningThreshold = WARNING_THRESHOLD_EXPIRING
|
|
|
46
46
|
setIsExpired(true);
|
|
47
47
|
clearInterval(intervalRef.current);
|
|
48
48
|
}
|
|
49
|
+
else if (isExpiringSoon) {
|
|
50
|
+
setIsExpiringSoon(false);
|
|
51
|
+
}
|
|
49
52
|
})
|
|
50
53
|
.catch((error) => {
|
|
51
54
|
console.error('Error fetching live status:', error);
|
|
@@ -72,6 +75,9 @@ export function useLivestreamCheck(warningThreshold = WARNING_THRESHOLD_EXPIRING
|
|
|
72
75
|
}
|
|
73
76
|
return;
|
|
74
77
|
}
|
|
78
|
+
else if (isExpiringSoon) {
|
|
79
|
+
setIsExpiringSoon(false);
|
|
80
|
+
}
|
|
75
81
|
__DEBUG && console.log('Checking live speaker...');
|
|
76
82
|
const speaker = participants.find((pt) => {
|
|
77
83
|
return pt.name === liveStream.host.username;
|
|
@@ -90,11 +96,14 @@ export function useLivestreamCheck(warningThreshold = WARNING_THRESHOLD_EXPIRING
|
|
|
90
96
|
buttonProps.onClick();
|
|
91
97
|
}
|
|
92
98
|
}
|
|
99
|
+
else if (isExpiringSoon) {
|
|
100
|
+
setIsExpiringSoon(false);
|
|
101
|
+
}
|
|
93
102
|
__DEBUG && console.log('Checking live status resources...');
|
|
94
103
|
fetchLivestreamStatus();
|
|
95
104
|
}, [isExpired, isExpiringSoon, buttonProps, participants]);
|
|
96
105
|
useEffect(() => {
|
|
97
|
-
intervalRef.current = setInterval(check, LIVE_CHECKING_INTERVAL *
|
|
106
|
+
intervalRef.current = setInterval(check, LIVE_CHECKING_INTERVAL * 60000);
|
|
98
107
|
return () => intervalRef.current && clearInterval(intervalRef.current);
|
|
99
108
|
}, [isExpired, isExpiringSoon]);
|
|
100
109
|
return { timeRemaining, isExpiringSoon, isExpired };
|
|
@@ -7,7 +7,7 @@ export declare const defaultVideoOptions: {
|
|
|
7
7
|
* Checking live status on VideoLiveConference
|
|
8
8
|
* In minutes
|
|
9
9
|
*/
|
|
10
|
-
export declare const LIVE_CHECKING_INTERVAL =
|
|
10
|
+
export declare const LIVE_CHECKING_INTERVAL = 1;
|
|
11
11
|
/**
|
|
12
12
|
* Warning threshold expiring soon
|
|
13
13
|
* In minutes
|