From 909c3c5526ade2ffec76cf04e16303465c85b6e7 Mon Sep 17 00:00:00 2001 From: Eugene Kim <67894159+eugene028@users.noreply.github.com> Date: Sat, 3 Aug 2024 20:26:15 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[Refactor]=20:=20=ED=95=99=EA=B5=90=20?= =?UTF-8?q?=EC=9D=B4=EB=A9=94=EC=9D=BC=20=EC=9D=B8=EC=A6=9D=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20QA=20=EA=B0=9C=EC=84=A0=20=EB=B0=98?= =?UTF-8?q?=EC=98=81=20(#80)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: email 인증 error코드 중복 제거 * refac: 스팸메일함 안내문구 추가 * chore: 채널톡 위젯 삭제 --- src/components/chatbot/ChannelService.ts | 64 ----------------------- src/components/chatbot/Chatbot.tsx | 17 ------ src/hooks/mutation/useSendStudentEmail.ts | 3 -- src/main.tsx | 2 - src/pages/StudentVerification.tsx | 8 +-- 5 files changed, 5 insertions(+), 89 deletions(-) delete mode 100644 src/components/chatbot/ChannelService.ts delete mode 100644 src/components/chatbot/Chatbot.tsx diff --git a/src/components/chatbot/ChannelService.ts b/src/components/chatbot/ChannelService.ts deleted file mode 100644 index 70e5326..0000000 --- a/src/components/chatbot/ChannelService.ts +++ /dev/null @@ -1,64 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -declare global { - interface Window { - ChannelIO: (arg0: string, arg1?: unknown, arg2?: unknown) => void; - ChannelIOInitialized: boolean; - } -} - -class ChannelService { - constructor() { - this.loadScript(); - } - - loadScript() { - const w = window; - if (w.ChannelIOInitialized) { - return; - } - const channelIO = function () { - // eslint-disable-next-line prefer-rest-params - channelIO.c(arguments); - }; - - channelIO.q = [] as any[]; - channelIO.c = function (args: any) { - channelIO.q.push(args); - }; - w.ChannelIO = channelIO; - function initializeChannelIO() { - if (w.ChannelIOInitialized) { - return; - } - w.ChannelIOInitialized = true; - const script = document.createElement("script"); - script.type = "text/javascript"; - script.async = true; - script.src = "https://cdn.channel.io/plugin/ch-plugin-web.js"; - const firstScript = document.getElementsByTagName("script")[0]; - if (firstScript?.parentNode) { - firstScript.parentNode.insertBefore(script, firstScript); - } - } - if (document.readyState === "complete") { - initializeChannelIO(); - } else { - w.addEventListener("DOMContentLoaded", initializeChannelIO); - w.addEventListener("load", initializeChannelIO); - } - } - boot(settings: any, callback: any) { - window.ChannelIO("boot", settings, callback); - } - onBadgeChanged(callback: (number: number) => void) { - window.ChannelIO("onBadgeChanged", callback); - } - addTags(tags: string[]) { - window.ChannelIO("addTags", tags); - } - shutdown() { - window.ChannelIO("shutdown"); - } -} - -export default ChannelService; diff --git a/src/components/chatbot/Chatbot.tsx b/src/components/chatbot/Chatbot.tsx deleted file mode 100644 index 422ef9e..0000000 --- a/src/components/chatbot/Chatbot.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { useEffect } from 'react'; - -import { CHANNELIO_PLUGIN_KEY } from '@constants/environment'; - -import ChannelService from '@/components/chatbot/ChannelService'; - -export default function Chatbot() { - useEffect(() => { - const channelTalk = new ChannelService(); - - channelTalk.boot({ pluginKey: CHANNELIO_PLUGIN_KEY }, () => {}); - - return () => channelTalk.shutdown(); - }, []); - - return