Skip to content

Commit

Permalink
feat: Add enhanced intercom (#720)
Browse files Browse the repository at this point in the history
  • Loading branch information
LautaroPetaccio authored Jan 7, 2025
1 parent a0a0c88 commit 5ce751b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 21 deletions.
2 changes: 2 additions & 0 deletions gatsby-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import "./src/theme.css"

// import Helmet from 'react-helmet'
// import { RawIntlProvider, createIntl } from 'react-intl'
import EnhancedIntercom from "decentraland-gatsby/dist/components/Development/EnhancedIntercom"
import Layout2 from "decentraland-gatsby/dist/components/Layout/Layout2"
import AuthProvider from "decentraland-gatsby/dist/context/Auth/AuthProvider"
import FeatureFlagProvider from "decentraland-gatsby/dist/context/FeatureFlag/FeatureFlagProvider"
Expand Down Expand Up @@ -51,6 +52,7 @@ export const wrapRootElement = ({ element }) => (
</Events>
</ProfileSettings>
</FeatureFlagProvider>
<EnhancedIntercom />
</AuthProvider>
)

Expand Down
43 changes: 22 additions & 21 deletions gatsby-ssr.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,29 @@ export function onPreRenderHTML(
},
pluginOptions
) {
const headComponents = getHeadComponents().map((component) => {
if (component.type !== "style" || !component.props["data-href"]) {
return component
}
const headComponents = getHeadComponents()
.concat([
<script
dangerouslySetInnerHTML={{
__html:
"if (typeof window !== 'undefined' && 'serviceWorker' in navigator) {window.navigator.serviceWorker.getRegistrations().then(registrations => {registrations.forEach(r => r.unregister())})}",
}}
></script>,
])
.map((component, i) => {
if (component.type !== "style" || !component.props["data-href"]) {
return component
}

return (
<link
rel="stylesheet"
id={component.props.id}
href={component.props["data-href"]}
/>
)
})

headComponents.push(
<script
dangerouslySetInnerHTML={{
__html:
"if (typeof window !== 'undefined' && 'serviceWorker' in navigator) {window.navigator.serviceWorker.getRegistrations().then(registrations => {registrations.forEach(r => r.unregister())})}",
}}
></script>
)
return (
<link
key={i}
rel="stylesheet"
id={component.props.id}
href={component.props["data-href"]}
/>
)
})

const postBodyComponents = [...getPostBodyComponents()]
postBodyComponents.push(<Segment key="segment" trackPage={false} />)
Expand Down

0 comments on commit 5ce751b

Please sign in to comment.