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:*",
|
||||
|
|
|
|||
8
pnpm-lock.yaml
generated
8
pnpm-lock.yaml
generated
|
|
@ -573,9 +573,6 @@ importers:
|
|||
'@headlessui/react':
|
||||
specifier: ^1.7.19
|
||||
version: 1.7.19(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||
'@intercom/messenger-js-sdk':
|
||||
specifier: ^0.0.12
|
||||
version: 0.0.12
|
||||
'@plane/constants':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/constants
|
||||
|
|
@ -2333,9 +2330,6 @@ packages:
|
|||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
||||
'@intercom/messenger-js-sdk@0.0.12':
|
||||
resolution: {integrity: sha512-xoUGlKLD8nIcZaH7AesR/LfwXH4QQUdPZMV4sApK/zvVFBgAY/A9IWp1ey/jUcp+776ejtZeEqreJZxG4LdEuw==}
|
||||
|
||||
'@ioredis/commands@1.3.0':
|
||||
resolution: {integrity: sha512-M/T6Zewn7sDaBQEqIZ8Rb+i9y8qfGmq+5SDFSf9sA2lUZTmdDLVdOiQaeDp+Q4wElZ9HG1GAX5KhDaidp6LQsQ==}
|
||||
|
||||
|
|
@ -9738,8 +9732,6 @@ snapshots:
|
|||
'@img/sharp-win32-x64@0.34.3':
|
||||
optional: true
|
||||
|
||||
'@intercom/messenger-js-sdk@0.0.12': {}
|
||||
|
||||
'@ioredis/commands@1.3.0': {}
|
||||
|
||||
'@isaacs/cliui@8.0.2':
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue