From 0fe1ce4c154642f5fb522a4e0f1b534f69381f3a Mon Sep 17 00:00:00 2001 From: RaduCristianPopescu <119046336+RaduCristianPopescu@users.noreply.github.com> Date: Mon, 21 Jul 2025 11:32:31 +0300 Subject: [PATCH 1/2] fix: user interaction with pro features --- js/Conditions/ConditionsControl.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/js/Conditions/ConditionsControl.js b/js/Conditions/ConditionsControl.js index 6e6295e0..c9f2ced6 100644 --- a/js/Conditions/ConditionsControl.js +++ b/js/Conditions/ConditionsControl.js @@ -56,6 +56,7 @@ const SUPPORTED_FIELDS = [ ]; const ConditionsControl = ({ conditions, setConditions }) => { + const isPro = window.feedzyData.isPro; const onChangeMatch = (value) => { setConditions({ ...conditions, @@ -88,6 +89,10 @@ const ConditionsControl = ({ conditions, setConditions }) => { }; const onChangeCondtion = (index, value, key) => { + if (!isPro) { + return; + } + const conditionsCopy = [...conditions.conditions]; conditionsCopy[index][key] = value; @@ -117,7 +122,7 @@ const ConditionsControl = ({ conditions, setConditions }) => { return (
{ }, ]} onChange={onChangeMatch} + disabled={!isPro} /> {conditions.conditions.map((condition, index) => { @@ -161,6 +167,7 @@ const ConditionsControl = ({ conditions, setConditions }) => { onChange={(value) => onChangeCondtion(index, value, 'field') } + disabled={!isPro} /> { onChange={(value) => onChangeCondtion(index, value, 'operator') } + disabled={!isPro} /> {!['has_value', 'empty'].includes( @@ -203,6 +211,7 @@ const ConditionsControl = ({ conditions, setConditions }) => { 'value' ) } + disabled={!isPro} /> ) : ( { 'value' ) } + disabled={!isPro} /> )} From 7c3934d12f9e3103b2b0dd5f54aff3f44fcabc26 Mon Sep 17 00:00:00 2001 From: RaduCristianPopescu <119046336+RaduCristianPopescu@users.noreply.github.com> Date: Mon, 21 Jul 2025 15:11:37 +0300 Subject: [PATCH 2/2] fix: logic errors --- js/Conditions/ConditionsControl.js | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/js/Conditions/ConditionsControl.js b/js/Conditions/ConditionsControl.js index c9f2ced6..8bf0103b 100644 --- a/js/Conditions/ConditionsControl.js +++ b/js/Conditions/ConditionsControl.js @@ -54,9 +54,9 @@ const SUPPORTED_FIELDS = [ unsupportedOperators: ['greater_than', 'gte', 'less_than', 'lte'], }, ]; +const isPro = window.feedzyData.isPro; const ConditionsControl = ({ conditions, setConditions }) => { - const isPro = window.feedzyData.isPro; const onChangeMatch = (value) => { setConditions({ ...conditions, @@ -88,11 +88,7 @@ const ConditionsControl = ({ conditions, setConditions }) => { }); }; - const onChangeCondtion = (index, value, key) => { - if (!isPro) { - return; - } - + const onChangeCondition = (index, value, key) => { const conditionsCopy = [...conditions.conditions]; conditionsCopy[index][key] = value; @@ -130,10 +126,7 @@ const ConditionsControl = ({ conditions, setConditions }) => { value={conditions.match} options={[ { - label: __( - 'All conditions are met', - 'feedzy-rss-feeds' - ), + label: __('All conditions are met', 'feedzy-rss-feeds'), value: 'all', }, { @@ -165,7 +158,7 @@ const ConditionsControl = ({ conditions, setConditions }) => { value={condition?.field} options={SUPPORTED_FIELDS} onChange={(value) => - onChangeCondtion(index, value, 'field') + onChangeCondition(index, value, 'field') } disabled={!isPro} /> @@ -190,7 +183,7 @@ const ConditionsControl = ({ conditions, setConditions }) => { } value={condition?.operator} onChange={(value) => - onChangeCondtion(index, value, 'operator') + onChangeCondition(index, value, 'operator') } disabled={!isPro} /> @@ -205,7 +198,7 @@ const ConditionsControl = ({ conditions, setConditions }) => { label={__('Value', 'feedzy-rss-feeds')} value={condition?.value} onChange={(value) => - onChangeCondtion( + onChangeCondition( index, value, 'value' @@ -218,7 +211,7 @@ const ConditionsControl = ({ conditions, setConditions }) => { label={__('Value', 'feedzy-rss-feeds')} value={condition?.value} onChange={(value) => - onChangeCondtion( + onChangeCondition( index, value, 'value'