2020-04-06 16:27:35 -04:00
import './style.css'
2021-07-26 09:26:50 -05:00
import '@hashicorp/platform-util/nprogress/style.css'
2020-05-19 14:32:38 -04:00
2021-10-14 00:33:38 -04:00
import useFathomAnalytics from '@hashicorp/platform-analytics'
2020-04-06 16:27:35 -04:00
import Router from 'next/router'
2020-05-19 14:32:38 -04:00
import Head from 'next/head'
2022-02-10 11:07:41 -06:00
import rivetQuery from '@hashicorp/platform-cms'
2021-07-26 09:26:50 -05:00
import NProgress from '@hashicorp/platform-util/nprogress'
import { ErrorBoundary } from '@hashicorp/platform-runtime-error-monitoring'
import createConsentManager from '@hashicorp/react-consent-manager/loader'
2022-01-28 14:43:45 -05:00
import localConsentManagerServices from 'lib/consent-manager-services'
2021-07-26 09:26:50 -05:00
import useAnchorLinkAnalytics from '@hashicorp/platform-util/anchor-link-analytics'
2020-05-19 14:32:38 -04:00
import HashiHead from '@hashicorp/react-head'
2020-04-28 13:53:30 -04:00
import AlertBanner from '@hashicorp/react-alert-banner'
import alertBannerData , { ALERT _BANNER _ACTIVE } from '../data/alert-banner'
2020-04-06 16:27:35 -04:00
import Error from './_error'
2021-12-20 16:42:20 -05:00
import StandardLayout from 'layouts/standard'
2020-04-06 16:27:35 -04:00
2020-05-19 14:32:38 -04:00
NProgress ( { Router } )
2021-12-20 16:42:20 -05:00
const { ConsentManager } = createConsentManager ( {
2020-05-19 14:32:38 -04:00
preset : 'oss' ,
2022-01-28 14:43:45 -05:00
otherServices : [ ... localConsentManagerServices ] ,
2020-04-06 16:27:35 -04:00
} )
2021-12-20 16:42:20 -05:00
export default function App ( { Component , pageProps , layoutData } ) {
2021-10-14 00:33:38 -04:00
useFathomAnalytics ( )
2020-05-19 14:32:38 -04:00
useAnchorLinkAnalytics ( )
2021-10-14 00:33:38 -04:00
2021-12-20 16:42:20 -05:00
const Layout = Component . layout ? ? StandardLayout
2020-05-19 14:32:38 -04:00
return (
< ErrorBoundary FallbackComponent = { Error } >
< HashiHead
is = { Head }
title = "Consul by HashiCorp"
siteName = "Consul by HashiCorp"
description = "Consul is a service networking solution to automate network configurations, discover services, and enable secure connectivity across any cloud or runtime."
2021-10-26 11:29:18 -07:00
image = "https://www.consul.io/img/og-image.png"
2020-05-19 14:32:38 -04:00
icon = { [ { href : '/favicon.ico' } ] }
>
< meta
name = "og:title"
property = "og:title"
content = "Consul by HashiCorp"
/ >
< / H a s h i H e a d >
{ ALERT _BANNER _ACTIVE && (
2021-08-20 12:20:01 -04:00
< AlertBanner { ... alertBannerData } product = "consul" hideOnMobile / >
2020-05-19 14:32:38 -04:00
) }
2021-12-20 16:42:20 -05:00
< Layout { ... ( layoutData && { data : layoutData } ) } >
< div className = "content" >
< Component { ... pageProps } / >
< / d i v >
< / L a y o u t >
2020-05-19 14:32:38 -04:00
< ConsentManager / >
< / E r r o r B o u n d a r y >
)
}
2021-12-20 16:42:20 -05:00
App . getInitialProps = async ( { Component , ctx } ) => {
const layoutQuery = Component . layout
? Component . layout ? . rivetParams ? ? null
: StandardLayout . rivetParams
const layoutData = layoutQuery ? await rivetQuery ( layoutQuery ) : null
let pageProps = { }
if ( Component . getInitialProps ) {
pageProps = await Component . getInitialProps ( ctx )
}
return { pageProps , layoutData }
}