File tree Expand file tree Collapse file tree 3 files changed +35
-1
lines changed Expand file tree Collapse file tree 3 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import notices from 'state/notices/reducer';
12
12
import reducer from 'woocommerce/woocommerce-services/state/shipping-label/reducer' ;
13
13
import packagesReducer from 'woocommerce/woocommerce-services/state/packages/reducer' ;
14
14
import labelSettingsReducer from 'woocommerce/woocommerce-services/state/label-settings/reducer' ;
15
+ import reduxMiddleware from './redux-middleware' ;
15
16
import { combineReducers } from 'state/utils' ;
16
17
17
18
export default ( { orderId } ) => ( {
@@ -57,6 +58,10 @@ export default ( { orderId } ) => ( {
57
58
return `wcs-label-${ orderId } ` ;
58
59
} ,
59
60
61
+ getMiddleware ( ) {
62
+ return reduxMiddleware ;
63
+ } ,
64
+
60
65
View : ( ) => (
61
66
< ShippingLabelViewWrapper orderId = { orderId } />
62
67
) ,
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ //from calypso
5
+ import {
6
+ WOOCOMMERCE_SERVICES_SHIPPING_LABEL_EXIT_PRINTING_FLOW ,
7
+ } from 'woocommerce/woocommerce-services/state/action-types' ;
8
+
9
+ const middlewareActions = {
10
+ [ WOOCOMMERCE_SERVICES_SHIPPING_LABEL_EXIT_PRINTING_FLOW ] : ( ) => {
11
+ window . wc_shipment_tracking_refresh && window . wc_shipment_tracking_refresh ( ) ;
12
+ } ,
13
+ } ;
14
+
15
+ export default ( ) => ( next ) => ( action ) => {
16
+ // let the action go to the reducers
17
+ next ( action ) ;
18
+
19
+ const middlewareAction = middlewareActions [ action . type ] ;
20
+ if ( ! middlewareAction ) {
21
+ return ;
22
+ }
23
+
24
+ // perform the action
25
+ setTimeout ( ( ) => middlewareAction ( action ) ) ;
26
+ } ;
Original file line number Diff line number Diff line change @@ -66,7 +66,10 @@ Array.from( document.getElementsByClassName( 'wcc-root' ) ).forEach( ( container
66
66
Route . getReducer ( ) ,
67
67
{ ...serverState , ...persistedState } ,
68
68
compose (
69
- applyMiddleware ( thunk . withExtraArgument ( args ) ) ,
69
+ applyMiddleware (
70
+ thunk . withExtraArgument ( args ) ,
71
+ Route . getMiddleware ? Route . getMiddleware ( ) : ( ) => ( next ) => ( action ) => next ( action ) ,
72
+ ) ,
70
73
window . devToolsExtension ? window . devToolsExtension ( ) : f => f
71
74
)
72
75
) ;
You can’t perform that action at this time.
0 commit comments