Rename `wc/store/payment-methods` to `wc/store/payment` (https://github.com/woocommerce/woocommerce-blocks/pull/7267)

* Rename wc/store/payment-methods to wc/store/payment

* Rename folder to payment

Co-authored-by: Alex Florisca <alex.florisca@automattic.com>
This commit is contained in:
Thomas Roberts 2022-10-05 05:01:56 -07:00 committed by GitHub
parent eace72a31f
commit df3b785244
26 changed files with 15 additions and 14 deletions

View File

@ -15,7 +15,7 @@ import {
import { import {
PAYMENT_METHOD_DATA_STORE_KEY, PAYMENT_METHOD_DATA_STORE_KEY,
config as paymentDataStoreConfig, config as paymentDataStoreConfig,
} from '../../../../data/payment-methods'; } from '../../../../data/payment';
jest.mock( '../../providers/cart-checkout/checkout-events', () => { jest.mock( '../../providers/cart-checkout/checkout-events', () => {
const original = jest.requireActual( const original = jest.requireActual(

View File

@ -1,7 +1,7 @@
/** /**
* Internal dependencies * Internal dependencies
*/ */
import type { PaymentMethodDataContextType } from '../../../../../data/payment-methods/types'; import type { PaymentMethodDataContextType } from '../../../../../data/payment/types';
export enum STATUS { export enum STATUS {
PRISTINE = 'pristine', PRISTINE = 'pristine',

View File

@ -18,7 +18,7 @@ import {
/** /**
* Internal dependencies * Internal dependencies
*/ */
import type { PaymentMethodEventsContextType } from '../../../../../data/payment-methods/types'; import type { PaymentMethodEventsContextType } from '../../../../../data/payment/types';
import { DEFAULT_PAYMENT_METHOD_DATA } from './constants'; import { DEFAULT_PAYMENT_METHOD_DATA } from './constants';
import { useEventEmitters, reducer as emitReducer } from './event-emit'; import { useEventEmitters, reducer as emitReducer } from './event-emit';
import { useCustomerData } from '../../../hooks/use-customer-data'; import { useCustomerData } from '../../../hooks/use-customer-data';

View File

@ -19,7 +19,7 @@ import { default as PaymentMethodConfig } from './payment-method-config';
import { default as ExpressPaymentMethodConfig } from './express-payment-method-config'; import { default as ExpressPaymentMethodConfig } from './express-payment-method-config';
import { canMakePaymentExtensionsCallbacks } from './extensions-config'; import { canMakePaymentExtensionsCallbacks } from './extensions-config';
import { STORE_KEY as PAYMENT_METHOD_DATA_STORE_KEY } from '../../data/payment-methods/constants'; // Full path here because otherwise there's a circular dependency. import { STORE_KEY as PAYMENT_METHOD_DATA_STORE_KEY } from '../../data/payment/constants'; // Full path here because otherwise there's a circular dependency.
type LegacyRegisterPaymentMethodFunction = ( config: unknown ) => unknown; type LegacyRegisterPaymentMethodFunction = ( config: unknown ) => unknown;
type LegacyRegisterExpressPaymentMethodFunction = ( type LegacyRegisterExpressPaymentMethodFunction = (

View File

@ -20,7 +20,7 @@ import { useDispatch, useSelect } from '@wordpress/data';
* Internal dependencies * Internal dependencies
*/ */
import PaymentMethodErrorBoundary from './payment-method-error-boundary'; import PaymentMethodErrorBoundary from './payment-method-error-boundary';
import { STORE_KEY as PAYMENT_METHOD_DATA_STORE_KEY } from '../../../data/payment-methods/constants'; import { STORE_KEY as PAYMENT_METHOD_DATA_STORE_KEY } from '../../../data/payment/constants';
const ExpressPaymentMethods = () => { const ExpressPaymentMethods = () => {
const { isEditor } = useEditorContext(); const { isEditor } = useEditorContext();

View File

@ -17,7 +17,7 @@ import { getPaymentMethods } from '@woocommerce/blocks-registry';
*/ */
import PaymentMethodCard from './payment-method-card'; import PaymentMethodCard from './payment-method-card';
import { noticeContexts } from '../../../base/context/event-emit'; import { noticeContexts } from '../../../base/context/event-emit';
import { STORE_KEY as PAYMENT_METHOD_DATA_STORE_KEY } from '../../../data/payment-methods/constants'; import { STORE_KEY as PAYMENT_METHOD_DATA_STORE_KEY } from '../../../data/payment/constants';
/** /**
* Component used to render all non-saved payment method options. * Component used to render all non-saved payment method options.

View File

@ -20,7 +20,7 @@ import { controls as sharedControls } from '../shared-controls';
import { controls } from './controls'; import { controls } from './controls';
import type { SelectFromMap, DispatchFromMap } from '../mapped-types'; import type { SelectFromMap, DispatchFromMap } from '../mapped-types';
import { pushChanges } from './push-changes'; import { pushChanges } from './push-changes';
import { checkPaymentMethodsCanPay } from '../payment-methods/check-payment-methods'; import { checkPaymentMethodsCanPay } from '../payment/check-payment-methods';
const registeredStore = registerStore< State >( STORE_KEY, { const registeredStore = registerStore< State >( STORE_KEY, {
reducer, reducer,
@ -49,7 +49,7 @@ const unsubscribeInitializePaymentMethodDataStore = registeredStore.subscribe(
wpDataSelect( STORE_KEY ).hasFinishedResolution( 'getCartTotals' ); wpDataSelect( STORE_KEY ).hasFinishedResolution( 'getCartTotals' );
if ( cartLoaded ) { if ( cartLoaded ) {
wpDataDispatch( wpDataDispatch(
'wc/store/payment-methods' 'wc/store/payment'
).__internalInitializePaymentMethodDataStore(); ).__internalInitializePaymentMethodDataStore();
unsubscribeInitializePaymentMethodDataStore(); unsubscribeInitializePaymentMethodDataStore();
} }

View File

@ -17,7 +17,7 @@ import * as selectors from './selectors';
import * as actions from './actions'; import * as actions from './actions';
import reducer from './reducers'; import reducer from './reducers';
import { DispatchFromMap, SelectFromMap } from '../mapped-types'; import { DispatchFromMap, SelectFromMap } from '../mapped-types';
import { checkPaymentMethodsCanPay } from '../payment-methods/check-payment-methods'; import { checkPaymentMethodsCanPay } from '../payment/check-payment-methods';
export const config = { export const config = {
reducer, reducer,
@ -43,8 +43,9 @@ if ( isEditor ) {
const unsubscribeInitializePaymentMethodDataStore = subscribe( async () => { const unsubscribeInitializePaymentMethodDataStore = subscribe( async () => {
wpDataDispatch( wpDataDispatch(
'wc/store/payment-methods' 'wc/store/payment'
).__internalInitializePaymentMethodDataStore(); ).__internalInitializePaymentMethodDataStore();
unsubscribeInitializePaymentMethodDataStore(); unsubscribeInitializePaymentMethodDataStore();
} ); } );
} }

View File

@ -10,7 +10,7 @@ export { SCHEMA_STORE_KEY } from './schema';
export { COLLECTIONS_STORE_KEY } from './collections'; export { COLLECTIONS_STORE_KEY } from './collections';
export { CART_STORE_KEY } from './cart'; export { CART_STORE_KEY } from './cart';
export { CHECKOUT_STORE_KEY } from './checkout'; export { CHECKOUT_STORE_KEY } from './checkout';
export { PAYMENT_METHOD_DATA_STORE_KEY } from './payment-methods'; export { PAYMENT_METHOD_DATA_STORE_KEY } from './payment';
export { VALIDATION_STORE_KEY } from './validation'; export { VALIDATION_STORE_KEY } from './validation';
export { QUERY_STATE_STORE_KEY } from './query-state'; export { QUERY_STATE_STORE_KEY } from './query-state';
export * from './constants'; export * from './constants';

View File

@ -1 +0,0 @@
export const STORE_KEY = 'wc/store/payment-methods';

View File

@ -20,7 +20,7 @@ import {
* Internal dependencies * Internal dependencies
*/ */
import { STORE_KEY as CART_STORE_KEY } from '../cart/constants'; import { STORE_KEY as CART_STORE_KEY } from '../cart/constants';
import { STORE_KEY as PAYMENT_METHOD_DATA_STORE_KEY } from '../payment-methods/constants'; import { STORE_KEY as PAYMENT_METHOD_DATA_STORE_KEY } from './constants';
import { noticeContexts } from '../../base/context/event-emit'; import { noticeContexts } from '../../base/context/event-emit';
export const checkPaymentMethodsCanPay = async ( express = false ) => { export const checkPaymentMethodsCanPay = async ( express = false ) => {

View File

@ -0,0 +1 @@
export const STORE_KEY = 'wc/store/payment';

View File

@ -24,7 +24,7 @@ import {
CheckoutExpressPayment, CheckoutExpressPayment,
SavedPaymentMethodOptions, SavedPaymentMethodOptions,
} from '../../../blocks/cart-checkout-shared/payment-methods'; } from '../../../blocks/cart-checkout-shared/payment-methods';
import { checkPaymentMethodsCanPay } from '../../payment-methods/check-payment-methods'; import { checkPaymentMethodsCanPay } from '../check-payment-methods';
import { defaultCartState } from '../../cart/default-state'; import { defaultCartState } from '../../cart/default-state';
const originalSelect = jest.requireActual( '@wordpress/data' ).select; const originalSelect = jest.requireActual( '@wordpress/data' ).select;