Skip to content

Commit f13cb02

Browse files
committed
remove Intercom
1 parent 6970daa commit f13cb02

File tree

7 files changed

+100
-100
lines changed

7 files changed

+100
-100
lines changed

components/AnalyticsScripts.tsx

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as segmentSnippet from "@segment/snippet";
1+
// import * as segmentSnippet from "@segment/snippet";
22
import {
33
googleAnalytics4Code,
44
googleAnalyticsUACode,
@@ -10,20 +10,20 @@ import { useSession } from "next-auth/client";
1010
import React, { memo, useEffect, useMemo, useState } from "react";
1111
import Script from "next/script";
1212

13-
function renderSegmentSnippet() {
14-
const opts = {
15-
apiKey: segmentPublicKey,
16-
// note: the page option only covers SSR tracking.
17-
// Page.js is used to track other events using `window.analytics.page()`
18-
page: true,
19-
};
13+
// function renderSegmentSnippet() {
14+
// const opts = {
15+
// apiKey: segmentPublicKey,
16+
// // note: the page option only covers SSR tracking.
17+
// // Page.js is used to track other events using `window.analytics.page()`
18+
// page: true,
19+
// };
2020

21-
if (inProduction) {
22-
return segmentSnippet.min(opts);
23-
}
21+
// if (inProduction) {
22+
// return segmentSnippet.min(opts);
23+
// }
2424

25-
return segmentSnippet.max(opts);
26-
}
25+
// return segmentSnippet.max(opts);
26+
// }
2727

2828
const useUserAnalytics = () => {
2929
const [UA, setUA] = useState<string | undefined>();
@@ -118,7 +118,7 @@ const ProductionScripts = () => {
118118

119119
return (
120120
<>
121-
<Script dangerouslySetInnerHTML={{ __html: renderSegmentSnippet() }} />
121+
{/* <Script dangerouslySetInnerHTML={{ __html: renderSegmentSnippet() }} /> */}
122122
<GoogleAnalyticsScripts />
123123
<FullStoryScripts />
124124
</>

components/ErrorWrapper.tsx

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { FetchBaseQueryError } from "@reduxjs/toolkit/dist/query";
22
import { IApiResponse } from "@/features/api/ApiResponse";
33
import { SerializedError } from "@reduxjs/toolkit";
4-
import { useIntercom } from "react-use-intercom";
4+
// import { useIntercom } from "react-use-intercom";
55
import PageWrapper from "./PageWrapper";
66
import React, { memo, useEffect, useMemo } from "react";
77

@@ -10,18 +10,18 @@ function ErrorWrapper({
1010
}: {
1111
error: FetchBaseQueryError | SerializedError;
1212
}) {
13-
const { boot, show } = useIntercom();
13+
// const { boot, show } = useIntercom();
1414
const errorData = useMemo(
1515
() => ("data" in error ? (error?.data as IApiResponse) : undefined),
1616
[error]
1717
);
1818

19-
useEffect(() => {
20-
try {
21-
boot();
22-
} catch (error) {}
23-
show();
24-
}, []);
19+
// useEffect(() => {
20+
// try {
21+
// boot();
22+
// } catch (error) {}
23+
// show();
24+
// }, []);
2525

2626
return (
2727
<PageWrapper heading="An error has occured.">

components/Layout.tsx

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { inProduction } from "@/lib/environment";
22
import { intercomAppId, segmentPublicKey } from "@/lib/services";
33
import { segment } from "@/lib/track";
4-
import { useIntercom } from "react-use-intercom";
4+
// import { useIntercom } from "react-use-intercom";
55
import { useProfile, useSidebarsVisible } from "@/hooks";
66
import { useRouter } from "next/router";
77
import Authenticated from "./Authenticated";
@@ -36,25 +36,25 @@ function Layout({
3636
() => false && router.pathname.includes("/settings"),
3737
[router.pathname]
3838
);
39-
const { boot, update } = useIntercom();
39+
// const { boot, update } = useIntercom();
4040

41-
useEffect(() => {
42-
// Boot up the Intercom widget
43-
if (inProduction && intercomAppId) boot();
44-
}, []);
41+
// useEffect(() => {
42+
// // Boot up the Intercom widget
43+
// if (inProduction && intercomAppId) boot();
44+
// }, []);
4545

4646
useEffect(() => {
4747
// Update Intercom with the user's info
4848
if (inProduction && !profileIsLoading && session) {
49-
if (intercomAppId) {
50-
// Update Intercom identification
51-
update({
52-
name: session?.user?.name,
53-
email: session?.user?.email,
54-
createdAt: session?.user?.createdAt?.toString(),
55-
userHash: session?.user?.intercomUserHash,
56-
});
57-
}
49+
// if (intercomAppId) {
50+
// // Update Intercom identification
51+
// update({
52+
// name: session?.user?.name,
53+
// email: session?.user?.email,
54+
// createdAt: session?.user?.createdAt?.toString(),
55+
// userHash: session?.user?.intercomUserHash,
56+
// });
57+
// }
5858

5959
if (segmentPublicKey) {
6060
// Update Segment identification

components/PublicLayout.tsx

+19-19
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
import { inProduction } from "@/lib/environment";
22
import { intercomAppId } from "@/lib/services"
3-
import { useIntercom } from "react-use-intercom";
4-
import { useSession } from "next-auth/client";
3+
// import { useIntercom } from "react-use-intercom";
4+
// import { useSession } from "next-auth/client";
55
import HeadSection from "./HeadSection";
66
import React, { ReactNode, useEffect } from "react";
77
import classNames from "classnames";
88

99
function Layout({ children }: { children: ReactNode }) {
10-
const [session, sessionIsLoading] = useSession();
11-
const { boot, update } = useIntercom();
10+
// const [session, sessionIsLoading] = useSession();
11+
// const { boot, update } = useIntercom();
1212

13-
useEffect(() => {
14-
// Boot up the Intercom widget
15-
if (inProduction && intercomAppId) boot();
16-
}, []);
13+
// useEffect(() => {
14+
// // Boot up the Intercom widget
15+
// if (inProduction && intercomAppId) boot();
16+
// }, []);
1717

18-
useEffect(() => {
19-
// Update Intercom with the user's info
20-
if (inProduction && !sessionIsLoading && session && intercomAppId) {
21-
update({
22-
name: session?.user?.name,
23-
email: session?.user?.email,
24-
createdAt: session?.user?.createdAt?.toString(),
25-
userHash: session?.user?.intercomUserHash,
26-
});
27-
}
28-
}, [sessionIsLoading, session]);
18+
// useEffect(() => {
19+
// // Update Intercom with the user's info
20+
// if (inProduction && !sessionIsLoading && session && intercomAppId) {
21+
// update({
22+
// name: session?.user?.name,
23+
// email: session?.user?.email,
24+
// createdAt: session?.user?.createdAt?.toString(),
25+
// userHash: session?.user?.intercomUserHash,
26+
// });
27+
// }
28+
// }, [sessionIsLoading, session]);
2929

3030
return (
3131
<>

pages/_app.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import * as gtag from "@/lib/gtag";
77
import { ChakraProvider, Tooltip } from "@chakra-ui/react";
88
import { DndProvider } from "react-dnd";
99
import { HTML5Backend } from "react-dnd-html5-backend";
10-
import { IntercomProvider } from "react-use-intercom";
10+
// import { IntercomProvider } from "react-use-intercom";
1111
import { Provider as NextAuthProvider } from "next-auth/client";
1212
import { Provider as ReduxProvider } from "react-redux";
1313
import { ToastContainer, Zoom } from "react-toastify";
@@ -101,9 +101,9 @@ function MyApp({ Component, pageProps }: AppProps) {
101101
<ShowErrorMessages>
102102
{/* Conditionally enable Intercom */}
103103
{isString(intercomAppId) && (
104-
<IntercomProvider appId={intercomAppId}>
104+
// <IntercomProvider appId={intercomAppId}>
105105
<Component {...pageProps} />
106-
</IntercomProvider>
106+
// </IntercomProvider>
107107
)}
108108

109109
{!isString(intercomAppId) && <Component {...pageProps} />}

pages/_error.tsx

+25-25
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { inProduction } from "@/lib/environment";
2-
import { useIntercom } from "react-use-intercom";
2+
// import { useIntercom } from "react-use-intercom";
33
import { useSession } from "next-auth/client";
44
import { useWindowSize } from "react-use";
55
import React, { useEffect, useMemo } from "react";
66
import classNames from "classnames";
77

88
function Error({ statusCode }: any) {
99
const [session, sessionIsLoading] = useSession();
10-
const { boot, update, show } = useIntercom();
10+
// const { boot, update, show } = useIntercom();
1111
const { width, height } = useWindowSize();
1212
const centerText = useMemo(() => width >= 1200, [width]);
1313
const shouldShow = useMemo(() => {
@@ -16,27 +16,27 @@ function Error({ statusCode }: any) {
1616
return true;
1717
}, [width, height]);
1818

19-
useEffect(() => {
20-
// Boot up the Intercom widget
21-
if (inProduction) {
22-
boot();
23-
if (shouldShow) {
24-
show();
25-
}
26-
}
27-
}, []);
19+
// useEffect(() => {
20+
// // Boot up the Intercom widget
21+
// if (inProduction) {
22+
// boot();
23+
// if (shouldShow) {
24+
// show();
25+
// }
26+
// }
27+
// }, []);
2828

29-
useEffect(() => {
30-
// Update Intercom with the user's info
31-
if (inProduction && !sessionIsLoading && session) {
32-
update({
33-
name: session?.user?.name,
34-
email: session?.user?.email,
35-
createdAt: session?.user?.createdAt?.toString(),
36-
userHash: session?.user?.intercomUserHash,
37-
});
38-
}
39-
}, [sessionIsLoading, session]);
29+
// useEffect(() => {
30+
// // Update Intercom with the user's info
31+
// if (inProduction && !sessionIsLoading && session) {
32+
// update({
33+
// name: session?.user?.name,
34+
// email: session?.user?.email,
35+
// createdAt: session?.user?.createdAt?.toString(),
36+
// userHash: session?.user?.intercomUserHash,
37+
// });
38+
// }
39+
// }, [sessionIsLoading, session]);
4040

4141
return (
4242
<div>
@@ -47,16 +47,16 @@ function Error({ statusCode }: any) {
4747
className={classNames(
4848
"absolute flex justify-center h-full w-full inset-0 z-20 rounded-xl text-center bg-white text-gray-900",
4949
{
50-
"items-center": centerText,
50+
// "items-center": centerText,
5151
}
5252
)}
5353
>
5454
Apologies. Sometimes we make mistakes too...
5555
<br />
5656
Do you want to share some details about this issue in our chat or to{" "}
5757
<a href="mailto:[email protected]">[email protected]</a>?{" "}
58-
{centerText && "👉"}
59-
{centerText || "👇"}
58+
{/* {centerText && "👉"}
59+
{centerText || "👇"} */}
6060
</div>
6161
</div>
6262
);

pages/api/auth/register.ts

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable max-len */
2-
import { Client } from "intercom-client";
2+
// import { Client } from "intercom-client";
33
import { createUser, hashPassword } from "@/features/auth";
4-
import { intercomAccessToken } from "@/lib/services";
4+
// import { intercomAccessToken } from "@/lib/services";
55
import { schema } from "@/features/auth/signupSchema";
66
import { serverSegment } from "@/lib/track";
77
import { withMiddlewares } from "@/features/api/middleware";
@@ -56,21 +56,21 @@ const handler = async (
5656
properties: {},
5757
});
5858

59-
if (intercomAccessToken) {
60-
const intercomClient = new Client({
61-
token: intercomAccessToken,
62-
});
59+
// if (intercomAccessToken) {
60+
// const intercomClient = new Client({
61+
// token: intercomAccessToken,
62+
// });
6363

64-
await intercomClient.contacts.create({
65-
email: payload.email,
66-
user_id: user?.id?.toString(),
67-
name: `${user?.firstName} ${user?.lastName}`,
68-
custom_attributes: {
69-
Organization: payload?.organization,
70-
},
71-
signed_up_at: Date.now() / 1000,
72-
} as any);
73-
}
64+
// await intercomClient.contacts.create({
65+
// email: payload.email,
66+
// user_id: user?.id?.toString(),
67+
// name: `${user?.firstName} ${user?.lastName}`,
68+
// custom_attributes: {
69+
// Organization: payload?.organization,
70+
// },
71+
// signed_up_at: Date.now() / 1000,
72+
// } as any);
73+
// }
7474

7575
await email.send({
7676

0 commit comments

Comments
 (0)