Skip to content

Commit e1b8122

Browse files
fix: disable input elements in PRO upsell for conditionals (#1096)
1 parent 797c900 commit e1b8122

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

js/Conditions/ConditionsControl.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ const SUPPORTED_FIELDS = [
5454
unsupportedOperators: ['greater_than', 'gte', 'less_than', 'lte'],
5555
},
5656
];
57+
const isPro = window.feedzyData.isPro;
5758

5859
const ConditionsControl = ({ conditions, setConditions }) => {
5960
const onChangeMatch = (value) => {
@@ -87,7 +88,7 @@ const ConditionsControl = ({ conditions, setConditions }) => {
8788
});
8889
};
8990

90-
const onChangeCondtion = (index, value, key) => {
91+
const onChangeCondition = (index, value, key) => {
9192
const conditionsCopy = [...conditions.conditions];
9293

9394
conditionsCopy[index][key] = value;
@@ -117,18 +118,15 @@ const ConditionsControl = ({ conditions, setConditions }) => {
117118
return (
118119
<div
119120
className={classNames('fz-condition-control', {
120-
'is-upsell': !window.feedzyData.isPro,
121+
'is-upsell': !isPro,
121122
})}
122123
>
123124
<SelectControl
124125
label={__('Include If', 'feedzy-rss-feeds')}
125126
value={conditions.match}
126127
options={[
127128
{
128-
label: __(
129-
'All conditions are met',
130-
'feedzy-rss-feeds'
131-
),
129+
label: __('All conditions are met', 'feedzy-rss-feeds'),
132130
value: 'all',
133131
},
134132
{
@@ -137,6 +135,7 @@ const ConditionsControl = ({ conditions, setConditions }) => {
137135
},
138136
]}
139137
onChange={onChangeMatch}
138+
disabled={!isPro}
140139
/>
141140

142141
{conditions.conditions.map((condition, index) => {
@@ -159,8 +158,9 @@ const ConditionsControl = ({ conditions, setConditions }) => {
159158
value={condition?.field}
160159
options={SUPPORTED_FIELDS}
161160
onChange={(value) =>
162-
onChangeCondtion(index, value, 'field')
161+
onChangeCondition(index, value, 'field')
163162
}
163+
disabled={!isPro}
164164
/>
165165

166166
<SelectControl
@@ -183,8 +183,9 @@ const ConditionsControl = ({ conditions, setConditions }) => {
183183
}
184184
value={condition?.operator}
185185
onChange={(value) =>
186-
onChangeCondtion(index, value, 'operator')
186+
onChangeCondition(index, value, 'operator')
187187
}
188+
disabled={!isPro}
188189
/>
189190

190191
{!['has_value', 'empty'].includes(
@@ -197,24 +198,26 @@ const ConditionsControl = ({ conditions, setConditions }) => {
197198
label={__('Value', 'feedzy-rss-feeds')}
198199
value={condition?.value}
199200
onChange={(value) =>
200-
onChangeCondtion(
201+
onChangeCondition(
201202
index,
202203
value,
203204
'value'
204205
)
205206
}
207+
disabled={!isPro}
206208
/>
207209
) : (
208210
<TextControl
209211
label={__('Value', 'feedzy-rss-feeds')}
210212
value={condition?.value}
211213
onChange={(value) =>
212-
onChangeCondtion(
214+
onChangeCondition(
213215
index,
214216
value,
215217
'value'
216218
)
217219
}
220+
disabled={!isPro}
218221
/>
219222
)}
220223
</>

0 commit comments

Comments
 (0)