Server IP : 172.67.158.161 / Your IP : 3.145.162.114 Web Server : LiteSpeed System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : giankuin ( 1871) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/thread-self/root/home/giankuin/sieuthiweb.com.vn/wp-content/plugins/woocommerce/packages/woocommerce-blocks/assets/js/base/context/cart-checkout/shipping/ |
Upload File : |
/** * Internal dependencies */ import { emitterCallback, reducer, emitEvent } from '../event-emit'; const EMIT_TYPES = { SHIPPING_RATES_SUCCESS: 'shipping_rates_success', SHIPPING_RATES_FAIL: 'shipping_rates_fail', SHIPPING_RATE_SELECT_SUCCESS: 'shipping_rate_select_success', SHIPPING_RATE_SELECT_FAIL: 'shipping_rate_select_fail', }; /** * Receives a reducer dispatcher and returns an object with the onSuccess and * onFail callback registration points for the shipping option emit events. * * Calling the event registration function with the callback will register it * for the event emitter and will return a dispatcher for removing the * registered callback (useful for implementation in `useEffect`). * * @param {Function} dispatcher A reducer dispatcher * @return {Object} An object with `onSuccess` and `onFail` emitter registration. */ const emitterSubscribers = ( dispatcher ) => ( { onSuccess: emitterCallback( EMIT_TYPES.SHIPPING_RATES_SUCCESS, dispatcher ), onFail: emitterCallback( EMIT_TYPES.SHIPPING_RATES_FAIL, dispatcher ), onSelectSuccess: emitterCallback( EMIT_TYPES.SHIPPING_RATE_SELECT_SUCCESS, dispatcher ), onSelectFail: emitterCallback( EMIT_TYPES.SHIPPING_RATE_SELECT_FAIL, dispatcher ), } ); export { EMIT_TYPES, emitterSubscribers, reducer, emitEvent };