File "load-stripe.js"

Full Path: /home/vantageo/public_html/cache/cache/cache/cache/cache/cache/.wp-cli/wp-content/plugins/woocommerce/packages/woocommerce-blocks/assets/js/payment-method-extensions/payment-methods/stripe/stripe-utils/load-stripe.js
File size: 486 bytes
MIME-type: text/x-java
Charset: utf-8

/**
 * External dependencies
 */
import { loadStripe } from '@stripe/stripe-js';

/**
 * Internal dependencies
 */
import { getApiKey } from './utils';

const stripePromise = () =>
	new Promise( ( resolve ) => {
		try {
			resolve( loadStripe( getApiKey() ) );
		} catch ( error ) {
			// In order to avoid showing console error publicly to users,
			// we resolve instead of rejecting when there is an error.
			resolve( { error } );
		}
	} );

export { stripePromise as loadStripe };