Skip to content

Commit

Permalink
Clean up old settings code related to the grouped settings flag. (#2776)
Browse files Browse the repository at this point in the history
  • Loading branch information
brettshumaker authored Aug 20, 2021
1 parent 487284e commit f4f9491
Show file tree
Hide file tree
Showing 14 changed files with 44 additions and 718 deletions.
61 changes: 0 additions & 61 deletions client/payment-request/blocks/branded-buttons.js

This file was deleted.

21 changes: 0 additions & 21 deletions client/payment-request/blocks/custom-button.js

This file was deleted.

38 changes: 1 addition & 37 deletions client/payment-request/blocks/payment-request-express.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import { Elements, PaymentRequestButtonElement } from '@stripe/react-stripe-js';
* Internal dependencies
*/
import { useInitialization } from './use-initialization';
import { GooglePayButton } from './branded-buttons';
import { CustomButton } from './custom-button';
import { getPaymentRequestData, shouldUseGooglePayBrand } from '../utils';
import { getPaymentRequestData } from '../utils';

/**
* PaymentRequestExpressComponent
Expand Down Expand Up @@ -42,9 +40,6 @@ const PaymentRequestExpressComponent = ( {
} );

const { type, theme, height } = getPaymentRequestData( 'button' );
const isBranded = getPaymentRequestData( 'button' )?.is_branded;
const brandedType = getPaymentRequestData( 'button' )?.branded_type;
const isCustom = getPaymentRequestData( 'button' )?.is_custom;

const paymentRequestButtonStyle = {
paymentRequestButton: {
Expand All @@ -58,37 +53,6 @@ const PaymentRequestExpressComponent = ( {
return null;
}

// This can be removed once the `is_grouped_settings` flag returns `true` and the code is cleaned up.
if ( isCustom ) {
return (
<CustomButton
onClick={ ( evt ) => {
onButtonClick( evt, paymentRequest );
} }
/>
);
}

// This can be removed once the `is_grouped_settings` flag returns `true` and the code is cleaned up.
if ( isBranded && shouldUseGooglePayBrand() ) {
return (
<GooglePayButton
onClick={ ( evt ) => {
onButtonClick( evt, paymentRequest );
} }
/>
);
}

// This can be removed once the `is_grouped_settings` flag returns `true` and the code is cleaned up.
if ( isBranded ) {
// Not implemented branded buttons default to Stripe's button.
// Apple Pay buttons can also fall back to Stripe's button, as it's already branded.
// Set button type to default or buy, depending on branded type, to avoid issues with Stripe.
paymentRequestButtonStyle.paymentRequestButton.type =
'long' === brandedType ? 'buy' : 'default';
}

return (
<PaymentRequestButtonElement
onClick={ onButtonClick }
Expand Down
Loading

0 comments on commit f4f9491

Please sign in to comment.