forked from holy-gd/fingerprintjs.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-browser.js
24 lines (20 loc) · 954 Bytes
/
gatsby-browser.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import './src/styles/vendors/normalize.scss'
import './src/styles/vendors/tippy.scss'
import './src/styles/vendors/swiper.scss'
import './src/styles/vendors/code-theme.scss'
import './src/styles/global-styles.scss'
import './src/styles/custom-properties.scss'
import React from 'react'
import AppProviders from './src/AppProviders'
import { PAGES_RELOAD_CHATBOT } from './src/constants/content'
export const wrapRootElement = ({ element }) => <AppProviders>{element}</AppProviders>
export const onRouteUpdate = ({ location, prevLocation }) => {
const prevPage = prevLocation ? PAGES_RELOAD_CHATBOT.includes(prevLocation.pathname) : false
const shouldResetWidget = PAGES_RELOAD_CHATBOT.includes(location.pathname) || prevPage
if (shouldResetWidget && window.HubSpotConversations) {
const status = window.HubSpotConversations.widget.status()
if (status.loaded) {
window.HubSpotConversations.clear({ resetWidget: true })
}
}
}