Skip to content

Commit

Permalink
Merge pull request #192 from COW-dev/feat/DDING-42
Browse files Browse the repository at this point in the history
feat: CS 도구 채널톡 설치
  • Loading branch information
yougyung authored Nov 15, 2024
2 parents 7bdd328 + 7055e35 commit fc648c3
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
12 changes: 12 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"lint:fix": "next lint --fix"
},
"dependencies": {
"@channel.io/channel-web-sdk-loader": "^2.0.0",
"@radix-ui/react-accordion": "^1.2.0",
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-slot": "^1.0.2",
Expand Down
13 changes: 13 additions & 0 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import type { AppProps } from 'next/app';
import Head from 'next/head';
import { useRouter } from 'next/router';
import Script from 'next/script';
import { loadScript, boot } from '@channel.io/channel-web-sdk-loader';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
import { Analytics } from '@vercel/analytics/react';
import { CookiesProvider } from 'react-cookie';

import Layout from '@/components/layout';
import ToasterWithMax from '@/components/toast/ToasterWithMax';
import * as gtag from '@/lib/gtag';
Expand All @@ -21,6 +23,8 @@ const queryClient = new QueryClient({
},
});

let channelTalkDidInit = false;

export default function App({ Component, pageProps }: AppProps) {
const router = useRouter();
useEffect(() => {
Expand All @@ -32,6 +36,15 @@ export default function App({ Component, pageProps }: AppProps) {
router.events.off('routeChangeComplete', handleRouteChange);
};
}, [router.events]);

if (typeof window !== 'undefined' && !channelTalkDidInit) {
channelTalkDidInit = true;
loadScript();
boot({
pluginKey: process.env.NEXT_PUBLIC_CHANNELTALK_PLUGIN ?? '',
});
}

return (
<>
<Head>
Expand Down

0 comments on commit fc648c3

Please sign in to comment.