@@ -38,11 +38,16 @@ export const LinkOptions = ({
38
38
setData : React . Dispatch < React . SetStateAction < DEFAULT_LINK_TYPE > > ;
39
39
linkType : LinkType ;
40
40
} ) => {
41
- const { plan } = usePlan ( ) ;
41
+ const { plan, trial } = usePlan ( ) ;
42
42
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 ;
46
51
47
52
const [ openUpgradeModal , setOpenUpgradeModal ] = useState < boolean > ( false ) ;
48
53
const [ trigger , setTrigger ] = useState < string > ( "" ) ;
@@ -70,56 +75,73 @@ export const LinkOptions = ({
70
75
< ExpirationSection { ...{ data, setData } } />
71
76
< OGSection
72
77
{ ...{ data, setData } }
73
- hasFreePlan = {
74
- isNotBusiness && isNotDatarooms && ! limits ?. advancedLinkControlsOnPro
78
+ isAllowed = {
79
+ isTrial ||
80
+ ( isPro && allowAdvancedLinkControls ) ||
81
+ isBusiness ||
82
+ isDatarooms
75
83
}
76
84
handleUpgradeStateChange = { handleUpgradeStateChange }
77
85
/>
78
86
79
87
< EmailAuthenticationSection
80
88
{ ...{ data, setData } }
81
- hasFreePlan = { hasFreePlan }
89
+ isAllowed = { isTrial || isPro || isBusiness || isDatarooms }
82
90
handleUpgradeStateChange = { handleUpgradeStateChange }
83
91
/>
84
92
< AllowListSection
85
93
{ ...{ data, setData } }
86
- hasFreePlan = {
87
- isNotBusiness && isNotDatarooms && ! limits ?. advancedLinkControlsOnPro
94
+ isAllowed = {
95
+ isTrial ||
96
+ ( isPro && allowAdvancedLinkControls ) ||
97
+ isBusiness ||
98
+ isDatarooms
88
99
}
89
100
handleUpgradeStateChange = { handleUpgradeStateChange }
90
101
/>
91
102
< DenyListSection
92
103
{ ...{ data, setData } }
93
- hasFreePlan = {
94
- isNotBusiness && isNotDatarooms && ! limits ?. advancedLinkControlsOnPro
104
+ isAllowed = {
105
+ isTrial ||
106
+ ( isPro && allowAdvancedLinkControls ) ||
107
+ isBusiness ||
108
+ isDatarooms
95
109
}
96
110
handleUpgradeStateChange = { handleUpgradeStateChange }
97
111
/>
98
112
< PasswordSection { ...{ data, setData } } />
99
113
< ScreenshotProtectionSection
100
114
{ ...{ data, setData } }
101
- hasFreePlan = {
102
- isNotBusiness && isNotDatarooms && ! limits ?. advancedLinkControlsOnPro
115
+ isAllowed = {
116
+ isTrial ||
117
+ ( isPro && allowAdvancedLinkControls ) ||
118
+ isBusiness ||
119
+ isDatarooms
103
120
}
104
121
handleUpgradeStateChange = { handleUpgradeStateChange }
105
122
/>
106
123
< FeedbackSection { ...{ data, setData } } />
107
124
< QuestionSection
108
125
{ ...{ data, setData } }
109
- hasFreePlan = {
110
- isNotBusiness && isNotDatarooms && ! limits ?. advancedLinkControlsOnPro
126
+ isAllowed = {
127
+ isTrial ||
128
+ ( isPro && allowAdvancedLinkControls ) ||
129
+ isBusiness ||
130
+ isDatarooms
111
131
}
112
132
handleUpgradeStateChange = { handleUpgradeStateChange }
113
133
/>
114
134
< AgreementSection
115
135
{ ...{ data, setData } }
116
- hasFreePlan = { isNotDatarooms }
136
+ isAllowed = { isTrial || isDatarooms }
117
137
handleUpgradeStateChange = { handleUpgradeStateChange }
118
138
/>
119
139
{ linkType === LinkType . DOCUMENT_LINK ? (
120
140
< ProBannerSection
121
141
{ ...{ data, setData } }
122
- hasFreePlan = { hasFreePlan || plan === "starter" }
142
+ isAllowed = {
143
+ isTrial || isPro || isBusiness || isDatarooms || plan === "starter"
144
+ }
123
145
handleUpgradeStateChange = { handleUpgradeStateChange }
124
146
/>
125
147
) : null }
0 commit comments