feat: init pylon and deprecate intercom (#8059)

This commit is contained in:
Vishal Sharma 2025-05-28 07:11:11 +05:30 committed by GitHub
parent 9c8435119d
commit 3d758d4358
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 64 additions and 84 deletions

View File

@ -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"

View File

@ -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 "
}

View File

@ -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 "
}

View File

@ -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,
},
};
}
}
}, [

View File

@ -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);
};

View File

@ -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 {

View File

@ -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);
}}
>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 28 32"
className="chat-support-gateway-btn-icon"
>
<path d="M28 32s-4.714-1.855-8.527-3.34H3.437C1.54 28.66 0 27.026 0 25.013V3.644C0 1.633 1.54 0 3.437 0h21.125c1.898 0 3.437 1.632 3.437 3.645v18.404H28V32zm-4.139-11.982a.88.88 0 00-1.292-.105c-.03.026-3.015 2.681-8.57 2.681-5.486 0-8.517-2.636-8.571-2.684a.88.88 0 00-1.29.107 1.01 1.01 0 00-.219.708.992.992 0 00.318.664c.142.128 3.537 3.15 9.762 3.15 6.226 0 9.621-3.022 9.763-3.15a.992.992 0 00.317-.664 1.01 1.01 0 00-.218-.707z" />
</svg>
<MessageSquareText size={24} />
</Button>
</div>

View File

@ -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;

View File

@ -9,7 +9,7 @@ export default function GeneralSettingsCloud(): JSX.Element {
<Info size={16} />
<Typography.Text>
Please <a href="mailto:cloud-support@signoz.io"> email us </a> or connect
with us via intercom support to change the retention period.
with us via chat support to change the retention period.
</Typography.Text>
</Card>
);

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -59,40 +59,30 @@
<div id="root"></div>
<script>
//Set your APP_ID
const APP_ID = '<%= htmlWebpackPlugin.options.INTERCOM_APP_ID %>';
(function () {
var w = window;
var ic = w.Intercom;
if (typeof ic === 'function') {
ic('reattach_activator');
ic('update', w.intercomSettings);
} else {
var d = document;
var i = function () {
i.c(arguments);
const PYLON_APP_ID = '<%= htmlWebpackPlugin.options.PYLON_APP_ID %>';
(function() {
var e = window;
var t = document;
var n = function() {
n.e(arguments);
};
i.q = [];
i.c = function (args) {
i.q.push(args);
n.q = [];
n.e = function(e) {
n.q.push(e);
};
w.Intercom = i;
var l = function () {
var s = d.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = 'https://widget.intercom.io/widget/' + APP_ID;
var x = d.getElementsByTagName('script')[0];
x.parentNode.insertBefore(s, x);
e.Pylon = n;
var r = function() {
var e = t.createElement("script");
e.setAttribute("type", "text/javascript");
e.setAttribute("async", "true");
e.setAttribute("src", "https://widget.usepylon.com/widget/" + PYLON_APP_ID);
var n = t.getElementsByTagName("script")[0];
n.parentNode.insertBefore(e, n);
};
if (document.readyState === 'complete') {
l();
} else if (w.attachEvent) {
w.attachEvent('onload', l);
} else {
w.addEventListener('load', l, false);
}
if (t.readyState === "complete") {
r();
} else if (e.addEventListener) {
e.addEventListener("load", r, false);
}
})();
</script>

View File

@ -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');
}
};

View File

@ -3,7 +3,7 @@ import { compose, Store } from 'redux';
declare global {
interface Window {
store: Store;
Intercom: any;
pylon: any;
Appcues: Record<string, any>;
__REDUX_DEVTOOLS_EXTENSION_COMPOSE__: typeof compose;
}

View File

@ -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,

View File

@ -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,