Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Documents API regex to allow documents with dashes in name to be viewed #9084

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog/9001-tokenized-prb-order-origin
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fix
Comment: Bug fix for PRB feature behind a flag.


4 changes: 4 additions & 0 deletions changelog/9037-giropay-deprecation
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: update

Deprecate Giropay.
4 changes: 4 additions & 0 deletions changelog/add-9045-split-ece-pms-registration-for-blocks
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: add

Add independent ECE instances in WC Blocks.
4 changes: 4 additions & 0 deletions changelog/as-8871-ece-on-supported-product-types
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: add

Add ECE support for multiple product types.
5 changes: 5 additions & 0 deletions changelog/fix-9071-transaction-search-tag-close-button
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fix
Comment: Restore the 'remove tag' function on the last search tag appearing on the transactions report search box.


4 changes: 4 additions & 0 deletions changelog/fix-documents-api-regex
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Fix Documents API regex to allow documents with dashes in name to be viewed.
8 changes: 6 additions & 2 deletions client/checkout/blocks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ import PaymentMethodLabel from './payment-method-label';
import request from '../utils/request';
import enqueueFraudScripts from 'fraud-scripts';
import paymentRequestPaymentMethod from '../../payment-request/blocks';
import expressCheckoutElementPaymentMethod from '../../express-checkout/blocks';
import {
expressCheckoutElementApplePay,
expressCheckoutElementGooglePay,
} from '../../express-checkout/blocks';
import tokenizedCartPaymentRequestPaymentMethod from '../../tokenized-payment-request/blocks';

import {
Expand Down Expand Up @@ -161,7 +164,8 @@ if ( getUPEConfig( 'isTokenizedCartPrbEnabled' ) ) {
tokenizedCartPaymentRequestPaymentMethod( api )
);
} else if ( getUPEConfig( 'isExpressCheckoutElementEnabled' ) ) {
registerExpressPaymentMethod( expressCheckoutElementPaymentMethod( api ) );
registerExpressPaymentMethod( expressCheckoutElementApplePay( api ) );
registerExpressPaymentMethod( expressCheckoutElementGooglePay( api ) );
} else {
registerExpressPaymentMethod( paymentRequestPaymentMethod( api ) );
}
Expand Down
7 changes: 0 additions & 7 deletions client/express-checkout/blocks/apple-pay-preview.js

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,38 @@
* External dependencies
*/
import { ExpressCheckoutElement } from '@stripe/react-stripe-js';
/**
* Internal dependencies
*/
import {
shippingAddressChangeHandler,
shippingRateChangeHandler,
} from '../../event-handlers';
import { useExpressCheckout } from '../hooks/use-express-checkout';
import { PAYMENT_METHOD_NAME_EXPRESS_CHECKOUT_ELEMENT } from 'wcpay/checkout/constants';

const getPaymentMethodsOverride = ( enabledPaymentMethod ) => {
const allDisabled = {
amazonPay: 'never',
applePay: 'never',
googlePay: 'never',
link: 'never',
paypal: 'never',
};

const enabledParam = [ 'applePay', 'googlePay' ].includes(
enabledPaymentMethod
)
? 'always'
: 'auto';

return {
paymentMethods: {
...allDisabled,
[ enabledPaymentMethod ]: enabledParam,
},
};
};

/**
* ExpressCheckout express payment method component.
Expand All @@ -22,6 +49,7 @@ const ExpressCheckoutComponent = ( {
setExpressPaymentError,
onClick,
onClose,
expressPaymentMethod = '',
} ) => {
const {
buttonOptions,
Expand All @@ -45,12 +73,33 @@ const ExpressCheckoutComponent = ( {
const onShippingRateChange = ( event ) =>
shippingRateChangeHandler( api, event, elements );

const onElementsReady = ( event ) => {
const paymentMethodContainer = document.getElementById(
`express-payment-method-${ PAYMENT_METHOD_NAME_EXPRESS_CHECKOUT_ELEMENT }_${ expressPaymentMethod }`
);

const availablePaymentMethods = event.availablePaymentMethods || {};

if (
paymentMethodContainer &&
! availablePaymentMethods[ expressPaymentMethod ]
) {
paymentMethodContainer.style.display = 'none';
}

// Any actions that WooPayments needs to perform.
onReady( event );
};

return (
<ExpressCheckoutElement
options={ buttonOptions }
options={ {
...buttonOptions,
...getPaymentMethodsOverride( expressPaymentMethod ),
} }
onClick={ onButtonClick }
onConfirm={ onConfirm }
onReady={ onReady }
onReady={ onElementsReady }
onCancel={ onCancel }
onShippingAddressChange={ onShippingAddressChange }
onShippingRateChange={ onShippingRateChange }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
/**
* External dependencies
*/
import { useMemo } from 'react';
import { Elements } from '@stripe/react-stripe-js';
import { getExpressCheckoutButtonAppearance } from 'wcpay/express-checkout/utils';

/**
* Internal dependencies
*/
import ExpressCheckoutComponent from './express-checkout-component';
import { getExpressCheckoutButtonAppearance } from 'wcpay/express-checkout/utils';

const ExpressCheckoutContainer = ( props ) => {
const { stripe, billing } = props;
const { api, billing } = props;

const stripePromise = useMemo( () => {
return api.loadStripe();
}, [ api ] );

const options = {
mode: 'payment',
Expand All @@ -22,7 +27,7 @@ const ExpressCheckoutContainer = ( props ) => {

return (
<div style={ { minHeight: '50px' } }>
<Elements stripe={ stripe } options={ options }>
<Elements stripe={ stripePromise } options={ options }>
<ExpressCheckoutComponent { ...props } />
</Elements>
</div>
Expand Down
Loading
Loading