diff --git a/bootstrap.php b/bootstrap.php
index 7a34378f..9c0cbe7b 100644
--- a/bootstrap.php
+++ b/bootstrap.php
@@ -5,7 +5,7 @@
use function NewfoldLabs\WP\ModuleLoader\register;
-define( 'NFD_ECOMMERCE_MODULE_VERSION', '1.4.0-beta.8' );
+define( 'NFD_ECOMMERCE_MODULE_VERSION', '1.4.0-beta.9' );
if ( function_exists( 'is_admin' ) && is_admin() ) {
$old_woocommerce_module_version = get_option( 'nfd_ecommerce_module_version' );
diff --git a/build/index.asset.php b/build/index.asset.php
index 13749327..eb55938c 100644
--- a/build/index.asset.php
+++ b/build/index.asset.php
@@ -1 +1 @@
- array('lodash', 'moment', 'react', 'react-dom', 'wp-api-fetch', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => '857fc5b5930751df9c71');
+ array('lodash', 'moment', 'react', 'react-dom', 'wp-api-fetch', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => '06f7324e4a155909e837');
diff --git a/includes/Data/Plugins.php b/includes/Data/Plugins.php
index 83b71a56..75483d10 100644
--- a/includes/Data/Plugins.php
+++ b/includes/Data/Plugins.php
@@ -60,27 +60,27 @@ final class Plugins {
'file' => 'sensei-lms/sensei-lms.php'
),
//Add An Affiliate Program
- 'yith-woocommerce-affiliates-premium' => array(
+ 'yith-woocommerce-affiliates' => array(
'url' => 'admin.php?page=yith_wcaf_panel&tab=settings&sub_tab=settings-general',
'file' => 'yith-woocommerce-affiliates-premium/init.php'
),
//Setup Bookings
- 'yith-woocommerce-booking-premium' => array(
+ 'yith-woocommerce-booking' => array(
'url' => 'edit.php?post_type=yith_booking&yith-plugin-fw-panel-skip-redirect=1',
'file' => 'yith-woocommerce-booking-premium/init.php'
),
//Setup A Loyalty Program
- 'yith-woocommerce-points-and-rewards-premium' => array(
+ 'yith-woocommerce-points-and-rewards' => array(
'url' => 'admin.php?page=yith_woocommerce_points_and_rewards&tab=points&sub_tab=points-standard',
'file' => 'yith-woocommerce-points-and-rewards-premium/init.php'
),
//Setup WishList
- 'yith-woocommerce-wishlist-premium' => array(
+ 'yith-woocommerce-wishlist' => array(
'url' => 'admin.php?page=yith_wcwl_panel&tab=settings&sub_tab=settings-general',
'file' => 'yith-woocommerce-wishlist-premium/init.php'
),
//Enable Product Reviews
- 'yith-woocommerce-advanced-reviews-premium' => array(
+ 'yith-woocommerce-advanced-reviews' => array(
'url' => 'admin.php?page=yith_ywar_panel',
'file' => 'yith-woocommerce-advanced-reviews-premium/init.php'
),
diff --git a/package-lock.json b/package-lock.json
index 923fbdb3..e10e65d9 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@newfold-labs/wp-module-ecommerce",
- "version": "1.4.0-beta.8",
+ "version": "1.4.0-beta.9",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@newfold-labs/wp-module-ecommerce",
- "version": "1.4.0-beta.8",
+ "version": "1.4.0-beta.9",
"license": "GPL-2.0-or-later",
"dependencies": {
"@faizaanceg/pandora": "^1.1.1",
diff --git a/package.json b/package.json
index 7befb609..ce3a7fea 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "@newfold-labs/wp-module-ecommerce",
"description": "Brand Agnostic eCommerce Experience",
"license": "GPL-2.0-or-later",
- "version": "1.4.0-beta.8",
+ "version": "1.4.0-beta.9",
"main": "build/index.js",
"files": [
"build/",
diff --git a/src/components/WPSolutionsBanner.js b/src/components/WPSolutionsBanner.js
index ecce3704..17a7215f 100644
--- a/src/components/WPSolutionsBanner.js
+++ b/src/components/WPSolutionsBanner.js
@@ -29,7 +29,15 @@ export function WPSolutionsBanner() {
"nfd_slug_wonder_cart",
() =>
PluginsSdk.queries
- .status("nfd_slug_wonder_cart", "sensei-lms", "wp-seo", "yith-woocommerce-affiliates-premium", "yith-woocommerce-booking-premium", "yith-woocommerce-points-and-rewards-premium", "yith-woocommerce-wishlist-premium", "yith-woocommerce-advanced-reviews-premium", "yith-woocommerce-dynamic-pricing-and-discounts")
+ .status("nfd_slug_wonder_cart",
+ "sensei-lms",
+ "wp-seo",
+ "yith-woocommerce-affiliates",
+ "yith-woocommerce-booking",
+ "yith-woocommerce-points-and-rewards",
+ "yith-woocommerce-wishlist",
+ "yith-woocommerce-advanced-reviews",
+ "yith-woocommerce-dynamic-pricing-and-discounts")
.then(res => {
setPluginActiveStatusArray(res?.details)
}),
@@ -73,7 +81,7 @@ export function WPSolutionsBanner() {
);
}
else if (apiResponse) {
- if (purchasedSolution === null) {
+ if (purchasedSolution === null || !hasSolution) {
return ();
}
else{
@@ -112,7 +120,7 @@ export function WPSolutionsBanner() {
status === "active" ?
(
)
@@ -120,8 +128,16 @@ export function WPSolutionsBanner() {
//installed but not active
status === "need_to_activate" ?
(
-
)
@@ -160,7 +176,7 @@ export function WPSolutionsBanner() {
data-nfd-installer-plugin-url={url}
isLoading={status==="installing"}
>
- { __(`${details['buttonText']}`,"wp-module-ecommerce") }
+ { __(`${details['cta']['text']}`,"wp-module-ecommerce") }
) : null
@@ -171,8 +187,8 @@ export function WPSolutionsBanner() {
))
:
//For type not plugin
- (
- { __(`${details['buttonText']}`,"wp-module-ecommerce") }
+ (
+ { __(`${details['cta']['text']}`,"wp-module-ecommerce") }
)
diff --git a/src/configs/ProductsAndServices.config.js b/src/configs/ProductsAndServices.config.js
index e0f23a13..0bd9051e 100644
--- a/src/configs/ProductsAndServices.config.js
+++ b/src/configs/ProductsAndServices.config.js
@@ -21,6 +21,8 @@ import {
wcPluginStatusParser,
wcProductsParser,
} from "./selectors";
+import apiFetch from '@wordpress/api-fetch';
+
const getUrl = (href) => {
let [page, qs] = href.split("?");
@@ -39,11 +41,19 @@ function defineFeatureState() {
isUpsellNeeded: () => !(NewfoldRuntime.hasCapability("hasYithExtended") && NewfoldRuntime.hasCapability("hasSolution")),
featureUrl: (data) =>
data?.products.length > 0 ? data.plugins?.pluginUrl : null,
+ purchasedSolution: ( data ) => data.isEcomSolution !== 'WP_SOLUTION_COMMERCE',
upsellOptions: (data) => data?.upsellOptions,
};
}
-export const ProductsAndServicesDefinition = (props) => ({
+async function getPurchasedSolution() {
+ const url = NewfoldRuntime.createApiUrl("/newfold-solutions/v1/entitlements")
+ const res = await apiFetch( { url: `${ url }` } )
+ return res
+}
+
+export const ProductsAndServicesDefinition = (props) => (
+ {
dataDependencies: {
plugins: async () =>
PluginsSdk.queries.status(
@@ -53,6 +63,7 @@ export const ProductsAndServicesDefinition = (props) => ({
),
products: WooCommerceSdk.products.list,
upsellOptions: MarketplaceSdk.eCommerceOptions,
+ isEcomSolution: () => getPurchasedSolution()
},
cards: [
{
@@ -155,7 +166,7 @@ export const ProductsAndServicesDefinition = (props) => ({
},
{
Card: FeatureCard,
- shouldRender: () => NewfoldRuntime.hasCapability("hasSolution"),
+ shouldRender: (state) => NewfoldRuntime.hasCapability("hasSolution") && state.purchasedSolution,
name: "booking",
assets: ({ isActive }) => ({
Image: CalendarIcon,
@@ -203,11 +214,15 @@ export const ProductsAndServicesDefinition = (props) => ({
"YITH Booking and Appointment for WooCommerce"
),
},
+ {
+ key: "isEcomSolution",
+ selector: (data) => data?.solution
+ }
],
},
{
Card: FeatureCard,
- shouldRender: () => NewfoldRuntime.hasCapability("hasSolution"),
+ shouldRender: (state) => NewfoldRuntime.hasCapability("hasSolution") && state.purchasedSolution,
name: "gifts",
assets: ({ isActive }) => ({
Image: GiftIcon,
@@ -251,6 +266,10 @@ export const ProductsAndServicesDefinition = (props) => ({
key: "upsellOptions",
selector: findUpsellWithName("YITH WooCommerce Gift Cards"),
},
+ {
+ key: "isEcomSolution",
+ selector: (data) => data?.solution
+ }
],
},
],
diff --git a/src/constants.js b/src/constants.js
index 89b0fc84..927c4ff3 100644
--- a/src/constants.js
+++ b/src/constants.js
@@ -51,92 +51,112 @@ export const wpSolutionsPromotedPluginsList = [
{
title: "WEBPAGE CREATION",
description: "Build webpages fast with tailored block patterns and page templates included in your hosting package.",
- buttonText: "Add a Page to Your Site",
name: "Webpage Creation",
plsSlug: "",
plsProviderName: "",
download: null,
basename: "",
- url: "post-new.php?post_type=page"
+ cta: {
+ "text": "Add a Page to Your Site",
+ "url" : "post-new.php?post_type=page"
+ }
+
},
{
title: "SEARCH ENGINE OPTIMIZATION",
description: "Start increasing your search result rankings today.",
- buttonText: "Improve Your Search Ranking",
name:"Yoast SEO",
plsSlug: "wp-seo",
plsProviderName: "yoast",
download: "https://downloads.wordpress.org/plugin/wordpress-seo.latest-stable.zip",
basename: "wordpress-seo/wp-seo.php",
- url: "admin.php?page=wpseo_dashboard#top#first-time-configuration"
+ cta: {
+ "text": "Improve Your Search Ranking",
+ "url": "admin.php?page=wpseo_dashboard#top#first-time-configuration"
+ },
},
{
title: "OFFER CONTENT COURSES",
description: "Create beautiful and engaging online courses, lessons, and quizzes.",
- buttonText: "Create a Course",
name: "Offer Content Courses",
plsSlug: "sensei-lms",
plsProviderName: "automattic",
download: "https://downloads.wordpress.org/plugin/sensei-lms.latest-stable.zip",
basename: "sensei-lms/sensei-lms.php",
- url: "post-new.php?post_type=course"
+ cta: {
+ "text": "Create a Course",
+ "url": "post-new.php?post_type=course"
+ },
},
{
title: "ADD AN AFFILIATE PROGRAM",
description: "Grant your affiliates earnings each time someone purchases from their link.",
- buttonText: "Create an Affiliate Program",
name: "Affiliate Programs",
plsSlug: "yith-woocommerce-affiliates",
plsProviderName: "yith",
download: null,
basename: "yith-woocommerce-affiliates-premium/init.php",
- url: "admin.php?page=yith_wcaf_panel&tab=settings&sub_tab=settings-general"
+ cta: {
+ "text": "Create an Affiliate Program",
+ "url": "admin.php?page=yith_wcaf_panel&tab=settings&sub_tab=settings-general"
+ }
}
],
"WP_SOLUTION_SERVICE": [
{
title: "SETUP BOOKINGS",
description: "Manage the renting or booking of services and items that you offer your customers.",
- buttonText: "Setup Bookings",
name: "Bookings & Appointments",
plsSlug: "yith-woocommerce-booking",
plsProviderName: "yith",
download: null,
basename: "yith-woocommerce-booking-premium/init.php",
- url: "edit.php?post_type=yith_booking&yith-plugin-fw-panel-skip-redirect=1"
+ cta: {
+ "text": "Setup Bookings",
+ "url": "edit.php?post_type=yith_booking&yith-plugin-fw-panel-skip-redirect=1"
+ }
+
},
{
title: "WEBPAGE CREATION",
description: "Build webpages fast with tailored block patterns and page templates.",
- buttonText: "Add a Page to Your Site",
name: "Webpage Creation",
plsSlug: "",
plsProviderName: "",
download: null,
basename: "",
- url: "post-new.php?post_type=page"
+ cta: {
+ "text": "Add a Page to Your Site",
+ "url": "post-new.php?post_type=page"
+ }
+
},
{
title: "SEARCH ENGINE OPTIMIZATION",
description: "Start increasing your search result rankings today.",
- buttonText: "Improve Your Search Ranking",
name: "Yoast SEO",
plsSlug: "wp-seo",
plsProviderName: "yoast",
download: "https://downloads.wordpress.org/plugin/wordpress-seo.latest-stable.zip",
basename: "wordpress-seo/wp-seo.php",
- url: "admin.php?page=wpseo_dashboard#top#first-time-configuration"
+ cta: {
+ "text": "Improve Your Search Ranking",
+ "url": "admin.php?page=wpseo_dashboard#top#first-time-configuration"
+ }
+
},
{
title: "SETUP A LOYALTY PROGRAM",
description: "Reward customer loyalty with an effective points program.",
- buttonText: "Configure Points & Rewards",
name: "Loyalty Program",
plsSlug: "yith-woocommerce-points-and-rewards",
plsProviderName: "yith",
download: null,
basename: "yith-woocommerce-points-and-rewards-premium/init.php",
- url:"admin.php?page=yith_woocommerce_points_and_rewards&tab=points&sub_tab=points-standard"
+ cta: {
+ "text": "Configure Points & Rewards",
+ "url":"admin.php?page=yith_woocommerce_points_and_rewards&tab=points&sub_tab=points-standard"
+ }
},
],
@@ -144,46 +164,55 @@ export const wpSolutionsPromotedPluginsList = [
{
title: "ENABLE PRODUCT REVIEWS",
description: "Get positive product reviews and use social proof to drive more sales.",
- buttonText: "Enable Product Reviews",
name: "Advanced Reviews",
plsSlug: "yith-woocommerce-advanced-reviews",
plsProviderName: "yith",
download: null,
basename: "yith-woocommerce-advanced-reviews-premium/init.php",
- url: "admin.php?page=yith_ywar_panel"
+ cta: {
+ "text": "Enable Product Reviews",
+ "url": "admin.php?page=yith_ywar_panel"
+ }
+
},
{
title: "SETUP WISHLISTS",
description: "Let customers add products to lists and share them with family and friends.",
- buttonText: "Setup Wishilsts",
name: "Wishlists",
plsSlug: "yith-woocommerce-wishlist",
plsProviderName: "yith",
download: null,
basename: "yith-woocommerce-wishlist-premium/init.php",
- url: "admin.php?page=yith_wcwl_panel&tab=settings&sub_tab=settings-general"
+ cta: {
+ "text": "Setup Wishilsts",
+ "url": "admin.php?page=yith_wcwl_panel&tab=settings&sub_tab=settings-general"
+ }
},
{
title: "SEARCH ENGINE OPTIMIZATION",
description: "Start increasing your search result rankings today.",
- buttonText: "Improve Your Search Ranking",
name: "Yoast SEO",
plsSlug: "wp-seo",
plsProviderName: "yoast",
download: "https://downloads.wordpress.org/plugin/wordpress-seo.latest-stable.zip",
basename: "wordpress-seo/wp-seo.php",
- url: "admin.php?page=wpseo_dashboard#top#first-time-configuration"
+ cta: {
+ "text": "Improve Your Search Ranking",
+ "url": "admin.php?page=wpseo_dashboard#top#first-time-configuration"
+ },
},
{
title: "CREATE A SALES CAMPAIGN",
description: "Create custom upsell, cross-sell and other promotional campaigns to generate more sales.",
- buttonText: "Create a Campaign",
name: "SALES CAMPAIGN",
plsSlug: "yith-woocommerce-dynamic-pricing-and-discounts",
plsProviderName: "yith",
download: null,
basename: "yith-woocommerce-dynamic-pricing-and-discounts/init.php",
- url: "edit.php?post_type=ywdpd_discount&yith-plugin-fw-panel-skip-redirect=1"
+ cta: {
+ "text": "Create a Campaign",
+ "url": "edit.php?post_type=ywdpd_discount&yith-plugin-fw-panel-skip-redirect=1"
+ }
}
],
}