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;