| 
									
										
										
										
											2018-08-23 16:29:26 +01:00
										 |  |  | import React from 'react'; | 
					
						
							|  |  |  | import PropTypes from 'prop-types'; | 
					
						
							|  |  |  | import { Provider } from 'react-redux'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-30 11:37:19 +01:00
										 |  |  | import headComponents from './src/head'; | 
					
						
							| 
									
										
										
										
											2018-08-23 16:29:26 +01:00
										 |  |  | import { createStore } from './src/redux/createStore'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-04 14:47:55 +01:00
										 |  |  | import GuideNavigationContextProvider from './src/contexts/GuideNavigationContext'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-23 16:29:26 +01:00
										 |  |  | const store = createStore(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export const wrapRootElement = ({ element }) => { | 
					
						
							| 
									
										
										
										
											2018-10-04 14:47:55 +01:00
										 |  |  |   return ( | 
					
						
							|  |  |  |     <Provider store={store}> | 
					
						
							|  |  |  |       <GuideNavigationContextProvider>{element}</GuideNavigationContextProvider> | 
					
						
							|  |  |  |     </Provider> | 
					
						
							|  |  |  |   ); | 
					
						
							| 
									
										
										
										
											2018-08-23 16:29:26 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | wrapRootElement.propTypes = { | 
					
						
							|  |  |  |   element: PropTypes.any | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2018-09-30 11:37:19 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | export const onRenderBody = ({ setHeadComponents, setPostBodyComponents }) => { | 
					
						
							|  |  |  |   setHeadComponents([...headComponents]); | 
					
						
							|  |  |  |   setPostBodyComponents([ | 
					
						
							|  |  |  |     <script | 
					
						
							|  |  |  |       async={true} | 
					
						
							|  |  |  |       key='chai-CDN' | 
					
						
							|  |  |  |       src='https://cdnjs.cloudflare.com/ajax/libs/chai/4.1.2/chai.min.js' | 
					
						
							|  |  |  |     />, | 
					
						
							|  |  |  |     <script | 
					
						
							|  |  |  |       async={true} | 
					
						
							|  |  |  |       key='gtag-script' | 
					
						
							|  |  |  |       src='https://www.googletagmanager.com/gtag/js?id=AW-795617839' | 
					
						
							|  |  |  |     />, | 
					
						
							|  |  |  |     <script | 
					
						
							|  |  |  |       dangerouslySetInnerHTML={{ | 
					
						
							|  |  |  |         __html: `
 | 
					
						
							|  |  |  |           window.dataLayer = window.dataLayer || []; | 
					
						
							|  |  |  |           function gtag(){dataLayer.push(arguments);} | 
					
						
							|  |  |  |           gtag('js', new Date()); | 
					
						
							|  |  |  |           gtag('config', 'AW-795617839'); | 
					
						
							|  |  |  |         `
 | 
					
						
							|  |  |  |       }} | 
					
						
							|  |  |  |       key='gtag-dataLayer' | 
					
						
							|  |  |  |     />, | 
					
						
							|  |  |  |     <script async={true} id='stripe-js' src='https://js.stripe.com/v3/' /> | 
					
						
							|  |  |  |   ]); | 
					
						
							|  |  |  | }; |