@selfcommunity/react-ui 0.10.5-alpha.3 → 0.10.5-alpha.4
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/CreateLiveStreamButton/CreateLiveStreamButton.js +1 -0
- package/lib/cjs/components/EventForm/EventAddress.js +9 -4
- package/lib/esm/components/CreateLiveStreamButton/CreateLiveStreamButton.js +2 -1
- package/lib/esm/components/EventForm/EventAddress.js +11 -6
- package/lib/umd/react-ui.js +1 -1
- package/package.json +2 -2
|
@@ -61,6 +61,7 @@ function CreateLiveStreamButton(inProps) {
|
|
|
61
61
|
preferences[react_core_1.SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value === types_1.SCCommunitySubscriptionTier.FREE_TRIAL, [preferences]);
|
|
62
62
|
const liveStreamEnabled = (0, react_1.useMemo)(() => preferences &&
|
|
63
63
|
features &&
|
|
64
|
+
features.includes(types_1.SCFeatureName.LIVE_STREAM) &&
|
|
64
65
|
react_core_1.SCPreferences.CONFIGURATIONS_LIVE_STREAM_ENABLED in preferences &&
|
|
65
66
|
preferences[react_core_1.SCPreferences.CONFIGURATIONS_LIVE_STREAM_ENABLED].value, [preferences, features]);
|
|
66
67
|
const onlyStaffEnabled = (0, react_1.useMemo)(() => preferences[react_core_1.SCPreferences.CONFIGURATIONS_LIVE_STREAM_ONLY_STAFF_ENABLED].value, [preferences]);
|
|
@@ -66,13 +66,17 @@ function EventAddress(inProps) {
|
|
|
66
66
|
});
|
|
67
67
|
}, [event]);
|
|
68
68
|
// CONTEXT
|
|
69
|
-
const scContext = (0, react_core_1.useSCContext)();
|
|
70
69
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
71
|
-
const { preferences } = (0, react_core_1.useSCPreferences)();
|
|
70
|
+
const { preferences, features } = (0, react_core_1.useSCPreferences)();
|
|
72
71
|
const isFreeTrialTier = (0, react_1.useMemo)(() => preferences &&
|
|
73
72
|
react_core_1.SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER in preferences &&
|
|
74
73
|
preferences[react_core_1.SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value &&
|
|
75
74
|
preferences[react_core_1.SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value === types_1.SCCommunitySubscriptionTier.FREE_TRIAL, [preferences]);
|
|
75
|
+
const liveStreamEnabled = (0, react_1.useMemo)(() => preferences &&
|
|
76
|
+
features &&
|
|
77
|
+
features.includes(types_1.SCFeatureName.LIVE_STREAM) &&
|
|
78
|
+
react_core_1.SCPreferences.CONFIGURATIONS_LIVE_STREAM_ENABLED in preferences &&
|
|
79
|
+
preferences[react_core_1.SCPreferences.CONFIGURATIONS_LIVE_STREAM_ENABLED].value, [preferences, features]);
|
|
76
80
|
const canViewLiveTab = (0, react_1.useMemo)(() => {
|
|
77
81
|
var _a, _b;
|
|
78
82
|
return (!isFreeTrialTier || (isFreeTrialTier && (scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) && (scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user.id) === 1)) &&
|
|
@@ -82,10 +86,11 @@ function EventAddress(inProps) {
|
|
|
82
86
|
const isOnlineTabActive = (0, react_1.useMemo)(() => locations.includes(types_1.SCEventLocationType.ONLINE) || event.location === types_1.SCEventLocationType.ONLINE, [locations]);
|
|
83
87
|
const isLiveTabActive = (0, react_1.useMemo)(() => {
|
|
84
88
|
var _a, _b;
|
|
85
|
-
return
|
|
89
|
+
return liveStreamEnabled &&
|
|
90
|
+
locations.includes(types_1.SCEventLocationType.LIVESTREAM) &&
|
|
86
91
|
(!isFreeTrialTier || (isFreeTrialTier && (scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) && (scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user.id) === 1)) &&
|
|
87
92
|
(((_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);
|
|
88
|
-
}, [(_b = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _b === void 0 ? void 0 : _b.permission, event]);
|
|
93
|
+
}, [liveStreamEnabled, (_b = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _b === void 0 ? void 0 : _b.permission, event]);
|
|
89
94
|
// HOOKS
|
|
90
95
|
const { isLoaded, geocodingApiKey } = (0, react_core_2.useSCGoogleApiLoader)();
|
|
91
96
|
// HANDLERS
|
|
@@ -7,7 +7,7 @@ import { SCPreferences, SCUserContext, UserUtils, useSCPreferences } from '@self
|
|
|
7
7
|
import classNames from 'classnames';
|
|
8
8
|
import React, { useContext, useMemo } from 'react';
|
|
9
9
|
import { FormattedMessage } from 'react-intl';
|
|
10
|
-
import { SCCommunitySubscriptionTier } from '@selfcommunity/types';
|
|
10
|
+
import { SCCommunitySubscriptionTier, SCFeatureName } from '@selfcommunity/types';
|
|
11
11
|
import CreateLivestreamDialog from '../CreateLiveStreamDialog';
|
|
12
12
|
const PREFIX = 'SCCreateLivestreamButton';
|
|
13
13
|
const classes = {
|
|
@@ -59,6 +59,7 @@ export default function CreateLiveStreamButton(inProps) {
|
|
|
59
59
|
preferences[SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value === SCCommunitySubscriptionTier.FREE_TRIAL, [preferences]);
|
|
60
60
|
const liveStreamEnabled = useMemo(() => preferences &&
|
|
61
61
|
features &&
|
|
62
|
+
features.includes(SCFeatureName.LIVE_STREAM) &&
|
|
62
63
|
SCPreferences.CONFIGURATIONS_LIVE_STREAM_ENABLED in preferences &&
|
|
63
64
|
preferences[SCPreferences.CONFIGURATIONS_LIVE_STREAM_ENABLED].value, [preferences, features]);
|
|
64
65
|
const onlyStaffEnabled = useMemo(() => preferences[SCPreferences.CONFIGURATIONS_LIVE_STREAM_ONLY_STAFF_ENABLED].value, [preferences]);
|
|
@@ -4,8 +4,8 @@ import { Autocomplete, Box, InputAdornment, Tab, Tabs, TextField } from '@mui/ma
|
|
|
4
4
|
import Icon from '@mui/material/Icon';
|
|
5
5
|
import { styled } from '@mui/material/styles';
|
|
6
6
|
import { useThemeProps } from '@mui/system';
|
|
7
|
-
import { SCPreferences,
|
|
8
|
-
import { SCCommunitySubscriptionTier, SCEventLocationType } from '@selfcommunity/types';
|
|
7
|
+
import { SCPreferences, useSCPreferences, useSCUser } from '@selfcommunity/react-core';
|
|
8
|
+
import { SCCommunitySubscriptionTier, SCEventLocationType, SCFeatureName } from '@selfcommunity/types';
|
|
9
9
|
import axios from 'axios';
|
|
10
10
|
import classNames from 'classnames';
|
|
11
11
|
import { useEffect, useMemo, useState } from 'react';
|
|
@@ -64,13 +64,17 @@ export default function EventAddress(inProps) {
|
|
|
64
64
|
});
|
|
65
65
|
}, [event]);
|
|
66
66
|
// CONTEXT
|
|
67
|
-
const scContext = useSCContext();
|
|
68
67
|
const scUserContext = useSCUser();
|
|
69
|
-
const { preferences } = useSCPreferences();
|
|
68
|
+
const { preferences, features } = useSCPreferences();
|
|
70
69
|
const isFreeTrialTier = useMemo(() => preferences &&
|
|
71
70
|
SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER in preferences &&
|
|
72
71
|
preferences[SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value &&
|
|
73
72
|
preferences[SCPreferences.CONFIGURATIONS_SUBSCRIPTION_TIER].value === SCCommunitySubscriptionTier.FREE_TRIAL, [preferences]);
|
|
73
|
+
const liveStreamEnabled = useMemo(() => preferences &&
|
|
74
|
+
features &&
|
|
75
|
+
features.includes(SCFeatureName.LIVE_STREAM) &&
|
|
76
|
+
SCPreferences.CONFIGURATIONS_LIVE_STREAM_ENABLED in preferences &&
|
|
77
|
+
preferences[SCPreferences.CONFIGURATIONS_LIVE_STREAM_ENABLED].value, [preferences, features]);
|
|
74
78
|
const canViewLiveTab = useMemo(() => {
|
|
75
79
|
var _a, _b;
|
|
76
80
|
return (!isFreeTrialTier || (isFreeTrialTier && (scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) && (scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user.id) === 1)) &&
|
|
@@ -80,10 +84,11 @@ export default function EventAddress(inProps) {
|
|
|
80
84
|
const isOnlineTabActive = useMemo(() => locations.includes(SCEventLocationType.ONLINE) || event.location === SCEventLocationType.ONLINE, [locations]);
|
|
81
85
|
const isLiveTabActive = useMemo(() => {
|
|
82
86
|
var _a, _b;
|
|
83
|
-
return
|
|
87
|
+
return liveStreamEnabled &&
|
|
88
|
+
locations.includes(SCEventLocationType.LIVESTREAM) &&
|
|
84
89
|
(!isFreeTrialTier || (isFreeTrialTier && (scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) && (scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user.id) === 1)) &&
|
|
85
90
|
(((_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
|
-
}, [(_b = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _b === void 0 ? void 0 : _b.permission, event]);
|
|
91
|
+
}, [liveStreamEnabled, (_b = scUserContext === null || scUserContext === void 0 ? void 0 : scUserContext.user) === null || _b === void 0 ? void 0 : _b.permission, event]);
|
|
87
92
|
// HOOKS
|
|
88
93
|
const { isLoaded, geocodingApiKey } = useSCGoogleApiLoader();
|
|
89
94
|
// HANDLERS
|