| 
				
			 | 
			
			
				@@ -1,5 +1,6 @@ 
			 | 
		
	
		
			
			| 
				1
			 | 
			
				1
			 | 
			
			
				 import * as React from 'react'; 
			 | 
		
	
		
			
			| 
				2
			 | 
			
				2
			 | 
			
			
				 import * as  _ from 'lodash'; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				3
			 | 
			
			
				+import * as ReactLifecyclesCompat from 'react-lifecycles-compat'; 
			 | 
		
	
		
			
			| 
				3
			 | 
			
				4
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				4
			 | 
			
				5
			 | 
			
			
				 export class ComponentWrapper { 
			 | 
		
	
		
			
			| 
				5
			 | 
			
				6
			 | 
			
			
				  
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -7,6 +8,12 @@ export class ComponentWrapper { 
			 | 
		
	
		
			
			| 
				7
			 | 
			
				8
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				8
			 | 
			
				9
			 | 
			
			
				     class WrappedComponent extends React.Component<any, { componentId: string; allProps: {}; }> { 
			 | 
		
	
		
			
			| 
				9
			 | 
			
				10
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				
			 | 
			
				11
			 | 
			
			
				+      static getDerivedStateFromProps(nextProps, prevState) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				12
			 | 
			
			
				+        return { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				13
			 | 
			
			
				+          allProps: _.merge({}, nextProps, store.getPropsForId(prevState.componentId)) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				14
			 | 
			
			
				+        }; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				15
			 | 
			
			
				+      } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				16
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				10
			 | 
			
				17
			 | 
			
			
				       private originalComponentRef; 
			 | 
		
	
		
			
			| 
				11
			 | 
			
				18
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				12
			 | 
			
				19
			 | 
			
			
				       constructor(props) { 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -15,11 +22,11 @@ export class ComponentWrapper { 
			 | 
		
	
		
			
			| 
				15
			 | 
			
				22
			 | 
			
			
				         this._saveComponentRef = this._saveComponentRef.bind(this); 
			 | 
		
	
		
			
			| 
				16
			 | 
			
				23
			 | 
			
			
				         this.state = { 
			 | 
		
	
		
			
			| 
				17
			 | 
			
				24
			 | 
			
			
				           componentId: props.componentId, 
			 | 
		
	
		
			
			| 
				18
			 | 
			
				
			 | 
			
			
				-          allProps: _.merge({}, props, store.getPropsForId(props.componentId)) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				25
			 | 
			
			
				+          allProps: {} 
			 | 
		
	
		
			
			| 
				19
			 | 
			
				26
			 | 
			
			
				         }; 
			 | 
		
	
		
			
			| 
				20
			 | 
			
				27
			 | 
			
			
				       } 
			 | 
		
	
		
			
			| 
				21
			 | 
			
				28
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				22
			 | 
			
				
			 | 
			
			
				-      componentWillMount() { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				29
			 | 
			
			
				+      componentDidMount() { 
			 | 
		
	
		
			
			| 
				23
			 | 
			
				30
			 | 
			
			
				         store.setRefForId(this.state.componentId, this); 
			 | 
		
	
		
			
			| 
				24
			 | 
			
				31
			 | 
			
			
				       } 
			 | 
		
	
		
			
			| 
				25
			 | 
			
				32
			 | 
			
			
				  
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -45,12 +52,6 @@ export class ComponentWrapper { 
			 | 
		
	
		
			
			| 
				45
			 | 
			
				52
			 | 
			
			
				         } 
			 | 
		
	
		
			
			| 
				46
			 | 
			
				53
			 | 
			
			
				       } 
			 | 
		
	
		
			
			| 
				47
			 | 
			
				54
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				48
			 | 
			
				
			 | 
			
			
				-      componentWillReceiveProps(nextProps) { 
			 | 
		
	
		
			
			| 
				49
			 | 
			
				
			 | 
			
			
				-        this.setState({ 
			 | 
		
	
		
			
			| 
				50
			 | 
			
				
			 | 
			
			
				-          allProps: _.merge({}, nextProps, store.getPropsForId(this.state.componentId)) 
			 | 
		
	
		
			
			| 
				51
			 | 
			
				
			 | 
			
			
				-        }); 
			 | 
		
	
		
			
			| 
				52
			 | 
			
				
			 | 
			
			
				-      } 
			 | 
		
	
		
			
			| 
				53
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				54
			 | 
			
				55
			 | 
			
			
				       render() { 
			 | 
		
	
		
			
			| 
				55
			 | 
			
				56
			 | 
			
			
				         return ( 
			 | 
		
	
		
			
			| 
				56
			 | 
			
				57
			 | 
			
			
				           <OriginalComponentClass 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -73,6 +74,8 @@ export class ComponentWrapper { 
			 | 
		
	
		
			
			| 
				73
			 | 
			
				74
			 | 
			
			
				       } 
			 | 
		
	
		
			
			| 
				74
			 | 
			
				75
			 | 
			
			
				     } 
			 | 
		
	
		
			
			| 
				75
			 | 
			
				76
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				
			 | 
			
				77
			 | 
			
			
				+    ReactLifecyclesCompat.polyfill(WrappedComponent); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				78
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				76
			 | 
			
				79
			 | 
			
			
				     return WrappedComponent; 
			 | 
		
	
		
			
			| 
				77
			 | 
			
				80
			 | 
			
			
				   } 
			 | 
		
	
		
			
			| 
				78
			 | 
			
				81
			 | 
			
			
				 } 
			 |