Skip to content

fix: disable input elements in PRO upsell #1096

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 29, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions js/Conditions/ConditionsControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const SUPPORTED_FIELDS = [
unsupportedOperators: ['greater_than', 'gte', 'less_than', 'lte'],
},
];
const isPro = window.feedzyData.isPro;

const ConditionsControl = ({ conditions, setConditions }) => {
const onChangeMatch = (value) => {
Expand Down Expand Up @@ -87,7 +88,7 @@ const ConditionsControl = ({ conditions, setConditions }) => {
});
};

const onChangeCondtion = (index, value, key) => {
const onChangeCondition = (index, value, key) => {
const conditionsCopy = [...conditions.conditions];

conditionsCopy[index][key] = value;
Expand Down Expand Up @@ -117,18 +118,15 @@ const ConditionsControl = ({ conditions, setConditions }) => {
return (
<div
className={classNames('fz-condition-control', {
'is-upsell': !window.feedzyData.isPro,
'is-upsell': !isPro,
})}
>
<SelectControl
label={__('Include If', 'feedzy-rss-feeds')}
value={conditions.match}
options={[
{
label: __(
'All conditions are met',
'feedzy-rss-feeds'
),
label: __('All conditions are met', 'feedzy-rss-feeds'),
value: 'all',
},
{
Expand All @@ -137,6 +135,7 @@ const ConditionsControl = ({ conditions, setConditions }) => {
},
]}
onChange={onChangeMatch}
disabled={!isPro}
/>

{conditions.conditions.map((condition, index) => {
Expand All @@ -159,8 +158,9 @@ const ConditionsControl = ({ conditions, setConditions }) => {
value={condition?.field}
options={SUPPORTED_FIELDS}
onChange={(value) =>
onChangeCondtion(index, value, 'field')
onChangeCondition(index, value, 'field')
}
disabled={!isPro}
/>

<SelectControl
Expand All @@ -183,8 +183,9 @@ const ConditionsControl = ({ conditions, setConditions }) => {
}
value={condition?.operator}
onChange={(value) =>
onChangeCondtion(index, value, 'operator')
onChangeCondition(index, value, 'operator')
}
disabled={!isPro}
/>

{!['has_value', 'empty'].includes(
Expand All @@ -197,24 +198,26 @@ const ConditionsControl = ({ conditions, setConditions }) => {
label={__('Value', 'feedzy-rss-feeds')}
value={condition?.value}
onChange={(value) =>
onChangeCondtion(
onChangeCondition(
index,
value,
'value'
)
}
disabled={!isPro}
/>
) : (
<TextControl
label={__('Value', 'feedzy-rss-feeds')}
value={condition?.value}
onChange={(value) =>
onChangeCondtion(
onChangeCondition(
index,
value,
'value'
)
}
disabled={!isPro}
/>
)}
</>
Expand Down
Loading