@@ -38,11 +38,16 @@ export const LinkOptions = ({
3838 setData : React . Dispatch < React . SetStateAction < DEFAULT_LINK_TYPE > > ;
3939 linkType : LinkType ;
4040} ) => {
41- const { plan } = usePlan ( ) ;
41+ const { plan, trial } = usePlan ( ) ;
4242 const { limits } = useLimits ( ) ;
43- const hasFreePlan = plan === "free" ;
44- const isNotBusiness = plan !== "business" ;
45- const isNotDatarooms = plan !== "datarooms" ;
43+
44+ const isTrial = ! ! trial ;
45+ const isPro = plan === "pro" ;
46+ const isBusiness = plan === "business" ;
47+ const isDatarooms = plan === "datarooms" ;
48+ const allowAdvancedLinkControls = limits
49+ ? limits ?. advancedLinkControlsOnPro
50+ : false ;
4651
4752 const [ openUpgradeModal , setOpenUpgradeModal ] = useState < boolean > ( false ) ;
4853 const [ trigger , setTrigger ] = useState < string > ( "" ) ;
@@ -70,56 +75,73 @@ export const LinkOptions = ({
7075 < ExpirationSection { ...{ data, setData } } />
7176 < OGSection
7277 { ...{ data, setData } }
73- hasFreePlan = {
74- isNotBusiness && isNotDatarooms && ! limits ?. advancedLinkControlsOnPro
78+ isAllowed = {
79+ isTrial ||
80+ ( isPro && allowAdvancedLinkControls ) ||
81+ isBusiness ||
82+ isDatarooms
7583 }
7684 handleUpgradeStateChange = { handleUpgradeStateChange }
7785 />
7886
7987 < EmailAuthenticationSection
8088 { ...{ data, setData } }
81- hasFreePlan = { hasFreePlan }
89+ isAllowed = { isTrial || isPro || isBusiness || isDatarooms }
8290 handleUpgradeStateChange = { handleUpgradeStateChange }
8391 />
8492 < AllowListSection
8593 { ...{ data, setData } }
86- hasFreePlan = {
87- isNotBusiness && isNotDatarooms && ! limits ?. advancedLinkControlsOnPro
94+ isAllowed = {
95+ isTrial ||
96+ ( isPro && allowAdvancedLinkControls ) ||
97+ isBusiness ||
98+ isDatarooms
8899 }
89100 handleUpgradeStateChange = { handleUpgradeStateChange }
90101 />
91102 < DenyListSection
92103 { ...{ data, setData } }
93- hasFreePlan = {
94- isNotBusiness && isNotDatarooms && ! limits ?. advancedLinkControlsOnPro
104+ isAllowed = {
105+ isTrial ||
106+ ( isPro && allowAdvancedLinkControls ) ||
107+ isBusiness ||
108+ isDatarooms
95109 }
96110 handleUpgradeStateChange = { handleUpgradeStateChange }
97111 />
98112 < PasswordSection { ...{ data, setData } } />
99113 < ScreenshotProtectionSection
100114 { ...{ data, setData } }
101- hasFreePlan = {
102- isNotBusiness && isNotDatarooms && ! limits ?. advancedLinkControlsOnPro
115+ isAllowed = {
116+ isTrial ||
117+ ( isPro && allowAdvancedLinkControls ) ||
118+ isBusiness ||
119+ isDatarooms
103120 }
104121 handleUpgradeStateChange = { handleUpgradeStateChange }
105122 />
106123 < FeedbackSection { ...{ data, setData } } />
107124 < QuestionSection
108125 { ...{ data, setData } }
109- hasFreePlan = {
110- isNotBusiness && isNotDatarooms && ! limits ?. advancedLinkControlsOnPro
126+ isAllowed = {
127+ isTrial ||
128+ ( isPro && allowAdvancedLinkControls ) ||
129+ isBusiness ||
130+ isDatarooms
111131 }
112132 handleUpgradeStateChange = { handleUpgradeStateChange }
113133 />
114134 < AgreementSection
115135 { ...{ data, setData } }
116- hasFreePlan = { isNotDatarooms }
136+ isAllowed = { isTrial || isDatarooms }
117137 handleUpgradeStateChange = { handleUpgradeStateChange }
118138 />
119139 { linkType === LinkType . DOCUMENT_LINK ? (
120140 < ProBannerSection
121141 { ...{ data, setData } }
122- hasFreePlan = { hasFreePlan || plan === "starter" }
142+ isAllowed = {
143+ isTrial || isPro || isBusiness || isDatarooms || plan === "starter"
144+ }
123145 handleUpgradeStateChange = { handleUpgradeStateChange }
124146 />
125147 ) : null }
0 commit comments