From 2a3090e8f23864e60e8cbc667f1dcef9808b8b14 Mon Sep 17 00:00:00 2001 From: aratidgr8 Date: Tue, 15 Oct 2024 20:56:20 +0530 Subject: [PATCH] Changes as per Micahs comment on PRESS0-2276 on 14th Oct --- build/index.asset.php | 2 +- includes/Data/Plugins.php | 16 ++--- src/components/WPSolutionsBanner.js | 103 ++++++++++++++++++++-------- src/constants.js | 77 +++++++++++++++------ 4 files changed, 139 insertions(+), 59 deletions(-) diff --git a/build/index.asset.php b/build/index.asset.php index f145cb6c..0b31ad3d 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' => '06ff3c08674be118f358'); + array('lodash', 'moment', 'react', 'react-dom', 'wp-api-fetch', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => '404a0a7b724d2f08f5e9'); diff --git a/includes/Data/Plugins.php b/includes/Data/Plugins.php index 7a3edc21..38410034 100644 --- a/includes/Data/Plugins.php +++ b/includes/Data/Plugins.php @@ -51,42 +51,42 @@ final class Plugins { //Search Engine Optimization 'wp-seo' => array( - 'url' => 'wp-admin/admin.php?page=wpseo_dashboard#top#first-time-configuration', + 'url' => 'admin.php?page=wpseo_dashboard#top#first-time-configuration', 'file' => 'wordpress-seo/wp-seo.php' ), //Offer Content Courses 'sensei-lms' => array( - 'url' => 'wp-admin/post-new.php?post_type=course', + 'url' => 'post-new.php?post_type=course', 'file' => 'sensei-lms/sensei-lms.php' ), //Add An Affiliate Program 'yith-woocommerce-affiliates' => array( - 'url' => 'wp-admin/admin.php?page=yith_wcaf_panel&tab=settings&sub_tab=settings-general', + '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( - 'url' => 'wp-admin/edit.php?post_type=yith_booking&yith-plugin-fw-panel-skip-redirect=1', + 'url' => 'edit.php?post_type=yith_booking&yith-plugin-fw-panel-skip-redirect=1', 'file' => 'yith-woocommerce-booking/init.php' ), //Setup A Loyalty Program 'yith-woocommerce-points-and-rewards' => array( - 'url' => 'wp-admin/admin.php?page=yith_woocommerce_points_and_rewards&tab=points&sub_tab=points-standard', + 'url' => 'admin.php?page=yith_woocommerce_points_and_rewards&tab=points&sub_tab=points-standard', 'file' => 'yith-woocommerce-points-and-rewards/init.php' ), //Setup WishList 'yith-woocommerce-wishlist' => array( - 'url' => 'wp-admin/admin.php?page=yith_wcwl_panel&tab=settings&sub_tab=settings-general', + 'url' => 'admin.php?page=yith_wcwl_panel&tab=settings&sub_tab=settings-general', 'file' => 'yith-woocommerce-wishlist/init.php' ), //Enable Product Reviews 'yith-woocommerce-advanced-reviews' => array( - 'url' => 'wp-admin/admin.php?page=yith_ywar_panel', + 'url' => 'admin.php?page=yith_ywar_panel', 'file' => 'yith-woocommerce-advanced-reviews/init.php' ), //Create a Sales Campaign 'yith-woocommerce-dynamic-pricing-and-discounts' => array( - 'url' => 'wp-admin/edit.php?post_type=ywdpd_discount&yith-plugin-fw-panel-skip-redirect=1', + 'url' => 'edit.php?post_type=ywdpd_discount&yith-plugin-fw-panel-skip-redirect=1', 'file' => 'yith-woocommerce-dynamic-pricing-and-discounts/init.php' ) ); diff --git a/src/components/WPSolutionsBanner.js b/src/components/WPSolutionsBanner.js index 8e4750b4..f0e3fc1a 100644 --- a/src/components/WPSolutionsBanner.js +++ b/src/components/WPSolutionsBanner.js @@ -100,39 +100,82 @@ export function WPSolutionsBanner() { { __(`${details['description']}`,"wp-module-ecommerce") }

{ + //For type plugin details.plsSlug !== "" ? - Object.entries(pluginActiveStatusArray).map(([slug, { status, url }]) => ( - details.plsSlug === slug ? - status === "active" ? - - : - status === "need_to_install" || "installing" ? - : null + + Object.entries(pluginActiveStatusArray).map(([slug, { status, url }]) => ( + details.plsSlug === slug ? + ( + //installed & active + status === "active" ? + ( + + ) + : + //installed but not active + status === "need_to_activate" ? + ( + + ) + : + //need to install + status === "need_to_install" ? + //premium + details.plsProviderName && details.plsSlug ? + ( + + ) + : + //free + details.download ? + ( + + ) : null + : + null + ) + : null + )) : - null - )) - : - + //For type not plugin + () + } + ) }) } diff --git a/src/constants.js b/src/constants.js index bf8fbfc6..2604d7f9 100644 --- a/src/constants.js +++ b/src/constants.js @@ -45,7 +45,7 @@ export const wonderCartPopularCampaignsList = [ } ]; -//TODO: To add storageKey & plsProviderName information for all plugins once it is available +//TODO: To add storageKey, plsProviderName, download, basename information for all plugins once it is available export const wpSolutionsPromotedPluginsList = [ { "WP_SOLUTION_CREATOR": [ @@ -53,19 +53,25 @@ 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: " ", - plsSlug: " ", - storageKey: " ", - plsProviderName: " " + name: "", + plsSlug: "", + storageKey: "", + plsProviderName: "", + download: null, + basename: "", + 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", + name:"WordPress SEO", plsSlug: "wp-seo", storageKey: "", - plsProviderName: "" + 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" }, { title: "OFFER CONTENT COURSES", @@ -74,7 +80,11 @@ export const wpSolutionsPromotedPluginsList = [ name: "", plsSlug: "sensei-lms", storageKey: "", - plsProviderName: "" + plsProviderName: "", + download: null, + basename: "sensei-lms/sensei-lms.php", + url: "post-new.php?post_type=course" + }, { title: "ADD AN AFFILIATE PROGRAM", @@ -83,7 +93,10 @@ export const wpSolutionsPromotedPluginsList = [ name: "Affiliate Programs", plsSlug: "yith-woocommerce-affiliates", storageKey: "", - plsProviderName: "yith" + plsProviderName: "yith", + download: null, + basename: "commerce-entitlement/commerce-entitlement.php", + url: "admin.php?page=yith_wcaf_panel&tab=settings&sub_tab=settings-general" } ], "WP_SOLUTION_SERVICE": [ @@ -94,16 +107,22 @@ export const wpSolutionsPromotedPluginsList = [ name: "", plsSlug: "yith-woocommerce-booking", storageKey: "", - plsProviderName: "yith" + plsProviderName: "yith", + download: null, + basename: "", + 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: " ", - plsSlug: " ", - storageKey: " ", - plsProviderName: " " + name: "", + plsSlug: "", + storageKey: "", + plsProviderName: "", + download: null, + basename: "", + url: "post-new.php?post_type=page" }, { title: "SEARCH ENGINE OPTIMIZATION", @@ -112,7 +131,10 @@ export const wpSolutionsPromotedPluginsList = [ name: "Yoast SEO", plsSlug: "wp-seo", storageKey: "", - plsProviderName: "" + 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" }, { title: "SETUP A LOYALTY PROGRAM", @@ -121,7 +143,10 @@ export const wpSolutionsPromotedPluginsList = [ name: "Bookings & Appointments", plsSlug: "yith-woocommerce-points-and-rewards", storageKey: "", - plsProviderName: "yith" + plsProviderName: "yith", + download: null, + basename: "", + url:"admin.php?page=yith_woocommerce_points_and_rewards&tab=points&sub_tab=points-standard" }, ], @@ -133,7 +158,10 @@ export const wpSolutionsPromotedPluginsList = [ name: "Wishlists", plsSlug: "yith-woocommerce-wishlist", storageKey: "", - plsProviderName: "yith" + plsProviderName: "yith", + download: null, + basename: "", + url: "admin.php?page=yith_wcwl_panel&tab=settings&sub_tab=settings-general" }, { title: "ENABLE PRODUCT REVIEWS", @@ -142,7 +170,10 @@ export const wpSolutionsPromotedPluginsList = [ name: "Advanced Reviews", plsSlug: "yith-woocommerce-advanced-reviews", storageKey: "", - plsProviderName: "yith" + plsProviderName: "yith", + download: null, + basename: "", + url: "admin.php?page=yith_ywar_panel" }, { title: "CREATE A SALES CAMPAIGN", @@ -151,7 +182,10 @@ export const wpSolutionsPromotedPluginsList = [ name: "SALES CAMPAIGN", plsSlug: "yith-woocommerce-dynamic-pricing-and-discounts", storageKey: "", - plsProviderName: "yith" + plsProviderName: "yith", + download: null, + basename: "", + url: "edit.php?post_type=ywdpd_discount&yith-plugin-fw-panel-skip-redirect=1" }, { title: "SEARCH ENGINE OPTIMIZATION", @@ -160,7 +194,10 @@ export const wpSolutionsPromotedPluginsList = [ name: "Yoast SEO", plsSlug: "wp-seo", storageKey: "", - plsProviderName: "" + 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" }, ],