Skip to content

Commit 435162b

Browse files
committed
fix: improve Apple/Google Pay title hiding and standardize settings field order
- Fix Apple/Google Pay title hiding in block checkout by using moneiData.title instead of hardcoded 'Apple Pay' / 'Google Pay' text - Add description field to Apple/Google Pay settings - Standardize field order across all payment method settings: 1. enabled 2. description 3. payment_style 4. title 5. hide_title 6. hide_logo 7. method-specific fields
1 parent af7e120 commit 435162b

File tree

4 files changed

+35
-28
lines changed

4 files changed

+35
-28
lines changed

assets/js/components/monei-apple-google-component.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ export const createAppleGoogleLabel = ( moneiData ) => {
1616
let logo = googleEnabled ? moneiData.logo_google : false;
1717
logo = isApple && appleEnabled ? moneiData.logo_apple : logo;
1818

19-
const title = isApple && appleEnabled ? 'Apple Pay' : 'Google Pay';
19+
const title = moneiData.title || '';
2020
const shouldShowLogo =
2121
( isApple && moneiData?.logo_apple ) ||
2222
( ! isApple && moneiData?.logo_google );
2323

2424
return (
2525
<div className="monei-label-container">
26-
<span className="monei-text">{ title }</span>
26+
{ title && <span className="monei-text">{ title }</span> }
2727
{ shouldShowLogo && (
2828
<div className="monei-logo">
2929
<img src={ logo } alt="" />

includes/admin/monei-apple-google-settings.php

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,47 +21,54 @@
2121
return apply_filters(
2222
'wc_monei_apple_google_settings',
2323
array(
24-
'top_link' => array(
24+
'top_link' => array(
2525
'title' => '',
2626
'type' => 'title',
2727
'description' => '<a href="' . $settings_link . '" class="button">' . __( 'Go to MONEI API Key Settings', 'monei' ) . '</a>',
2828
'id' => 'cc_monei_top_link',
2929
),
30-
'enabled' => array(
30+
'enabled' => array(
3131
'title' => __( 'Enable/Disable', 'monei' ),
3232
'type' => 'checkbox',
3333
'label' => __( 'Enable Apple Pay and Google Pay by MONEI', 'monei' ),
3434
'default' => 'no',
3535
),
36-
'title' => array(
36+
'description' => array(
37+
'title' => __( 'Description', 'monei' ),
38+
'type' => 'textarea',
39+
'description' => __( 'Payment method description shown to customers during checkout.', 'monei' ),
40+
'default' => __( 'Pay with Apple Pay or Google Pay. Powered by MONEI.', 'monei' ),
41+
'desc_tip' => true,
42+
),
43+
'payment_request_style' => array(
44+
'title' => __( 'Apple Pay / Google Pay Style', 'monei' ),
45+
'type' => 'textarea',
46+
'description' => __( 'Configure in JSON format the style of the Apple Pay / Google Pay component. Documentation: ', 'monei' ) . '<a href="https://docs.monei.com/docs/monei-js/reference/#paymentrequest-options" target="_blank">MONEI Payment Request Style</a>',
47+
'default' => '{\"height\": \"42\"}',
48+
'css' => 'min-height: 80px;',
49+
),
50+
'title' => array(
3751
'title' => __( 'Title', 'monei' ),
3852
'type' => 'text',
3953
'description' => __( 'The payment method title a user sees during checkout.', 'monei' ),
4054
'default' => __( 'Apple Pay / Google Pay', 'monei' ),
4155
'desc_tip' => true,
4256
),
43-
'hide_title' => array(
57+
'hide_title' => array(
4458
'title' => __( 'Hide Title', 'monei' ),
4559
'type' => 'checkbox',
4660
'label' => __( 'Hide payment method title', 'monei' ),
4761
'default' => 'no',
4862
'description' => __( 'Hide payment method title in the checkout, showing only the logo.', 'monei' ),
4963
'desc_tip' => true,
5064
),
51-
'hide_logo' => array(
65+
'hide_logo' => array(
5266
'title' => __( 'Hide Logo', 'monei' ),
5367
'type' => 'checkbox',
5468
'label' => __( 'Hide payment method logo', 'monei' ),
5569
'default' => 'no',
5670
'description' => __( 'Hide payment method logo in the checkout.', 'monei' ),
5771
'desc_tip' => true,
5872
),
59-
'payment_request_style' => array(
60-
'title' => __( 'Apple Pay / Google Pay Style', 'monei' ),
61-
'type' => 'textarea',
62-
'description' => __( 'Configure in JSON format the style of the Apple Pay / Google Pay component. Documentation: ', 'monei' ) . '<a href="https://docs.monei.com/docs/monei-js/reference/#paymentrequest-options" target="_blank">MONEI Payment Request Style</a>',
63-
'default' => '{"height": "42"}',
64-
'css' => 'min-height: 80px;',
65-
),
6673
)
6774
);

includes/admin/monei-mbway-settings.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@
3333
'label' => __( 'Enable MBWay by MONEI', 'monei' ),
3434
'default' => 'no',
3535
),
36+
'description' => array(
37+
'title' => __( 'Description', 'monei' ),
38+
'type' => 'textarea',
39+
'description' => __( 'Payment method description shown to customers during checkout.', 'monei' ),
40+
'default' => __( 'Pay with MBWay. Powered by MONEI.', 'monei' ),
41+
'class' => 'monei-mbway-description-field',
42+
),
3643
'title' => array(
3744
'title' => __( 'Title', 'monei' ),
3845
'type' => 'text',
@@ -48,13 +55,6 @@
4855
'description' => __( 'Hide payment method title in the checkout, showing only the logo.', 'monei' ),
4956
'desc_tip' => true,
5057
),
51-
'description' => array(
52-
'title' => __( 'Description', 'monei' ),
53-
'type' => 'textarea',
54-
'description' => __( 'Payment method description shown to customers during checkout.', 'monei' ),
55-
'default' => __( 'Pay with MBWay. Powered by MONEI.', 'monei' ),
56-
'class' => 'monei-mbway-description-field',
57-
),
5858
'hide_logo' => array(
5959
'title' => __( 'Hide Logo', 'monei' ),
6060
'type' => 'checkbox',

includes/admin/monei-multibanco-settings.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@
3333
'label' => __( 'Enable Multibanco by MONEI', 'monei' ),
3434
'default' => 'no',
3535
),
36+
'description' => array(
37+
'title' => __( 'Description', 'monei' ),
38+
'type' => 'textarea',
39+
'description' => __( 'Payment method description shown to customers during checkout.', 'monei' ),
40+
'default' => __( 'Pay with Multibanco. Powered by MONEI.', 'monei' ),
41+
'class' => 'monei-multibanco-description-field',
42+
),
3643
'title' => array(
3744
'title' => __( 'Title', 'monei' ),
3845
'type' => 'text',
@@ -48,13 +55,6 @@
4855
'description' => __( 'Hide payment method title in the checkout, showing only the logo.', 'monei' ),
4956
'desc_tip' => true,
5057
),
51-
'description' => array(
52-
'title' => __( 'Description', 'monei' ),
53-
'type' => 'textarea',
54-
'description' => __( 'Payment method description shown to customers during checkout.', 'monei' ),
55-
'default' => __( 'Pay with Multibanco. Powered by MONEI.', 'monei' ),
56-
'class' => 'monei-multibanco-description-field',
57-
),
5858
'hide_logo' => array(
5959
'title' => __( 'Hide Logo', 'monei' ),
6060
'type' => 'checkbox',

0 commit comments

Comments
 (0)