2021-08-27 12:11:24 +00:00
|
|
|
import { Provider } from "next-auth/client";
|
2021-09-22 19:52:38 +00:00
|
|
|
import React from "react";
|
2021-09-24 10:16:46 +00:00
|
|
|
import { HydrateProps, QueryClient, QueryClientProvider } from "react-query";
|
2021-08-27 12:11:24 +00:00
|
|
|
import { Hydrate } from "react-query/hydration";
|
|
|
|
|
2021-09-24 20:02:03 +00:00
|
|
|
import DynamicIntercomProvider from "@ee/lib/intercom/providerDynamic";
|
|
|
|
|
2021-09-24 10:16:46 +00:00
|
|
|
import { Session } from "@lib/auth";
|
2021-09-22 19:52:38 +00:00
|
|
|
import { createTelemetryClient, TelemetryProvider } from "@lib/telemetry";
|
|
|
|
|
2021-08-27 12:11:24 +00:00
|
|
|
export const queryClient = new QueryClient();
|
|
|
|
|
2021-09-24 10:16:46 +00:00
|
|
|
type AppProviderProps = {
|
|
|
|
pageProps: {
|
|
|
|
session?: Session;
|
|
|
|
dehydratedState?: HydrateProps;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const AppProviders: React.FC<AppProviderProps> = ({ pageProps, children }) => {
|
2021-08-27 12:11:24 +00:00
|
|
|
return (
|
|
|
|
<TelemetryProvider value={createTelemetryClient()}>
|
|
|
|
<QueryClientProvider client={queryClient}>
|
2021-09-24 20:02:03 +00:00
|
|
|
<DynamicIntercomProvider>
|
|
|
|
<Hydrate state={pageProps.dehydratedState}>
|
|
|
|
<Provider session={pageProps.session}>{children}</Provider>
|
|
|
|
</Hydrate>
|
|
|
|
</DynamicIntercomProvider>
|
2021-08-27 12:11:24 +00:00
|
|
|
</QueryClientProvider>
|
|
|
|
</TelemetryProvider>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default AppProviders;
|