From 3671bcd266dc12b812cd7724d645ef3992237ac3 Mon Sep 17 00:00:00 2001 From: aratidgr8 Date: Wed, 16 Oct 2024 17:29:09 +0530 Subject: [PATCH 1/3] Fix react console warnings for Home page --- build/index.asset.php | 2 +- src/components/WPSolutionsBanner.js | 16 ++++++++++------ src/sdk/plugins.js | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/build/index.asset.php b/build/index.asset.php index 2d57bff2..95cef001 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' => '2e99252879dbc96cca15'); + array('lodash', 'moment', 'react', 'react-dom', 'wp-api-fetch', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => 'fdecf6eb6c16f87153bc'); diff --git a/src/components/WPSolutionsBanner.js b/src/components/WPSolutionsBanner.js index f0e3fc1a..1b62ab9d 100644 --- a/src/components/WPSolutionsBanner.js +++ b/src/components/WPSolutionsBanner.js @@ -23,6 +23,7 @@ export function WPSolutionsBanner() { const [ availableSolutions, setAvailableSolutions] = useState([]); const [ pluginActiveStatusArray, setPluginActiveStatusArray] = useState([]); let currentSolution = []; + const hasSolution = NewfoldRuntime.hasCapability("hasSolution"); let premiumPluginStatus = useSWR( "nfd_slug_wonder_cart", @@ -82,7 +83,8 @@ export function WPSolutionsBanner() { wpSolutionsPromotedPluginsList[0]['WP_SOLUTION_SERVICE'] : wpSolutionsPromotedPluginsList[0]['WP_SOLUTION_COMMERCE']; let solutionsCards = Object.values(currentSolution); return( - + hasSolution && + ( { solutionsCards?.map((details, index) => { - return (
+ return (

{ __(`${details['title']}`,"wp-module-ecommerce") }

@@ -109,7 +111,7 @@ export function WPSolutionsBanner() { //installed & active status === "active" ? ( - @@ -118,7 +120,7 @@ export function WPSolutionsBanner() { //installed but not active status === "need_to_activate" ? ( - @@ -130,6 +132,7 @@ export function WPSolutionsBanner() { details.plsProviderName && details.plsSlug ? ( ) @@ -185,7 +189,7 @@ export function WPSolutionsBanner() { {__(`View all your plugins and tools`, "wp-module-ecommerce")} - + ) ) } diff --git a/src/sdk/plugins.js b/src/sdk/plugins.js index ecc1dbe4..07274d7d 100644 --- a/src/sdk/plugins.js +++ b/src/sdk/plugins.js @@ -9,7 +9,7 @@ const Endpoints = { PLUGIN_INSTALL: NewfoldRuntime.createApiUrl("/newfold-installer/v1/plugins/install"), }; -const INSTALL_TOKEN = NewfoldRuntime.ecommerce.install_token; +const INSTALL_TOKEN = NewfoldRuntime.ecommerce?.install_token; export const PluginsSdk = { queries: { From e490d1568868ad53cdbe2620f96a25109ea8870d Mon Sep 17 00:00:00 2001 From: aratidgr8 Date: Wed, 16 Oct 2024 19:17:28 +0530 Subject: [PATCH 2/3] Data attributes updated as discussed with Arun --- src/components/WPSolutionsBanner.js | 6 ++--- src/constants.js | 35 ++++++++++------------------- 2 files changed, 14 insertions(+), 27 deletions(-) diff --git a/src/components/WPSolutionsBanner.js b/src/components/WPSolutionsBanner.js index 1b62ab9d..699d156f 100644 --- a/src/components/WPSolutionsBanner.js +++ b/src/components/WPSolutionsBanner.js @@ -136,11 +136,10 @@ export function WPSolutionsBanner() { className="nfd-button nfd-button--primary nfd-mt-9 nfd-mt-auto nfd-self-start" as="button" data-nfd-installer-plugin-activate={true} - data-nfd-installer-plugin-slug={slug} - data-nfd-installer-plugin-provider={details.plsProviderName} + data-nfd-installer-pls-slug={slug} + data-nfd-installer-pls-provider={details.plsProviderName} data-nfd-installer-plugin-name={details.name} data-nfd-installer-plugin-url={url} - data-nfd-installer-plugin-storage-key={details.storageKey} isLoading={status==="installing"} > { __(`${details['buttonText']}`,"wp-module-ecommerce") } @@ -159,7 +158,6 @@ export function WPSolutionsBanner() { data-nfd-installer-plugin-name={details.name} data-nfd-installer-download-url={details.download} data-nfd-installer-plugin-url={url} - data-nfd-installer-plugin-storage-key={details.storageKey} isLoading={status==="installing"} > { __(`${details['buttonText']}`,"wp-module-ecommerce") } diff --git a/src/constants.js b/src/constants.js index 2604d7f9..fc1421de 100644 --- a/src/constants.js +++ b/src/constants.js @@ -54,8 +54,7 @@ export const wpSolutionsPromotedPluginsList = [ description: "Build webpages fast with tailored block patterns and page templates included in your hosting package.", buttonText: "Add a Page to Your Site", name: "", - plsSlug: "", - storageKey: "", + plsSlug: "", plsProviderName: "", download: null, basename: "", @@ -66,8 +65,7 @@ export const wpSolutionsPromotedPluginsList = [ description: "Start increasing your search result rankings today.", buttonText: "Improve Your Search Ranking", name:"WordPress SEO", - plsSlug: "wp-seo", - storageKey: "", + plsSlug: "wp-seo", plsProviderName: "yoast", download: "https://downloads.wordpress.org/plugin/wordpress-seo.latest-stable.zip", basename: "wordpress-seo/wp-seo.php", @@ -78,8 +76,7 @@ export const wpSolutionsPromotedPluginsList = [ description: "Create beautiful and engaging online courses, lessons, and quizzes.", buttonText: "Create a Course", name: "", - plsSlug: "sensei-lms", - storageKey: "", + plsSlug: "sensei-lms", plsProviderName: "", download: null, basename: "sensei-lms/sensei-lms.php", @@ -91,8 +88,7 @@ export const wpSolutionsPromotedPluginsList = [ description: "Grant your affiliates earnings each time someone purchases from their link.", buttonText: "Create an Affiliate Program", name: "Affiliate Programs", - plsSlug: "yith-woocommerce-affiliates", - storageKey: "", + plsSlug: "yith-woocommerce-affiliates", plsProviderName: "yith", download: null, basename: "commerce-entitlement/commerce-entitlement.php", @@ -105,8 +101,7 @@ export const wpSolutionsPromotedPluginsList = [ description: "Manage the renting or booking of services and items that you offer your customers.", buttonText: "Setup Bookings", name: "", - plsSlug: "yith-woocommerce-booking", - storageKey: "", + plsSlug: "yith-woocommerce-booking", plsProviderName: "yith", download: null, basename: "", @@ -117,8 +112,7 @@ export const wpSolutionsPromotedPluginsList = [ description: "Build webpages fast with tailored block patterns and page templates.", buttonText: "Add a Page to Your Site", name: "", - plsSlug: "", - storageKey: "", + plsSlug: "", plsProviderName: "", download: null, basename: "", @@ -129,8 +123,7 @@ export const wpSolutionsPromotedPluginsList = [ description: "Start increasing your search result rankings today.", buttonText: "Improve Your Search Ranking", name: "Yoast SEO", - plsSlug: "wp-seo", - storageKey: "", + plsSlug: "wp-seo", plsProviderName: "yoast", download: "https://downloads.wordpress.org/plugin/wordpress-seo.latest-stable.zip", basename: "wordpress-seo/wp-seo.php", @@ -141,8 +134,7 @@ export const wpSolutionsPromotedPluginsList = [ description: "Reward customer loyalty with an effective points program.", buttonText: "Configure Points & Rewards", name: "Bookings & Appointments", - plsSlug: "yith-woocommerce-points-and-rewards", - storageKey: "", + plsSlug: "yith-woocommerce-points-and-rewards", plsProviderName: "yith", download: null, basename: "", @@ -157,7 +149,7 @@ export const wpSolutionsPromotedPluginsList = [ buttonText: "Setup Wishilsts", name: "Wishlists", plsSlug: "yith-woocommerce-wishlist", - storageKey: "", + plsProviderName: "yith", download: null, basename: "", @@ -168,8 +160,7 @@ export const wpSolutionsPromotedPluginsList = [ 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", - storageKey: "", + plsSlug: "yith-woocommerce-advanced-reviews", plsProviderName: "yith", download: null, basename: "", @@ -180,8 +171,7 @@ export const wpSolutionsPromotedPluginsList = [ 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", - storageKey: "", + plsSlug: "yith-woocommerce-dynamic-pricing-and-discounts", plsProviderName: "yith", download: null, basename: "", @@ -192,8 +182,7 @@ export const wpSolutionsPromotedPluginsList = [ description: "Start increasing your search result rankings today.", buttonText: "Improve Your Search Ranking", name: "Yoast SEO", - plsSlug: "wp-seo", - storageKey: "", + plsSlug: "wp-seo", plsProviderName: "yoast", download: "https://downloads.wordpress.org/plugin/wordpress-seo.latest-stable.zip", basename: "wordpress-seo/wp-seo.php", From a463e88d56dc378dd605828fe8f9de7401ab42ab Mon Sep 17 00:00:00 2001 From: aratidgr8 Date: Wed, 16 Oct 2024 20:07:04 +0530 Subject: [PATCH 3/3] Data attributes & values updated in constants & plugins.php files --- includes/Data/Plugins.php | 18 +++++++++--------- src/components/WPSolutionsBanner.js | 4 ++-- src/constants.js | 28 +++++++++++++--------------- 3 files changed, 24 insertions(+), 26 deletions(-) diff --git a/includes/Data/Plugins.php b/includes/Data/Plugins.php index 38410034..83b71a56 100644 --- a/includes/Data/Plugins.php +++ b/includes/Data/Plugins.php @@ -60,29 +60,29 @@ final class Plugins { 'file' => 'sensei-lms/sensei-lms.php' ), //Add An Affiliate Program - 'yith-woocommerce-affiliates' => array( + 'yith-woocommerce-affiliates-premium' => 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' => array( + 'yith-woocommerce-booking-premium' => array( 'url' => 'edit.php?post_type=yith_booking&yith-plugin-fw-panel-skip-redirect=1', - 'file' => 'yith-woocommerce-booking/init.php' + 'file' => 'yith-woocommerce-booking-premium/init.php' ), //Setup A Loyalty Program - 'yith-woocommerce-points-and-rewards' => array( + 'yith-woocommerce-points-and-rewards-premium' => array( 'url' => 'admin.php?page=yith_woocommerce_points_and_rewards&tab=points&sub_tab=points-standard', - 'file' => 'yith-woocommerce-points-and-rewards/init.php' + 'file' => 'yith-woocommerce-points-and-rewards-premium/init.php' ), //Setup WishList - 'yith-woocommerce-wishlist' => array( + 'yith-woocommerce-wishlist-premium' => array( 'url' => 'admin.php?page=yith_wcwl_panel&tab=settings&sub_tab=settings-general', - 'file' => 'yith-woocommerce-wishlist/init.php' + 'file' => 'yith-woocommerce-wishlist-premium/init.php' ), //Enable Product Reviews - 'yith-woocommerce-advanced-reviews' => array( + 'yith-woocommerce-advanced-reviews-premium' => array( 'url' => 'admin.php?page=yith_ywar_panel', - 'file' => 'yith-woocommerce-advanced-reviews/init.php' + 'file' => 'yith-woocommerce-advanced-reviews-premium/init.php' ), //Create a Sales Campaign 'yith-woocommerce-dynamic-pricing-and-discounts' => array( diff --git a/src/components/WPSolutionsBanner.js b/src/components/WPSolutionsBanner.js index 699d156f..a466e853 100644 --- a/src/components/WPSolutionsBanner.js +++ b/src/components/WPSolutionsBanner.js @@ -29,7 +29,7 @@ export function WPSolutionsBanner() { "nfd_slug_wonder_cart", () => PluginsSdk.queries - .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") + .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") .then(res => { setPluginActiveStatusArray(res?.details) }), @@ -129,7 +129,7 @@ export function WPSolutionsBanner() { //need to install status === "need_to_install" ? //premium - details.plsProviderName && details.plsSlug ? + details.plsProviderName && details.plsSlug && !details.download ? (