From dd9e659a1f6a210778cea7b4e5fcd5015f471e78 Mon Sep 17 00:00:00 2001 From: Ramya krishna Date: Thu, 15 Feb 2024 12:31:42 +0530 Subject: [PATCH 1/6] Remove Creative Mail banner from branded plugin --- build/index.asset.php | 2 +- includes/ECommerce.php | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/build/index.asset.php b/build/index.asset.php index c7469255..21eebebf 100644 --- a/build/index.asset.php +++ b/build/index.asset.php @@ -1 +1 @@ - array('lodash', 'moment', 'react', 'wp-api-fetch', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => 'c3f16f7961a01916c59e'); + array('lodash', 'moment', 'react', 'wp-api-fetch', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => '6307329585bdd0c557f9'); diff --git a/includes/ECommerce.php b/includes/ECommerce.php index bc83259d..601c0e43 100644 --- a/includes/ECommerce.php +++ b/includes/ECommerce.php @@ -91,6 +91,7 @@ public function __construct( Container $container ) { add_action('woocommerce_admin_order_data_after_shipping_address', array( $this, 'display_custom_shipping_fields_in_admin' ), 10, 1 ); add_action( 'before_woocommerce_init', array( $this,'custom_payment_gateways_order')); add_action('before_woocommerce_init', array( $this,'dismiss_woo_payments_cta')); + add_action( 'load-toplevel_page_'. $container->plugin()->id, array( $this, 'disable_creative_mail_banner' ) ); // Handle WonderCart Integrations if ( is_plugin_active( 'wonder-cart/init.php' ) ) { @@ -435,5 +436,12 @@ public function dismiss_woo_payments_cta() { update_option('wcpay_welcome_page_incentives_dismissed', array("wcpay-promo-2023-action-discount")); } } + + public function disable_creative_mail_banner() { + $is_dismissed = get_option( 'ce4wp_ignore_review_notice'); + if (!is_array($is_dismissed) || empty($is_dismissed)) { + update_option('ce4wp_ignore_review_notice', true); + } + } } From 2183355516dab0ae3d5f89c8a8939911d055296a Mon Sep 17 00:00:00 2001 From: Ramya krishna Date: Tue, 20 Feb 2024 14:43:12 +0530 Subject: [PATCH 2/6] Edit site redirect to page editor --- build/index.asset.php | 2 +- src/components/OnboardingScreen.js | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/build/index.asset.php b/build/index.asset.php index c7469255..efba3b15 100644 --- a/build/index.asset.php +++ b/build/index.asset.php @@ -1 +1 @@ - array('lodash', 'moment', 'react', 'wp-api-fetch', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => 'c3f16f7961a01916c59e'); + array('lodash', 'moment', 'react', 'wp-api-fetch', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => '2594edd0d7eff5838e6c'); diff --git a/src/components/OnboardingScreen.js b/src/components/OnboardingScreen.js index dbb70907..cd4c7119 100644 --- a/src/components/OnboardingScreen.js +++ b/src/components/OnboardingScreen.js @@ -1,5 +1,5 @@ import { Alert, Button, Title } from "@newfold/ui-component-library"; -import { useState } from "@wordpress/element"; +import { useEffect, useState } from "@wordpress/element"; import { __ } from "@wordpress/i18n"; import classNames from "classnames"; import { ReactComponent as ComingSoonIllustration } from "../icons/coming-soon.svg"; @@ -9,6 +9,7 @@ import { RuntimeSdk } from "../sdk/runtime"; import { OnboardingList } from "./OnboardingList"; import { Section } from "./Section"; import { SiteStatus } from "./SiteStatus"; +import { WordPressSdk } from "../sdk/wordpress"; const Text = { Pending: { @@ -39,6 +40,7 @@ export function OnboardingScreen({ : Text.Live; const [hovered, setIsHovered] = useState(false); + const [editUrl, setEditUrl] = useState(''); const handleMouseOver = () => { setIsHovered(true); @@ -52,6 +54,17 @@ export function OnboardingScreen({ "wpadminbar" ).style.display = "none"; }; + + useEffect(() => { + WordPressSdk.settings.get().then(res => { + if(res?.page_on_front && res?.show_on_front === 'page'){ + setEditUrl(RuntimeSdk.adminUrl(`post.php?post=${res?.page_on_front}&action=edit`, false)) + }else{ + setEditUrl(RuntimeSdk.adminUrl('site-editor.php?canvas=edit')); + } + }) + }, []) + return ( Date: Wed, 21 Feb 2024 19:27:00 +0530 Subject: [PATCH 3/6] Added ppbutton condition --- src/components/Paypal.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/Paypal.js b/src/components/Paypal.js index d4e4ea4d..540c7090 100644 --- a/src/components/Paypal.js +++ b/src/components/Paypal.js @@ -16,6 +16,9 @@ import { ThirdPartyIntegration } from "./ThirdPartyIntegration"; const Paypal = ({ notify }) => { useEffect(() => { const ppButton = document.querySelector(".yith-btn-paypal"); + if( !ppButton ){ + return; + } window?.PAYPAL?.apps?.Signup?.loadScripts(document, "script"); window?.PAYPAL?.apps?.Signup?.render(); return ()=>{ From 93e300053cc51662bf405c75b9f054d6c3d50858 Mon Sep 17 00:00:00 2001 From: Ramya krishna Date: Thu, 22 Feb 2024 14:49:20 +0530 Subject: [PATCH 4/6] paypal fixes --- src/components/Paypal.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/components/Paypal.js b/src/components/Paypal.js index 540c7090..151cf33e 100644 --- a/src/components/Paypal.js +++ b/src/components/Paypal.js @@ -15,14 +15,21 @@ import { ThirdPartyIntegration } from "./ThirdPartyIntegration"; const Paypal = ({ notify }) => { useEffect(() => { - const ppButton = document.querySelector(".yith-btn-paypal"); - if( !ppButton ){ - return; + const ppButton = document.querySelector( ".yith-btn-paypal" ); + if( ppButton ){ + (function( d, s, id ) { + var js, ref = d.getElementsByTagName( s )[0]; + if ( !d.getElementById( id ) ) { + js = d.createElement( s ); + js.id = id; + js.async = true; + js.src = "https://www.paypal.com/webapps/merchantboarding/js/lib/lightbox/partner.js"; + ref.parentNode.insertBefore( js, ref ); + } + }( document, "script", "paypal-js" )); } - window?.PAYPAL?.apps?.Signup?.loadScripts(document, "script"); - window?.PAYPAL?.apps?.Signup?.render(); return ()=>{ - const panel = document.querySelector('#payment-details'); + const panel = document.querySelector( '#payment-details' ); if( !panel && ppButton ){ ppButton.remove(); } From 2c3b5b36c589e29360dccbb1e6f154f573a05e18 Mon Sep 17 00:00:00 2001 From: Ramya krishna Date: Thu, 22 Feb 2024 16:52:24 +0530 Subject: [PATCH 5/6] fixes --- src/components/YITHPlugins.js | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/components/YITHPlugins.js b/src/components/YITHPlugins.js index 0d12ce9b..c482d387 100644 --- a/src/components/YITHPlugins.js +++ b/src/components/YITHPlugins.js @@ -88,17 +88,20 @@ export function YITHPlugins({ woo, wpModules }) { { refreshInterval: 10 * 1000, isPaused: () => !woo.isActive } ); const [yithProducts, setYithProducts] = useState([]); - useEffect(async () => { - const data = await apiFetch({ - url: NewfoldRuntime.createApiUrl("/newfold-marketplace/v1/marketplace"), - }); - setYithProducts( - data?.products?.data.filter( - (product) => - product.categories?.includes("eCommerce") && - product.categories?.length === 1 - ) - ); + useEffect( () => { + const fecthApi = async () => { + const data = await apiFetch({ + url: NewfoldRuntime.createApiUrl("/newfold-marketplace/v1/marketplace"), + }); + setYithProducts( + data?.products?.data.filter( + (product) => + product.categories?.includes("eCommerce") && + product.categories?.length === 1 + ) + ); + } + fecthApi() }, []); if (!woo.isActive) { return null; From 21dfb6b013a25b00351d86d739ffeefa5c904c92 Mon Sep 17 00:00:00 2001 From: Ramya krishna Date: Thu, 22 Feb 2024 18:51:33 +0530 Subject: [PATCH 6/6] pop up changes --- build/index.asset.php | 2 +- src/components/Paypal.js | 235 ++++++++++++++++++++------------------- 2 files changed, 120 insertions(+), 117 deletions(-) diff --git a/build/index.asset.php b/build/index.asset.php index c7469255..4d78b6bd 100644 --- a/build/index.asset.php +++ b/build/index.asset.php @@ -1 +1 @@ - array('lodash', 'moment', 'react', 'wp-api-fetch', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => 'c3f16f7961a01916c59e'); + array('lodash', 'moment', 'react', 'wp-api-fetch', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => '64d8ebf708a365ec7d39'); diff --git a/src/components/Paypal.js b/src/components/Paypal.js index 151cf33e..c948e7bc 100644 --- a/src/components/Paypal.js +++ b/src/components/Paypal.js @@ -27,7 +27,10 @@ const Paypal = ({ notify }) => { ref.parentNode.insertBefore( js, ref ); } }( document, "script", "paypal-js" )); + window?.PAYPAL?.apps?.Signup?.loadScripts( document, "script" ); + window?.PAYPAL?.apps?.Signup?.render(); } + return ()=>{ const panel = document.querySelector( '#payment-details' ); if( !panel && ppButton ){ @@ -36,126 +39,126 @@ const Paypal = ({ notify }) => { }; }); return ( - - {({ integrationStatus, onConnect, isInstalling }) => { - const isSetupComplete = integrationStatus?.complete; - const environment = integrationStatus?.details?.environment; - return ( -
-
- - {isInstalling ? ( - - ) : isSetupComplete ? ( - - ) : typeof yith_ppwc_login !== "undefined" && - !parseInt(yith_ppwc_login?.liveConnected) ? ( - - {__("Connect", "wp-module-ecommerce")} - - ) : ( - - )} -
- {isSetupComplete && environment && ( -
- {__("Environment:", "wp-module-ecommerce")} - - {environment} - -
- )} - {!isSetupComplete && ( -
- - {__("Provides flexible checkout options", "wp-module-ecommerce")} - -
    -
  • {__("PayPal Buy Now Pay Later", "wp-module-ecommerce")}
  • -
  • {__("White-Labeling", "wp-module-ecommerce")}
  • -
  • - {__( - "Country-specific payment methods", - "wp-module-ecommerce" + + {({ integrationStatus, onConnect, isInstalling }) => { + const isSetupComplete = integrationStatus?.complete; + const environment = integrationStatus?.details?.environment; + return ( +
    +
    -
- - {__( - " Supports many popular payment methods", - "wp-module-ecommerce" + > + <PaypalBrand /> + {isInstalling ? ( + <Button + variant="secondary" + isLoading + className={classNames( + "max-[359px]:nfd-my-2", + "min-[360px]:nfd-m-0" + )} + > + {__("Installing...", "wp-module-ecommerce")} + </Button> + ) : isSetupComplete ? ( + <Button + variant="secondary" + as="a" + href={integrationStatus?.integration?.plugin?.url} + className={classNames( + "max-[359px]:nfd-my-2", + "min-[360px]:nfd-m-0" + )} + > + {__("Manage", "wp-module-ecommerce")} + </Button> + ) : typeof yith_ppwc_login !== "undefined" && + !parseInt(yith_ppwc_login?.liveConnected) ? ( + <Link + href={yith_ppwc_login.loginURL} + variant="primary" + className="nfd-button nfd-button--primary yith-btn-paypal nfd-text-white" + target="_blank" + data-paypal-onboard-complete="onboardedCallback" + data-paypal-button="PPLtBlue" + > + {__("Connect", "wp-module-ecommerce")} + </Link> + ) : ( + <Button + onClick={onConnect} + className={classNames( + "max-[359px]:nfd-my-2", + "min-[360px]:nfd-m-0" + )} + > + {__("Connect", "wp-module-ecommerce")} + </Button> )} - -
- - - - - - - -
+ {isSetupComplete && environment && ( +
+ {__("Environment:", "wp-module-ecommerce")} + + {environment} + +
+ )} + {!isSetupComplete && ( +
+ + {__("Provides flexible checkout options", "wp-module-ecommerce")} + +
    +
  • {__("PayPal Buy Now Pay Later", "wp-module-ecommerce")}
  • +
  • {__("White-Labeling", "wp-module-ecommerce")}
  • +
  • + {__( + "Country-specific payment methods", + "wp-module-ecommerce" + )} +
  • +
+ + {__( + " Supports many popular payment methods", + "wp-module-ecommerce" + )} + +
+ + + + + + + + +
+
+ )}
- )} -
- ); - }} -
+ ); + }} + ); }; export default Paypal;