From 3d758d4358a57ad3d79ca180f0e697d1b598d985 Mon Sep 17 00:00:00 2001 From: Vishal Sharma Date: Wed, 28 May 2025 07:11:11 +0530 Subject: [PATCH] feat: init pylon and deprecate intercom (#8059) --- frontend/example.env | 2 +- frontend/public/locales/en-GB/services.json | 2 +- frontend/public/locales/en/services.json | 2 +- frontend/src/AppRoutes/index.tsx | 24 ++++---- frontend/src/api/utils.ts | 8 --- .../CeleryOverviewTable.styles.scss | 2 +- .../ChatSupportGateway/ChatSupportGateway.tsx | 14 ++--- .../LaunchChatSupport/LaunchChatSupport.tsx | 12 ++-- .../GeneralSettingsCloud.tsx | 2 +- .../InfraMonitoring.styles.scss | 2 +- .../EntityEvents/entityEvents.styles.scss | 2 +- .../InfraMonitoringK8s.styles.scss | 2 +- .../Summary/Summary.styles.scss | 2 +- frontend/src/index.html.ejs | 58 ++++++++----------- frontend/src/pages/Support/Support.tsx | 4 +- frontend/src/typings/window.ts | 2 +- frontend/webpack.config.js | 4 +- frontend/webpack.config.prod.js | 4 +- 18 files changed, 64 insertions(+), 84 deletions(-) diff --git a/frontend/example.env b/frontend/example.env index 79912e090729..d875044f96e7 100644 --- a/frontend/example.env +++ b/frontend/example.env @@ -1,7 +1,7 @@ NODE_ENV="development" BUNDLE_ANALYSER="true" FRONTEND_API_ENDPOINT="http://localhost:8080/" -INTERCOM_APP_ID="intercom-app-id" +PYLON_APP_ID="pylon-app-id" APPCUES_APP_ID="appcess-app-id" CI="1" \ No newline at end of file diff --git a/frontend/public/locales/en-GB/services.json b/frontend/public/locales/en-GB/services.json index f04c8517599c..a8c8b42c9c7a 100644 --- a/frontend/public/locales/en-GB/services.json +++ b/frontend/public/locales/en-GB/services.json @@ -1,3 +1,3 @@ { - "rps_over_100": "You are sending data at more than 100 RPS, your ingestion may be rate limited. Please reach out to us via Intercom support or " + "rps_over_100": "You are sending data at more than 100 RPS, your ingestion may be rate limited. Please reach out to us via chat support or " } diff --git a/frontend/public/locales/en/services.json b/frontend/public/locales/en/services.json index f04c8517599c..a8c8b42c9c7a 100644 --- a/frontend/public/locales/en/services.json +++ b/frontend/public/locales/en/services.json @@ -1,3 +1,3 @@ { - "rps_over_100": "You are sending data at more than 100 RPS, your ingestion may be rate limited. Please reach out to us via Intercom support or " + "rps_over_100": "You are sending data at more than 100 RPS, your ingestion may be rate limited. Please reach out to us via chat support or " } diff --git a/frontend/src/AppRoutes/index.tsx b/frontend/src/AppRoutes/index.tsx index 72750a70b2f5..a97fd7e933ac 100644 --- a/frontend/src/AppRoutes/index.tsx +++ b/frontend/src/AppRoutes/index.tsx @@ -215,13 +215,13 @@ function App(): JSX.Element { useEffect(() => { if (pathname === ROUTES.ONBOARDING) { - window.Intercom('update', { - hide_default_launcher: true, - }); + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + window.Pylon('hideChatBubble'); } else { - window.Intercom('update', { - hide_default_launcher: false, - }); + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + window.Pylon('showChatBubble'); } }, [pathname]); @@ -256,11 +256,13 @@ function App(): JSX.Element { !showAddCreditCardModal && (isCloudUser || isEnterpriseSelfHostedUser) ) { - window.Intercom('boot', { - app_id: process.env.INTERCOM_APP_ID, - email: user?.email || '', - name: user?.displayName || '', - }); + window.pylon = { + chat_settings: { + app_id: process.env.PYLON_APP_ID, + email: user.email, + name: user.displayName, + }, + }; } } }, [ diff --git a/frontend/src/api/utils.ts b/frontend/src/api/utils.ts index 179eac8e21e4..95dfceb45767 100644 --- a/frontend/src/api/utils.ts +++ b/frontend/src/api/utils.ts @@ -15,13 +15,5 @@ export const Logout = (): void => { deleteLocalStorageKey(LOCALSTORAGE.QUICK_FILTERS_SETTINGS_ANNOUNCEMENT); window.dispatchEvent(new CustomEvent('LOGOUT')); - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - if (window && window.Intercom) { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - window.Intercom('shutdown'); - } - history.push(ROUTES.LOGIN); }; diff --git a/frontend/src/components/CeleryOverview/CeleryOverviewTable/CeleryOverviewTable.styles.scss b/frontend/src/components/CeleryOverview/CeleryOverviewTable/CeleryOverviewTable.styles.scss index 676204585dbe..c66a30151359 100644 --- a/frontend/src/components/CeleryOverview/CeleryOverviewTable/CeleryOverviewTable.styles.scss +++ b/frontend/src/components/CeleryOverview/CeleryOverviewTable/CeleryOverviewTable.styles.scss @@ -93,7 +93,7 @@ padding: 4px; margin: 0; - // this is to offset intercom icon + // this is to offset chat support icon padding-right: 72px; .ant-pagination-item { diff --git a/frontend/src/components/ChatSupportGateway/ChatSupportGateway.tsx b/frontend/src/components/ChatSupportGateway/ChatSupportGateway.tsx index 64657c839894..16ee925e9112 100644 --- a/frontend/src/components/ChatSupportGateway/ChatSupportGateway.tsx +++ b/frontend/src/components/ChatSupportGateway/ChatSupportGateway.tsx @@ -2,7 +2,7 @@ import { Button, Modal, Typography } from 'antd'; import logEvent from 'api/common/logEvent'; import updateCreditCardApi from 'api/v1/checkout/create'; import { useNotifications } from 'hooks/useNotifications'; -import { CreditCard, X } from 'lucide-react'; +import { CreditCard, MessageSquareText, X } from 'lucide-react'; import { useState } from 'react'; import { useMutation } from 'react-query'; import { useLocation } from 'react-router-dom'; @@ -49,7 +49,7 @@ export default function ChatSupportGateway(): JSX.Element { const handleAddCreditCard = (): void => { logEvent('Add Credit card modal: Clicked', { - source: `intercom icon`, + source: `chat support icon`, page: pathname, }); @@ -65,20 +65,14 @@ export default function ChatSupportGateway(): JSX.Element { className="chat-support-gateway-btn" onClick={(): void => { logEvent('Disabled Chat Support: Clicked', { - source: `intercom icon`, + source: `chat support icon`, page: pathname, }); setIsAddCreditCardModalOpen(true); }} > - - - + diff --git a/frontend/src/components/LaunchChatSupport/LaunchChatSupport.tsx b/frontend/src/components/LaunchChatSupport/LaunchChatSupport.tsx index d25e8156eda4..72a621329fd4 100644 --- a/frontend/src/components/LaunchChatSupport/LaunchChatSupport.tsx +++ b/frontend/src/components/LaunchChatSupport/LaunchChatSupport.tsx @@ -24,7 +24,7 @@ export interface LaunchChatSupportProps { buttonText?: string; className?: string; onHoverText?: string; - intercomMessageDisabled?: boolean; + chatMessageDisabled?: boolean; } // eslint-disable-next-line sonarjs/cognitive-complexity @@ -35,7 +35,7 @@ function LaunchChatSupport({ buttonText = '', className = '', onHoverText = '', - intercomMessageDisabled = false, + chatMessageDisabled = false, }: LaunchChatSupportProps): JSX.Element | null { const { isCloudUser: isCloudUserVal } = useGetTenantLicense(); const { notifications } = useNotifications(); @@ -111,8 +111,10 @@ function LaunchChatSupport({ setIsAddCreditCardModalOpen(true); } else { logEvent(eventName, attributes); - if (window.Intercom && !intercomMessageDisabled) { - window.Intercom('showNewMessage', defaultTo(message, '')); + if (window.pylon && !chatMessageDisabled) { + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + window.Pylon('showNewMessage', defaultTo(message, '')); } } }; @@ -220,7 +222,7 @@ LaunchChatSupport.defaultProps = { buttonText: '', className: '', onHoverText: '', - intercomMessageDisabled: false, + chatMessageDisabled: false, }; export default LaunchChatSupport; diff --git a/frontend/src/container/GeneralSettingsCloud/GeneralSettingsCloud.tsx b/frontend/src/container/GeneralSettingsCloud/GeneralSettingsCloud.tsx index 6a8988deafda..43d6994f2001 100644 --- a/frontend/src/container/GeneralSettingsCloud/GeneralSettingsCloud.tsx +++ b/frontend/src/container/GeneralSettingsCloud/GeneralSettingsCloud.tsx @@ -9,7 +9,7 @@ export default function GeneralSettingsCloud(): JSX.Element { Please email us or connect - with us via intercom support to change the retention period. + with us via chat support to change the retention period. ); diff --git a/frontend/src/container/InfraMonitoringHosts/InfraMonitoring.styles.scss b/frontend/src/container/InfraMonitoringHosts/InfraMonitoring.styles.scss index f3bc796809f5..93b16ed8d347 100644 --- a/frontend/src/container/InfraMonitoringHosts/InfraMonitoring.styles.scss +++ b/frontend/src/container/InfraMonitoringHosts/InfraMonitoring.styles.scss @@ -201,7 +201,7 @@ padding: 16px; margin: 0; - // this is to offset intercom icon till we improve the design + // this is to offset chat support icon till we improve the design right: 20px; .ant-pagination-item { diff --git a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityEvents/entityEvents.styles.scss b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityEvents/entityEvents.styles.scss index a3be71803b3e..0feef33b0f2b 100644 --- a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityEvents/entityEvents.styles.scss +++ b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityEvents/entityEvents.styles.scss @@ -173,7 +173,7 @@ padding: 16px; margin: 0; - // this is to offset intercom icon till we improve the design + // this is to offset chat support icon till we improve the design padding-right: 72px; .ant-pagination-item { diff --git a/frontend/src/container/InfraMonitoringK8s/InfraMonitoringK8s.styles.scss b/frontend/src/container/InfraMonitoringK8s/InfraMonitoringK8s.styles.scss index b237d81bd965..4587023d9ecc 100644 --- a/frontend/src/container/InfraMonitoringK8s/InfraMonitoringK8s.styles.scss +++ b/frontend/src/container/InfraMonitoringK8s/InfraMonitoringK8s.styles.scss @@ -447,7 +447,7 @@ padding: 16px; margin: 0; - // this is to offset intercom icon till we improve the design + // this is to offset chat support icon till we improve the design padding-right: 72px; .ant-pagination-item { diff --git a/frontend/src/container/MetricsExplorer/Summary/Summary.styles.scss b/frontend/src/container/MetricsExplorer/Summary/Summary.styles.scss index c46c08066a04..f135ebf3e1a0 100644 --- a/frontend/src/container/MetricsExplorer/Summary/Summary.styles.scss +++ b/frontend/src/container/MetricsExplorer/Summary/Summary.styles.scss @@ -199,7 +199,7 @@ padding: 16px; margin: 0; - // this is to offset intercom icon till we improve the design + // this is to offset chat support icon till we improve the design right: 20px; .ant-pagination-item { diff --git a/frontend/src/index.html.ejs b/frontend/src/index.html.ejs index 1ea5dc5c3ba1..da6ccb6d67f1 100644 --- a/frontend/src/index.html.ejs +++ b/frontend/src/index.html.ejs @@ -59,40 +59,30 @@
diff --git a/frontend/src/pages/Support/Support.tsx b/frontend/src/pages/Support/Support.tsx index fe6517b70ee7..f7d4c13d59c8 100644 --- a/frontend/src/pages/Support/Support.tsx +++ b/frontend/src/pages/Support/Support.tsx @@ -155,10 +155,10 @@ export default function Support(): JSX.Element { page: pathname, }); setIsAddCreditCardModalOpen(true); - } else if (window.Intercom) { + } else if (window.pylon) { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - window.Intercom('show'); + window.Pylon('show'); } }; diff --git a/frontend/src/typings/window.ts b/frontend/src/typings/window.ts index 70a4cdaa40e6..e8f722268aa5 100644 --- a/frontend/src/typings/window.ts +++ b/frontend/src/typings/window.ts @@ -3,7 +3,7 @@ import { compose, Store } from 'redux'; declare global { interface Window { store: Store; - Intercom: any; + pylon: any; Appcues: Record; __REDUX_DEVTOOLS_EXTENSION_COMPOSE__: typeof compose; } diff --git a/frontend/webpack.config.js b/frontend/webpack.config.js index d5b030b9259e..d9f277d9c33d 100644 --- a/frontend/webpack.config.js +++ b/frontend/webpack.config.js @@ -20,7 +20,7 @@ const styleLoader = 'style-loader'; const plugins = [ new HtmlWebpackPlugin({ template: 'src/index.html.ejs', - INTERCOM_APP_ID: process.env.INTERCOM_APP_ID, + PYLON_APP_ID: process.env.PYLON_APP_ID, APPCUES_APP_ID: process.env.APPCUES_APP_ID, POSTHOG_KEY: process.env.POSTHOG_KEY, USERPILOT_KEY: process.env.USERPILOT_KEY, @@ -39,7 +39,7 @@ const plugins = [ NODE_ENV: process.env.NODE_ENV, FRONTEND_API_ENDPOINT: process.env.FRONTEND_API_ENDPOINT, WEBSOCKET_API_ENDPOINT: process.env.WEBSOCKET_API_ENDPOINT, - INTERCOM_APP_ID: process.env.INTERCOM_APP_ID, + PYLON_APP_ID: process.env.PYLON_APP_ID, APPCUES_APP_ID: process.env.APPCUES_APP_ID, POSTHOG_KEY: process.env.POSTHOG_KEY, USERPILOT_KEY: process.env.USERPILOT_KEY, diff --git a/frontend/webpack.config.prod.js b/frontend/webpack.config.prod.js index e285e9018450..7a78d6bc0043 100644 --- a/frontend/webpack.config.prod.js +++ b/frontend/webpack.config.prod.js @@ -25,7 +25,7 @@ const styleLoader = 'style-loader'; const plugins = [ new HtmlWebpackPlugin({ template: 'src/index.html.ejs', - INTERCOM_APP_ID: process.env.INTERCOM_APP_ID, + PYLON_APP_ID: process.env.PYLON_APP_ID, APPCUES_APP_ID: process.env.APPCUES_APP_ID, POSTHOG_KEY: process.env.POSTHOG_KEY, USERPILOT_KEY: process.env.USERPILOT_KEY, @@ -49,7 +49,7 @@ const plugins = [ 'process.env': JSON.stringify({ FRONTEND_API_ENDPOINT: process.env.FRONTEND_API_ENDPOINT, WEBSOCKET_API_ENDPOINT: process.env.WEBSOCKET_API_ENDPOINT, - INTERCOM_APP_ID: process.env.INTERCOM_APP_ID, + PYLON_APP_ID: process.env.PYLON_APP_ID, APPCUES_APP_ID: process.env.APPCUES_APP_ID, POSTHOG_KEY: process.env.POSTHOG_KEY, USERPILOT_KEY: process.env.USERPILOT_KEY,