chore: remove chat support component
This commit is contained in:
parent
72b6453f6f
commit
1faf06c755
4 changed files with 0 additions and 65 deletions
|
|
@ -13,8 +13,6 @@ import { TranslationProvider } from "@plane/i18n";
|
|||
import { Toast } from "@plane/propel/toast";
|
||||
// helpers
|
||||
import { resolveGeneralTheme } from "@plane/utils";
|
||||
// polyfills
|
||||
import "@/lib/polyfills";
|
||||
// mobx store provider
|
||||
import { StoreProvider } from "@/lib/store-context";
|
||||
|
||||
|
|
@ -31,10 +29,6 @@ const InstanceWrapper = lazy(function InstanceWrapper() {
|
|||
return import("@/lib/wrappers/instance-wrapper");
|
||||
});
|
||||
|
||||
const ChatSupportModal = lazy(function ChatSupportModal() {
|
||||
return import("@/components/global/chat-support-modal");
|
||||
});
|
||||
|
||||
export interface IAppProvider {
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
|
@ -53,7 +47,6 @@ export function AppProvider(props: IAppProvider) {
|
|||
<StoreWrapper>
|
||||
<InstanceWrapper>
|
||||
<Suspense>
|
||||
<ChatSupportModal />
|
||||
<SWRConfig value={WEB_SWR_CONFIG}>{children}</SWRConfig>
|
||||
</Suspense>
|
||||
</InstanceWrapper>
|
||||
|
|
|
|||
|
|
@ -1,49 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2023-present Plane Software, Inc. and contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
import { useEffect } from "react";
|
||||
import { Intercom, shutdown, show } from "@intercom/messenger-js-sdk";
|
||||
import { observer } from "mobx-react";
|
||||
// custom events
|
||||
import { CHAT_SUPPORT_EVENTS } from "@/custom-events/chat-support";
|
||||
// store hooks
|
||||
import { useInstance } from "@/hooks/store/use-instance";
|
||||
import { useUser } from "@/hooks/store/user";
|
||||
|
||||
const ChatSupportModal = observer(function ChatSupportModal() {
|
||||
// store hooks
|
||||
const { data: user } = useUser();
|
||||
const { config } = useInstance();
|
||||
// derived values
|
||||
const intercomAppId = config?.intercom_app_id;
|
||||
const isEnabled = Boolean(user && config?.is_intercom_enabled && intercomAppId);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isEnabled || !user || !intercomAppId) return;
|
||||
|
||||
Intercom({
|
||||
app_id: intercomAppId,
|
||||
user_id: user.id,
|
||||
name: `${user.first_name} ${user.last_name}`,
|
||||
email: user.email,
|
||||
hide_default_launcher: true,
|
||||
});
|
||||
|
||||
const handleOpenChatSupport = () => {
|
||||
show();
|
||||
};
|
||||
|
||||
window.addEventListener(CHAT_SUPPORT_EVENTS.open, handleOpenChatSupport);
|
||||
return () => {
|
||||
window.removeEventListener(CHAT_SUPPORT_EVENTS.open, handleOpenChatSupport);
|
||||
shutdown();
|
||||
};
|
||||
}, [user, intercomAppId, isEnabled]);
|
||||
|
||||
return null;
|
||||
});
|
||||
|
||||
export default ChatSupportModal;
|
||||
|
|
@ -25,7 +25,6 @@
|
|||
"@fontsource/ibm-plex-mono": "5.2.7",
|
||||
"@fontsource/material-symbols-rounded": "5.2.30",
|
||||
"@headlessui/react": "^1.7.19",
|
||||
"@intercom/messenger-js-sdk": "^0.0.12",
|
||||
"@plane/constants": "workspace:*",
|
||||
"@plane/editor": "workspace:*",
|
||||
"@plane/hooks": "workspace:*",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue