From ad5af164462b6044f2a4ef33942d5fb1994dd43b Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Tue, 30 May 2023 13:57:21 +0200 Subject: [PATCH 1/2] Update wording in buttons previews PCP-1713 --- .../Settings/Fields/pay-later-tab-fields.php | 18 ++++++++++-------- .../Fields/paypal-smart-button-fields.php | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/modules/ppcp-wc-gateway/src/Settings/Fields/pay-later-tab-fields.php b/modules/ppcp-wc-gateway/src/Settings/Fields/pay-later-tab-fields.php index fab61ca83..b3af60d5b 100644 --- a/modules/ppcp-wc-gateway/src/Settings/Fields/pay-later-tab-fields.php +++ b/modules/ppcp-wc-gateway/src/Settings/Fields/pay-later-tab-fields.php @@ -33,11 +33,13 @@ return function ( ContainerInterface $container, array $fields ): array { $selected_country = $container->get( 'api.shop.country' ); $default_messaging_flex_color = $selected_country === 'US' ? 'white-no-border' : 'white'; - - $render_preview_element = function ( string $id, string $type ): string { + $button_message = __( 'Pay Later Button Preview', 'woocommerce-paypal-payments' ); + $messaging_message = __( 'Pay Later Messaging Preview', 'woocommerce-paypal-payments' ); + $default_message = __( 'Preview', 'woocommerce-paypal-payments' ); + $render_preview_element = function ( string $id, string $type, string $message ): string { return '
-

' . __( 'Preview', 'woocommerce-paypal-payments' ) . '

+

' . $message . '

'; }; @@ -82,7 +84,7 @@ return function ( ContainerInterface $container, array $fields ): array { ), 'pay_later_button_preview' => array( 'type' => 'ppcp-text', - 'text' => $render_preview_element( 'ppcpPayLaterButtonPreview', 'button' ), + 'text' => $render_preview_element( 'ppcpPayLaterButtonPreview', 'button', $button_message ), 'screens' => array( State::STATE_ONBOARDED ), 'requirements' => array( 'messages' ), 'gateway' => Settings::PAY_LATER_TAB_ID, @@ -245,7 +247,7 @@ return function ( ContainerInterface $container, array $fields ): array { ), 'pay_later_general_message_preview' => array( 'type' => 'ppcp-text', - 'text' => $render_preview_element( 'ppcpGeneralMessagePreview', 'message' ), + 'text' => $render_preview_element( 'ppcpGeneralMessagePreview', 'message', $messaging_message ), 'screens' => array( State::STATE_ONBOARDED ), 'requirements' => array( 'messages' ), 'gateway' => Settings::PAY_LATER_TAB_ID, @@ -369,7 +371,7 @@ return function ( ContainerInterface $container, array $fields ): array { ), 'pay_later_product_message_preview' => array( 'type' => 'ppcp-text', - 'text' => $render_preview_element( 'ppcpProductMessagePreview', 'message' ), + 'text' => $render_preview_element( 'ppcpProductMessagePreview', 'message', $default_message ), 'screens' => array( State::STATE_ONBOARDED ), 'requirements' => array( 'messages' ), 'gateway' => Settings::PAY_LATER_TAB_ID, @@ -493,7 +495,7 @@ return function ( ContainerInterface $container, array $fields ): array { ), 'pay_later_cart_message_preview' => array( 'type' => 'ppcp-text', - 'text' => $render_preview_element( 'ppcpCartMessagePreview', 'message' ), + 'text' => $render_preview_element( 'ppcpCartMessagePreview', 'message', $default_message ), 'screens' => array( State::STATE_ONBOARDED ), 'requirements' => array( 'messages' ), 'gateway' => Settings::PAY_LATER_TAB_ID, @@ -617,7 +619,7 @@ return function ( ContainerInterface $container, array $fields ): array { ), 'pay_later_checkout_message_preview' => array( 'type' => 'ppcp-text', - 'text' => $render_preview_element( 'ppcpCheckoutMessagePreview', 'message' ), + 'text' => $render_preview_element( 'ppcpCheckoutMessagePreview', 'message', $default_message ), 'screens' => array( State::STATE_ONBOARDED ), 'requirements' => array( 'messages' ), 'gateway' => Settings::PAY_LATER_TAB_ID, diff --git a/modules/ppcp-wc-gateway/src/Settings/Fields/paypal-smart-button-fields.php b/modules/ppcp-wc-gateway/src/Settings/Fields/paypal-smart-button-fields.php index f064b1e7b..82fa1d5f3 100644 --- a/modules/ppcp-wc-gateway/src/Settings/Fields/paypal-smart-button-fields.php +++ b/modules/ppcp-wc-gateway/src/Settings/Fields/paypal-smart-button-fields.php @@ -31,7 +31,7 @@ return function ( ContainerInterface $container, array $fields ): array { $render_preview_element = function ( string $id ): string { return '
-

' . __( 'Preview', 'woocommerce-paypal-payments' ) . '

+

' . __( 'Button Styling Preview', 'woocommerce-paypal-payments' ) . '

'; }; From f31fbb89160038c4c096db6d7f6e2dc72edc2e3a Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Sun, 11 Jun 2023 11:52:15 +0200 Subject: [PATCH 2/2] Remove default preview message --- .../src/Settings/Fields/pay-later-tab-fields.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/modules/ppcp-wc-gateway/src/Settings/Fields/pay-later-tab-fields.php b/modules/ppcp-wc-gateway/src/Settings/Fields/pay-later-tab-fields.php index b3af60d5b..f87a7285e 100644 --- a/modules/ppcp-wc-gateway/src/Settings/Fields/pay-later-tab-fields.php +++ b/modules/ppcp-wc-gateway/src/Settings/Fields/pay-later-tab-fields.php @@ -25,7 +25,7 @@ return function ( ContainerInterface $container, array $fields ): array { $settings = $container->get( 'wcgateway.settings' ); assert( $settings instanceof Settings ); - $vault_enabled = $settings->has( 'vault_enabled' ) && $settings->get( 'vault_enabled' ); + $vault_enabled = false;//$settings->has( 'vault_enabled' ) && $settings->get( 'vault_enabled' ); $pay_later_messaging_enabled_label = $vault_enabled ? __( "You have PayPal vaulting enabled, that's why Pay Later options are unavailable now. You cannot use both features at the same time.", 'woocommerce-paypal-payments' ) @@ -35,7 +35,6 @@ return function ( ContainerInterface $container, array $fields ): array { $default_messaging_flex_color = $selected_country === 'US' ? 'white-no-border' : 'white'; $button_message = __( 'Pay Later Button Preview', 'woocommerce-paypal-payments' ); $messaging_message = __( 'Pay Later Messaging Preview', 'woocommerce-paypal-payments' ); - $default_message = __( 'Preview', 'woocommerce-paypal-payments' ); $render_preview_element = function ( string $id, string $type, string $message ): string { return '
@@ -371,7 +370,7 @@ return function ( ContainerInterface $container, array $fields ): array { ), 'pay_later_product_message_preview' => array( 'type' => 'ppcp-text', - 'text' => $render_preview_element( 'ppcpProductMessagePreview', 'message', $default_message ), + 'text' => $render_preview_element( 'ppcpProductMessagePreview', 'message', $messaging_message ), 'screens' => array( State::STATE_ONBOARDED ), 'requirements' => array( 'messages' ), 'gateway' => Settings::PAY_LATER_TAB_ID, @@ -495,7 +494,7 @@ return function ( ContainerInterface $container, array $fields ): array { ), 'pay_later_cart_message_preview' => array( 'type' => 'ppcp-text', - 'text' => $render_preview_element( 'ppcpCartMessagePreview', 'message', $default_message ), + 'text' => $render_preview_element( 'ppcpCartMessagePreview', 'message', $messaging_message ), 'screens' => array( State::STATE_ONBOARDED ), 'requirements' => array( 'messages' ), 'gateway' => Settings::PAY_LATER_TAB_ID, @@ -619,7 +618,7 @@ return function ( ContainerInterface $container, array $fields ): array { ), 'pay_later_checkout_message_preview' => array( 'type' => 'ppcp-text', - 'text' => $render_preview_element( 'ppcpCheckoutMessagePreview', 'message', $default_message ), + 'text' => $render_preview_element( 'ppcpCheckoutMessagePreview', 'message', $messaging_message ), 'screens' => array( State::STATE_ONBOARDED ), 'requirements' => array( 'messages' ), 'gateway' => Settings::PAY_LATER_TAB_ID,