File "use-payment-methods.js"

Full Path: /home/vantageo/public_html/cache/cache/cache/.wp-cli/wp-content/plugins/woocommerce/packages/woocommerce-blocks/assets/js/base/context/hooks/payment-methods/use-payment-methods.js
File size: 670 bytes
MIME-type: text/x-java
Charset: utf-8

/**
 * Internal dependencies
 */
import { usePaymentMethodDataContext } from '../../providers/cart-checkout/payment-methods';

const usePaymentMethodState = ( express = false ) => {
	const {
		paymentMethods,
		expressPaymentMethods,
		paymentMethodsInitialized,
		expressPaymentMethodsInitialized,
	} = usePaymentMethodDataContext();
	return express
		? {
				paymentMethods: expressPaymentMethods,
				isInitialized: expressPaymentMethodsInitialized,
		  }
		: { paymentMethods, isInitialized: paymentMethodsInitialized };
};

export const usePaymentMethods = () => usePaymentMethodState();
export const useExpressPaymentMethods = () => usePaymentMethodState( true );