Skip to content

Commit 16e1bc8

Browse files
author
Bogdan Tsechoev
committed
Merge branch 'remove_intercom' into 'master'
Remove Intercom widget See merge request postgres-ai/database-lab!891
2 parents 1aec1d1 + 978b588 commit 16e1bc8

File tree

11 files changed

+6
-217
lines changed

11 files changed

+6
-217
lines changed

ui/packages/platform/public/index.html

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,5 @@
4545
You need to enable JavaScript to run this app.
4646
</noscript>
4747
<div id="root"></div>
48-
<script>
49-
window.intercomSettings = {
50-
app_id: "i81m9xmi"
51-
};
52-
</script>
53-
<script>(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);};i.q=[];i.c=function(args){i.q.push(args);};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/i81m9xmi';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);};if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})();
54-
</script>
5548
</body>
5649
</html>

ui/packages/platform/src/components/IndexPage/IndexPage.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,13 +1322,6 @@ class IndexPage extends Component<IndexPageWithStylesProps, IndexPageState> {
13221322
if (raw) {
13231323
return (
13241324
<>
1325-
<style>
1326-
{`
1327-
div.intercom-lightweight-app {
1328-
display: none!important;
1329-
}
1330-
`}
1331-
</style>
13321325
<Switch>
13331326
<Route
13341327
path="/:org"

ui/packages/platform/src/components/OrgForm/OrgForm.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import { WarningWrapper } from 'components/Warning/WarningWrapper'
3939
import { messages } from '../../assets/messages'
4040
import { formatAlias } from 'utils/aliases'
4141
import { OrgFormProps } from 'components/OrgForm/OrgFormWrapper'
42+
import { linksConfig } from "@postgres.ai/shared/config/links";
4243

4344
interface OrgFormWithStylesProps extends OrgFormProps {
4445
classes: ClassesType
@@ -539,16 +540,13 @@ class OrgForm extends Component<OrgFormWithStylesProps, OrgFormState> {
539540
No&nbsp;&nbsp;
540541
<span className={classes.errorMessage}>
541542
To confirm&nbsp;
542-
<span
543-
className={
544-
window.Intercom && classes.supportLink
545-
}
546-
onClick={() =>
547-
window.Intercom && window.Intercom('show')
548-
}
543+
<a
544+
className={classes.supportLink}
545+
href={linksConfig.support}
546+
target="_blank"
549547
>
550548
contact support
551-
</span>
549+
</a>
552550
</span>
553551
</span>
554552
)}

ui/packages/platform/src/components/SharedUrl/SharedUrl.tsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -168,15 +168,6 @@ class SharedUrl extends Component<SharedUrlWithStylesProps, SharedUrlState> {
168168

169169
return (
170170
<>
171-
<style>
172-
{`
173-
.intercom-lightweight-app-launcher,
174-
iframe.intercom-launcher-frame {
175-
bottom: 30px!important;
176-
right: 30px!important;
177-
}
178-
`}
179-
</style>
180171
{page}
181172
{showBanner && banner}
182173
</>

ui/packages/platform/src/hooks/useFloatingIntercom.ts

Lines changed: 0 additions & 96 deletions
This file was deleted.

ui/packages/platform/src/hooks/useHideIntercom.ts

Lines changed: 0 additions & 38 deletions
This file was deleted.

ui/packages/platform/src/pages/Bot/BotWrapper.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { BotPage } from "./index";
22
import {RouteComponentProps} from "react-router";
33
import {AlertSnackbarProvider} from "@postgres.ai/shared/components/AlertSnackbar/useAlertSnackbar";
44
import { AiBotProvider } from "./hooks";
5-
import { useHideIntercom } from "../../hooks/useHideIntercom";
65

76
export interface BotWrapperProps {
87
envData: {
@@ -25,7 +24,6 @@ export interface BotWrapperProps {
2524

2625

2726
export const BotWrapper = (props: BotWrapperProps) => {
28-
useHideIntercom();
2927
return (
3028
<AlertSnackbarProvider>
3129
<AiBotProvider args={{ threadId: props.match.params.threadId, orgId: props.orgData.id }}>

ui/packages/platform/src/pages/Bot/Command/Command.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ import { theme } from "@postgres.ai/shared/styles/theme";
1616
import { isMobileDevice } from "../../../utils/utils";
1717
import { useAiBot } from "../hooks";
1818
import { ReadyState } from "react-use-websocket";
19-
import { useFloatingIntercom } from "../../../hooks/useFloatingIntercom";
20-
2119

2220
type Props = {
2321
threadId?: string

ui/packages/platform/src/pages/JoeInstance/Command/index.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { makeStyles } from '@material-ui/core'
44
import { Button } from '@postgres.ai/shared/components/Button'
55
import { TextField } from '@postgres.ai/shared/components/TextField'
66

7-
import { useFloatingIntercom } from 'hooks/useFloatingIntercom'
87

98
import {
109
checkIsSendCmd,
@@ -133,11 +132,6 @@ export const Command = React.memo((props: Props) => {
133132
inputRef.current.focus()
134133
}, [])
135134

136-
// Floating intercom.
137-
const sendButtonRef = useRef<HTMLButtonElement | null>(null)
138-
139-
useFloatingIntercom(sendButtonRef)
140-
141135
return (
142136
<div className={classes.root}>
143137
<TextField
@@ -162,7 +156,6 @@ export const Command = React.memo((props: Props) => {
162156
<Button
163157
className={classes.button}
164158
onClick={triggerSend}
165-
ref={sendButtonRef}
166159
>
167160
Send
168161
</Button>

ui/packages/platform/src/react-app-env.d.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,3 @@ declare namespace NodeJS {
1616
readonly BUILD_TIMESTAMP: number
1717
}
1818
}
19-
20-
// Intercom types.
21-
declare interface Window {
22-
Intercom?: (action: 'show') => void
23-
}

ui/packages/platform/src/stores/store.js

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -380,42 +380,6 @@ const Store = Reflux.createStore({
380380
if (!this.data.userProfile.error && data.length > 0) {
381381
this.data.userProfile.data = data[0];
382382
this.data.userProfile.isProcessed = true;
383-
384-
if (window.intercomSettings) {
385-
let name = null;
386-
387-
if (data[0].info.email.split('@').length > 0) {
388-
name = data[0].info.email.split('@')[0];
389-
}
390-
391-
if (data[0].info.first_name) {
392-
name = data[0].info.first_name;
393-
if (data[0].info.last_name) {
394-
name = name + ' ' + data[0].info.last_name;
395-
}
396-
}
397-
window.intercomSettings.name = name;
398-
window.intercomSettings.email = data[0].info.email;
399-
window.intercomSettings.user_id = data[0].info.id;
400-
window.intercomSettings.created_at = data[0].info.created_at;
401-
402-
if (data[0].orgs) {
403-
window.intercomSettings.companies = [];
404-
405-
for (let i in data[0].orgs) {
406-
if (data[0].orgs.hasOwnProperty(i)) {
407-
window.intercomSettings.companies.push({
408-
company_id: data[0].orgs[i].id,
409-
name: data[0].orgs[i].name
410-
});
411-
}
412-
}
413-
}
414-
415-
if (window.Intercom) {
416-
window.Intercom('update');
417-
}
418-
}
419383
}
420384

421385
this.trigger(this.data);

0 commit comments

Comments
 (0)