Skip to content

Commit 88e8830

Browse files
feat: allow more option in feedzy free
1 parent baea309 commit 88e8830

File tree

8 files changed

+73
-70
lines changed

8 files changed

+73
-70
lines changed

css/settings.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2459,7 +2459,7 @@ li.draggable-item .components-panel__body-toggle.components-button{
24592459
padding: 24px 0;
24602460
}
24612461

2462-
.fz-condition-control.is-upsell {
2462+
.is-upsell {
24632463
opacity: 0.6;
24642464
}
24652465

includes/admin/feedzy-rss-feeds-import.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -557,12 +557,11 @@ public function feedzy_import_feed_options() {
557557
$inherited_thumbnail_id = ! empty( $this->free_settings['general']['default-thumbnail-id'] ) ? (int) $this->free_settings['general']['default-thumbnail-id'] : 0;
558558
if ( feedzy_is_pro() ) {
559559
$default_thumbnail_id = get_post_meta( $post->ID, 'default_thumbnail_id', true );
560+
$import_schedule = array(
561+
'fz_cron_schedule' => ! empty( $this->free_settings['general']['fz_cron_schedule'] ) ? $this->free_settings['general']['fz_cron_schedule'] : '',
562+
);
560563
}
561564

562-
$import_schedule = array(
563-
'fz_cron_schedule' => ! empty( $this->free_settings['general']['fz_cron_schedule'] ) ? $this->free_settings['general']['fz_cron_schedule'] : '',
564-
);
565-
566565
$fz_cron_schedule = get_post_meta( $post->ID, 'fz_cron_schedule', true );
567566
if ( ! empty( $fz_cron_schedule ) ) {
568567
$import_schedule['fz_cron_schedule'] = $fz_cron_schedule;

includes/views/import-metabox-edit.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,11 @@ class="dashicons dashicons-arrow-down-alt2"></span>
106106
</div>
107107
<!-- Sources configuration Step End -->
108108
<!-- Filters Step Start -->
109-
<div class="feedzy-accordion-item <?php echo esc_attr( apply_filters( 'feedzy_upsell_class', '' ) ); ?>">
109+
<div class="feedzy-accordion-item">
110110
<div class="feedzy-accordion-item__title" id="fz-import-filters">
111111
<button type="button" class="feedzy-accordion-item__button">
112112
<div class="feedzy-accordion__step-number help-text"><?php esc_html_e( 'Step 2', 'feedzy-rss-feeds' ); ?></div>
113-
<div class="feedzy-accordion__step-title h2"><?php esc_html_e( 'Filters', 'feedzy-rss-feeds' ); ?><?php echo ! feedzy_is_pro() ? ' <span class="pro-label">PRO</span>' : ''; ?></div>
113+
<div class="feedzy-accordion__step-title h2"><?php esc_html_e( 'Filters', 'feedzy-rss-feeds' ); ?></div>
114114
<div class="feedzy-accordion__icon"><span class="dashicons dashicons-arrow-down-alt2"></span></div>
115115
</button>
116116
</div>
@@ -654,15 +654,14 @@ class="fz-switch-toggle" type="checkbox" value="yes"
654654
</div>
655655
</div>
656656

657-
<div class="form-block form-block-two-column <?php echo esc_attr( apply_filters( 'feedzy_upsell_class', '' ) ); ?>">
658-
<?php echo wp_kses_post( apply_filters( 'feedzy_upsell_content', '', 'schedule-import-job', 'import' ) ); ?>
657+
<div class="form-block form-block-two-column">
659658
<div class="fz-left">
660-
<h4 class="h4"><?php esc_html_e( 'Schedule', 'feedzy-rss-feeds' ); ?> <?php echo ! feedzy_is_pro() ? ' <span class="pro-label">PRO</span>' : ''; ?></h4>
659+
<h4 class="h4"><?php esc_html_e( 'Schedule', 'feedzy-rss-feeds' ); ?></h4>
661660
</div>
662661
<div class="fz-right">
663662
<div class="fz-form-group">
664663
<label class="form-label"><?php esc_html_e( 'Import schedule', 'feedzy-rss-feeds' ); ?></label>
665-
<select id="fz-event-schedule" class="form-control fz-select-control" name="feedzy_meta_data[fz_cron_schedule]"<?php disabled( true, ! feedzy_is_pro() ); ?>>
664+
<select id="fz-event-schedule" class="form-control fz-select-control" name="feedzy_meta_data[fz_cron_schedule]">
666665
<?php
667666
$save_schedule = ! empty( $import_schedule['fz_cron_schedule'] ) ? $import_schedule['fz_cron_schedule'] : '';
668667

@@ -680,6 +679,7 @@ class="fz-switch-toggle" type="checkbox" value="yes"
680679
$duplicate_schedule[] = $schedule['interval'];
681680
?>
682681
<option data-slug="<?php echo esc_attr( $slug ); ?>" value="<?php echo esc_attr( $slug ); ?>"<?php selected( $save_schedule, $slug ); ?>
682+
<?php disabled( ! feedzy_is_pro() && 'daily' !== $slug ); ?>
683683
>
684684
<?php echo esc_html( $schedule['display'] ); ?>
685685
</option>
@@ -690,11 +690,10 @@ class="fz-switch-toggle" type="checkbox" value="yes"
690690
</div>
691691
</div>
692692

693-
<div class="form-block form-block-two-column <?php echo esc_attr( apply_filters( 'feedzy_upsell_class', '' ) ); ?>">
694-
<?php echo wp_kses_post( apply_filters( 'feedzy_upsell_content', '', 'fallback-image', 'import' ) ); ?>
693+
<div class="form-block form-block-two-column">
695694
<div class="fz-left">
696695
<h4 class="h4">
697-
<?php esc_html_e( 'Fallback Image', 'feedzy-rss-feeds' ); ?> <?php echo ! feedzy_is_pro() ? ' <span class="pro-label">PRO</span>' : ''; ?>
696+
<?php esc_html_e( 'Fallback Image', 'feedzy-rss-feeds' ); ?>
698697
</h4>
699698
</div>
700699
<div class="fz-right">

js/Conditions/ConditionsControl.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { Icon, plus } from '@wordpress/icons';
1717
*/
1818
import PanelTab from './PanelTab';
1919
import DateTimeControl from './DateTimeControl';
20+
import { cond } from 'lodash';
2021

2122
const SUPPORTED_FIELDS = [
2223
{
@@ -70,6 +71,10 @@ const ConditionsControl = ({ conditions, setConditions }) => {
7071
};
7172

7273
const addCondition = () => {
74+
if (!isPro && 1 <= conditions.conditions.length) {
75+
return;
76+
}
77+
7378
const conditionsCopy = [...conditions.conditions];
7479

7580
conditionsCopy.push({
@@ -122,9 +127,7 @@ const ConditionsControl = ({ conditions, setConditions }) => {
122127

123128
return (
124129
<div
125-
className={classNames('fz-condition-control', {
126-
'is-upsell': !isPro,
127-
})}
130+
className='fz-condition-control'
128131
>
129132
<SelectControl
130133
label={__('Include If', 'feedzy-rss-feeds')}
@@ -140,7 +143,6 @@ const ConditionsControl = ({ conditions, setConditions }) => {
140143
},
141144
]}
142145
onChange={onChangeMatch}
143-
disabled={!isPro}
144146
/>
145147

146148
{conditions.conditions.map((condition, index) => {
@@ -165,7 +167,6 @@ const ConditionsControl = ({ conditions, setConditions }) => {
165167
onChange={(value) =>
166168
onChangeCondition(index, value, 'field')
167169
}
168-
disabled={!isPro}
169170
/>
170171

171172
<SelectControl
@@ -190,7 +191,6 @@ const ConditionsControl = ({ conditions, setConditions }) => {
190191
onChange={(value) =>
191192
onChangeCondition(index, value, 'operator')
192193
}
193-
disabled={!isPro}
194194
/>
195195

196196
{!['has_value', 'empty'].includes(
@@ -209,7 +209,6 @@ const ConditionsControl = ({ conditions, setConditions }) => {
209209
'value'
210210
)
211211
}
212-
disabled={!isPro}
213212
/>
214213
) : (
215214
<TextControl
@@ -222,7 +221,6 @@ const ConditionsControl = ({ conditions, setConditions }) => {
222221
'value'
223222
)
224223
}
225-
disabled={!isPro}
226224
/>
227225
)}
228226
</>
@@ -231,7 +229,10 @@ const ConditionsControl = ({ conditions, setConditions }) => {
231229
);
232230
})}
233231

234-
<div className="fz-action-btn mt-24">
232+
<div className={classNames("fz-action-btn mt-24", {
233+
'is-upsell': !isPro && 1 <= conditions.conditions.length
234+
})}
235+
>
235236
<Button
236237
variant="secondary"
237238
onClick={addCondition}

js/FeedzyBlock/inspector.js

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -258,21 +258,14 @@ class Inspector extends Component {
258258
<PanelBody
259259
title={[
260260
__('Filter items', 'feedzy-rss-feeds'),
261-
!window.feedzyjs.isPro && (
262-
<span className="fz-pro-label">Pro</span>
263-
),
264261
]}
265262
initialOpen={false}
266-
className={
267-
window.feedzyjs.isPro
268-
? 'feedzy-item-filter'
269-
: 'feedzy-item-filter fz-locked'
270-
}
263+
className='feedzy-item-filter'
271264
>
272265
{!window.feedzyjs.isPro && (
273266
<div className="fz-upsell-notice">
274267
{__(
275-
'Unlock this feature and more advanced options with',
268+
'Unlock more advanced options with',
276269
'feedzy-rss-feeds'
277270
)}{' '}
278271
<ExternalLink href="https://themeisle.com/plugins/feedzy-rss-feeds/upgrade/?utm_source=wpadmin&utm_medium=blockeditor&utm_campaign=keywordsfilter&utm_content=feedzy-rss-feeds">
@@ -307,13 +300,15 @@ class Inspector extends Component {
307300
{
308301
label: __('Author', 'feedzy-rss-feeds'),
309302
value: 'author',
303+
disabled: !window.feedzyjs.isPro,
310304
},
311305
{
312306
label: __(
313307
'Description',
314308
'feedzy-rss-feeds'
315309
),
316310
value: 'description',
311+
disabled: !window.feedzyjs.isPro,
317312
},
318313
]}
319314
onChange={this.props.edit.onKeywordsIncludeOn}
@@ -345,35 +340,45 @@ class Inspector extends Component {
345340
{
346341
label: __('Author', 'feedzy-rss-feeds'),
347342
value: 'author',
343+
disabled: !window.feedzyjs.isPro,
348344
},
349345
{
350346
label: __(
351347
'Description',
352348
'feedzy-rss-feeds'
353349
),
354350
value: 'description',
351+
disabled: !window.feedzyjs.isPro,
355352
},
356353
]}
357354
onChange={this.props.edit.onKeywordsExcludeOn}
358355
/>
359-
<p className="fz-main-label">
360-
{__(
361-
'Filter feed item by date range.',
362-
'feedzy-rss-feeds'
363-
)}
364-
</p>
365-
<TextControl
366-
type="datetime-local"
367-
label={__('From:', 'feedzy-rss-feeds')}
368-
value={this.props.attributes.from_datetime}
369-
onChange={this.props.edit.onFromDateTime}
370-
/>
371-
<TextControl
372-
type="datetime-local"
373-
label={__('To:', 'feedzy-rss-feeds')}
374-
value={this.props.attributes.to_datetime}
375-
onChange={this.props.edit.onToDateTime}
376-
/>
356+
357+
<div className={
358+
!window.feedzyjs.isPro
359+
? 'fz-locked'
360+
: ''
361+
}
362+
>
363+
<p className="fz-main-label">
364+
{__(
365+
'Filter feed item by date range.',
366+
'feedzy-rss-feeds'
367+
)}
368+
</p>
369+
<TextControl
370+
type="datetime-local"
371+
label={__('From:', 'feedzy-rss-feeds')}
372+
value={this.props.attributes.from_datetime}
373+
onChange={this.props.edit.onFromDateTime}
374+
/>
375+
<TextControl
376+
type="datetime-local"
377+
label={__('To:', 'feedzy-rss-feeds')}
378+
value={this.props.attributes.to_datetime}
379+
onChange={this.props.edit.onToDateTime}
380+
/>
381+
</div>
377382
</PanelBody>
378383
</Fragment>
379384
)}

js/FeedzyLoop/controls.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,6 @@ const Controls = ({
195195
<PanelBody
196196
title={[
197197
__('Filter items', 'feedzy-rss-feeds'),
198-
!window.feedzyData.isPro && (
199-
<span className="fz-pro-label">Pro</span>
200-
),
201198
]}
202199
initialOpen={false}
203200
key="filters"
@@ -206,7 +203,7 @@ const Controls = ({
206203
{!window.feedzyData.isPro && (
207204
<div className="fz-upsell-notice">
208205
{__(
209-
'Unlock this feature and more advanced options with',
206+
'Unlock more advanced options with',
210207
'feedzy-rss-feeds'
211208
)}{' '}
212209
<ExternalLink href="https://themeisle.com/plugins/feedzy-rss-feeds/upgrade/?utm_source=wpadmin&utm_medium=blockeditor&utm_campaign=keywordsfilter&utm_content=feedzy-rss-feeds">
@@ -222,7 +219,7 @@ const Controls = ({
222219
conditions: [],
223220
match: 'all',
224221
}
225-
: {
222+
: attributes?.conditions || {
226223
match: 'all',
227224
conditions: [
228225
{

js/FeedzyLoop/editor.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313
.fz-condition-control {
1414
padding: 0;
1515

16-
&.is-upsell {
17-
opacity: 0.6;
18-
}
19-
2016
.components-button {
2117
width: 100%;
2218
margin: 0;
@@ -25,6 +21,10 @@
2521
}
2622
}
2723

24+
.is-upsell {
25+
opacity: 0.6;
26+
}
27+
2828
.fz-panel-tab {
2929
z-index: 999999;
3030
margin: 24px 0;

tests/e2e/specs/upsell.spec.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,33 @@ test.describe( 'Upsell', () => {
2020
// Hover over text named Filter by Keyword
2121
const filtersTab = page.locator('#feedzy-import-form > div.feedzy-accordion > div:nth-child(2)');
2222

23-
// It should have 1 elements with .only-pro-content class.
24-
await expect( filtersTab.locator('.pro-label').count() ).resolves.toBe(1);
23+
// It should have 1 elements with .fz-panel-tab class.
24+
await expect( filtersTab.locator('.fz-panel-tab').count() ).resolves.toBe(1);
25+
26+
// 'Add condition' action button has .is-upsell class.
27+
await expect(filtersTab.locator('.fz-action-btn.is-upsell')).toHaveCount(1);
2528

2629
} );
2730

2831

2932
test( 'general settings', async({ editor, page }) => {
3033
await page.getByRole('button', { name: 'Step 4 General feed settings' }).click({ force: true });
3134

35+
await page.locator('.fz-form-group:has( #fz-event-schedule )').scrollIntoViewIfNeeded()
3236

37+
// check all the option expect daily is disabled.
38+
const otherOptions = page.locator('#fz-event-schedule option:not([value="daily"])');
39+
const count = await otherOptions.count();
3340

34-
await page.locator('.fz-form-group:has( #feed-post-default-thumbnail )').hover({ force: true });
35-
let upgradeAlert = page.locator('#feedzy-import-form a[href*="utm_campaign=fallback-image"]');
36-
await expect( upgradeAlert ).toBeVisible();
37-
38-
await page.locator('.fz-form-group:has( #fz-event-schedule )').scrollIntoViewIfNeeded()
39-
await page.locator('.fz-form-group:has( #fz-event-schedule )').hover({ force: true });
40-
upgradeAlert = page.locator('#feedzy-import-form a[href*="utm_campaign=schedule-import-job"]');
41-
await expect( upgradeAlert ).toBeVisible();
41+
for (let i = 0; i < count; i++) {
42+
await expect(otherOptions.nth(i)).toBeDisabled();
43+
}
4244

4345
// Click the advanced settings tab.
4446
await page.click('[data-id="fz-advanced-settings"]');
4547

4648
await page.locator('.fz-form-group:has( #feedzy_mark_duplicate )').hover({ force: true });
47-
upgradeAlert = page.locator('#feedzy-import-form a[href*="utm_campaign=remove-duplicates"]');
49+
const upgradeAlert = page.locator('#feedzy-import-form a[href*="utm_campaign=remove-duplicates"]');
4850
await expect( upgradeAlert ).toBeVisible();
4951
} );
5052
});

0 commit comments

Comments
 (0)