Skip to content

Commit 6d8353d

Browse files
authored
fix: revert "feat: add analytics" (#1188) (#1200)
* Revert "feat: add analytics (#1188)" This reverts commit ef86b5b. * Create mean-foxes-change.md
1 parent 03cee89 commit 6d8353d

File tree

14 files changed

+42
-274
lines changed

14 files changed

+42
-274
lines changed

.changeset/mean-foxes-change.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@asyncapi/studio": patch
3+
---
4+
5+
chore: revert "feat: add analytics" (#1188)

apps/studio/src/app/layout.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ import 'tippy.js/animations/shift-away.css';
66
import '@asyncapi/react-component/styles/default.min.css';
77
import 'reactflow/dist/style.css';
88
import './globals.css'
9-
import { GoogleTagManager, GoogleTagManagerNoScript } from '@/components/common/GoogleTagManager';
10-
11-
const GTM_ID = process.env.NEXT_PUBLIC_ANALYTICS_ID ?? '';
129

1310
export default function RootLayout({
1411
children,
@@ -17,9 +14,8 @@ export default function RootLayout({
1714
}) {
1815
return (
1916
<html lang="en">
20-
<head>{GTM_ID && <GoogleTagManager gtmId={GTM_ID} />}</head>
2117
<body>
22-
{GTM_ID && <GoogleTagManagerNoScript gtmId={GTM_ID} />} <Toolbar />
18+
<Toolbar />
2319
<main className="flex flex-col w-full h-[calc(100vh-4rem)]">
2420
{children}
2521
</main>

apps/studio/src/components/Editor/ConvertDropdown.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { ConvertModal } from '../Modals';
77
import { Dropdown, Tooltip } from '../common';
88
import { useServices } from '@/services';
99
import { useDocumentsState, useFilesState } from '../../state';
10-
import { trackEvent } from '@/helpers/analytics';
1110

1211
export const ConvertDropdown: React.FC = () => {
1312
const { editorSvc } = useServices();
@@ -35,7 +34,6 @@ export const ConvertDropdown: React.FC = () => {
3534
className="px-4 py-1 w-full text-left text-sm rounded-md focus:outline-none transition ease-in-out duration-150 disabled:cursor-not-allowed"
3635
title={`Convert to ${language === 'yaml' ? 'JSON' : 'YAML'}`}
3736
onClick={() => {
38-
trackEvent('Convert', 'click', language === 'yaml' ? 'JSON' : 'YAML');
3937
toast.promise(
4038
language === 'yaml'
4139
? editorSvc.convertToJSON()
@@ -69,10 +67,7 @@ export const ConvertDropdown: React.FC = () => {
6967
type="button"
7068
className="px-4 py-1 w-full text-left text-sm rounded-md focus:outline-none transition ease-in-out duration-150"
7169
title="Convert AsyncAPI document"
72-
onClick={() => {
73-
trackEvent('Convert', 'click', 'Open convert document modal');
74-
show(ConvertModal);
75-
}}
70+
onClick={() => show(ConvertModal)}
7671
>
7772
Convert document
7873
</button>

apps/studio/src/components/Editor/GenerateDropdown.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { GeneratorModal } from '../Modals';
77
import { Dropdown, Tooltip } from '../common';
88
import { useDocumentsState } from '../../state';
99
import { useServices } from '@/services';
10-
import { trackEvent} from '@/helpers/analytics';
1110

1211
export const GenerateDropdown: React.FC = () => {
1312
const isInvalidDocument = !useDocumentsState(state =>
@@ -34,10 +33,7 @@ export const GenerateDropdown: React.FC = () => {
3433
className="px-4 py-1 w-full text-left text-sm rounded-md focus:outline-none transition ease-in-out duration-150 disabled:cursor-not-allowed"
3534
title="Generate code/docs"
3635
disabled={isInvalidDocument}
37-
onClick={() => {
38-
trackEvent('Generate', 'click', 'Generate code/docs')
39-
show(GeneratorModal)
40-
}}
36+
onClick={() => show(GeneratorModal)}
4137
>
4238
Generate code/docs
4339
</button>
@@ -48,7 +44,6 @@ export const GenerateDropdown: React.FC = () => {
4844
className="px-4 py-1 w-full text-left text-sm rounded-md focus:outline-none transition ease-in-out duration-150 disabled:cursor-not-allowed"
4945
title='Share as Base64'
5046
onClick={() => {
51-
trackEvent('Generate', 'click', 'Share as Base64');
5247
toast.promise(
5348
(async function () {
5449
const base64 = await editorSvc.exportAsBase64();

apps/studio/src/components/Editor/ImportDropdown.tsx

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import React from 'react';
22
import toast from 'react-hot-toast';
33
import { show } from '@ebay/nice-modal-react';
44
import { FaFileImport } from 'react-icons/fa';
5-
import { trackEvent} from '@/helpers/analytics';
65

76
import {
87
ImportURLModal,
@@ -34,10 +33,7 @@ export const ImportDropdown: React.FC = () => {
3433
type="button"
3534
className="px-4 py-1 w-full text-left text-sm rounded-md focus:outline-none transition ease-in-out duration-150"
3635
title="Import from URL"
37-
onClick={() => {
38-
trackEvent('Import', 'click', 'Import AsyncAPI document from URL')
39-
show(ImportURLModal)
40-
}}
36+
onClick={() => show(ImportURLModal)}
4137
>
4238
Import from URL
4339
</button>
@@ -53,13 +49,12 @@ export const ImportDropdown: React.FC = () => {
5349
accept='.yaml, .yml, .json'
5450
style={{ position: 'fixed', top: '-100em' }}
5551
onChange={event => {
56-
trackEvent('Import', 'file_upload', 'Import File');
5752
toast.promise(editorSvc.importFile(event.target.files), {
5853
loading: 'Importing...',
5954
success: (
6055
<div>
6156
<span className="block text-bold">
62-
Document successfully imported!
57+
Document succesfully imported!
6358
</span>
6459
</div>
6560
),
@@ -82,10 +77,7 @@ export const ImportDropdown: React.FC = () => {
8277
type="button"
8378
className="px-4 py-1 w-full text-left text-sm rounded-md focus:outline-none transition ease-in-out duration-150"
8479
title="Import from Base64"
85-
onClick={() => {
86-
trackEvent('Import', 'click', 'Import AsyncAPI document from Base64')
87-
show(ImportBase64Modal)
88-
}}
80+
onClick={() => show(ImportBase64Modal)}
8981
>
9082
Import from Base64
9183
</button>
@@ -96,10 +88,7 @@ export const ImportDropdown: React.FC = () => {
9688
type="button"
9789
className="px-4 py-1 w-full text-left text-sm rounded-md focus:outline-none transition ease-in-out duration-150"
9890
title="Import from UUID"
99-
onClick={() => {
100-
trackEvent('Import', 'click', 'Import AsyncAPI document from UUID');
101-
show(ImportUUIDModal);
102-
}}
91+
onClick={() => show(ImportUUIDModal)}
10392
>
10493
Import from UUID
10594
</button>

apps/studio/src/components/Editor/SaveDropdown.tsx

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { FaSave } from 'react-icons/fa';
55
import { Dropdown, Tooltip } from '../common';
66
import { useServices } from '@/services';
77
import { useDocumentsState, useFilesState } from '../../state';
8-
import { trackEvent } from '@/helpers/analytics';
98

109
export const SaveDropdown: React.FC = () => {
1110
const { editorSvc } = useServices();
@@ -33,11 +32,6 @@ export const SaveDropdown: React.FC = () => {
3332
className="px-4 py-1 w-full text-left text-sm rounded-md focus:outline-none transition ease-in-out duration-150 disabled:cursor-not-allowed"
3433
title={`Save as ${language === 'yaml' ? 'YAML' : 'JSON'}`}
3534
onClick={() => {
36-
trackEvent(
37-
'Save',
38-
'click',
39-
`Save AsyncAPI document as ${language}`,
40-
);
4135
toast.promise(
4236
language === 'yaml'
4337
? editorSvc.saveAsYaml()
@@ -72,13 +66,6 @@ export const SaveDropdown: React.FC = () => {
7266
className="px-4 py-1 w-full text-left text-sm rounded-md focus:outline-none transition ease-in-out duration-150 disabled:cursor-not-allowed"
7367
title={`Convert and save as ${language === 'yaml' ? 'JSON' : 'YAML'}`}
7468
onClick={() => {
75-
trackEvent(
76-
'Save',
77-
'click',
78-
`Convert and save AsyncAPI document as ${
79-
language === 'yaml' ? 'JSON' : 'YAML'
80-
}`,
81-
);
8269
toast.promise(
8370
language === 'yaml'
8471
? editorSvc.saveAsJSON()

apps/studio/src/components/Editor/ShareButton.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@ import { FaShareAlt } from 'react-icons/fa';
33
import { useServices } from '../../services';
44
import { toast } from 'react-hot-toast';
55
import { Tooltip } from '../common';
6-
import { trackEvent } from '@/helpers/analytics';
76

87
interface ShareButtonProps {}
98

109
export const ShareButton: React.FunctionComponent<ShareButtonProps> = () => {
1110
const { editorSvc } = useServices();
1211

1312
const handleShare = () => {
14-
trackEvent('Share Button', 'click', 'Share AsyncAPI document');
1513
toast.promise(
1614
(async function () {
1715
const url = await editorSvc.exportAsURL();

apps/studio/src/components/SplitPane/Pane.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/* eslint-disable */
22
// @ts-nocheck
33

4-
import { trackEvent } from "@/helpers/analytics";
5-
64
function Pane(props) {
75
const { children, className, split, style: styleProps, size, eleRef } = props;
86

@@ -25,7 +23,6 @@ function Pane(props) {
2523
}
2624

2725
style = Object.assign({}, style, styleProps || {});
28-
trackEvent('SplitPane', 'render', `Pane rendered with size: ${size || 'default'}`);
2926

3027
return (
3128
<div ref={eleRef} className={classes.join(' ')} style={style}>

apps/studio/src/components/Template/TemplateSidebar.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import React from 'react';
22
import { VscRefresh } from 'react-icons/vsc';
33

44
import { useSettingsState, otherState } from '../../state';
5-
import { trackEvent } from '@/helpers/analytics';
65

76
interface TemplateSidebarProps {}
87

@@ -18,10 +17,7 @@ export const TemplateSidebar: React.FunctionComponent<TemplateSidebarProps> = ()
1817
<div />
1918
) : (
2019
<div className="ml-2 text-gray-500 text-xs flex" style={{ height: '30px', lineHeight: '30px' }}>
21-
<button type="button" className="text-xs" onClick={() => {
22-
trackEvent('Template', 'rerender', 'Manual template rerender');
23-
otherState.setState({ templateRerender: true });
24-
}}>
20+
<button type="button" className="text-xs" onClick={() => otherState.setState({ templateRerender: true })}>
2521
<div className="inline-block">
2622
<VscRefresh className="w-4 h-4 mt-1" />
2723
</div>

apps/studio/src/components/Terminal/ProblemsTab.tsx

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { FunctionComponent, useCallback, useMemo, useRef, useState, useEffect } from 'react';
1+
import React, { FunctionComponent, useCallback, useMemo, useRef, useState } from 'react';
22
import { VscError, VscWarning, VscInfo, VscLightbulb, VscSearch, VscClose, VscSettingsGear } from 'react-icons/vsc';
33
import { useModal } from '@ebay/nice-modal-react';
44
import { DiagnosticSeverity } from '@asyncapi/parser';
@@ -11,7 +11,6 @@ import { debounce } from '../../helpers';
1111
import { useDocumentsState, useSettingsState } from '../../state';
1212

1313
import type { Diagnostic } from '@asyncapi/parser';
14-
import { trackEvent } from '@/helpers/analytics';
1514

1615
interface ProblemsTabProps {}
1716

@@ -208,10 +207,6 @@ export const ProblemsTabContent: FunctionComponent<ProblemsTabProps> = () => {
208207
const [search, setSearch] = useState<string>('');
209208
const inputRef = useRef<HTMLInputElement>(null);
210209

211-
useEffect(() => {
212-
trackEvent('Diagnostics', 'panel_opened', 'Problems tab opened');
213-
}, []);
214-
215210
const setActiveFn = useCallback((severity: DiagnosticSeverity) => {
216211
setActive(acc => {
217212
if (acc.some(s => s === severity)) {
@@ -241,19 +236,11 @@ export const ProblemsTabContent: FunctionComponent<ProblemsTabProps> = () => {
241236
<SeverityButtons active={active} setActive={setActiveFn} />
242237
<div className='ml-2 flex-1 flex flex-row items-center justify-center rounded-md border border-transparent shadow-xs px-2 py-1 bg-gray-700 text-xs font-medium'>
243238
<VscSearch />
244-
<input ref={inputRef} placeholder='Filter diagnostics...' className='w-full bg-gray-700 border-transparent ml-2 focus:border-transparent focus:ring-0 focus:outline-none' onChange={debounce((e) => {
245-
setSearch(e.target.value)
246-
if (e.target.value.length > 2 || e.target.value.length === 0) {
247-
trackEvent('Diagnostics', 'search', `Search term: "${e.target.value}"`);
248-
}
249-
}, 250)} />
239+
<input ref={inputRef} placeholder='Filter diagnostics...' className='w-full bg-gray-700 border-transparent ml-2 focus:border-transparent focus:ring-0 focus:outline-none' onChange={debounce((e) => setSearch(e.target.value), 250)} />
250240
<button type='button' className={`hover:bg-gray-900 rounded-sm border border-transparent ${search ? 'opacity-100' : 'opacity-0'}`} onClick={() => {
251241
if (inputRef.current) {
252242
inputRef.current.value = '';
253243
}
254-
if (search) {
255-
trackEvent('Diagnostics', 'search_clear', 'Search cleared');
256-
}
257244
setSearch('');
258245
}}>
259246
<VscClose />
@@ -263,14 +250,7 @@ export const ProblemsTabContent: FunctionComponent<ProblemsTabProps> = () => {
263250
<button
264251
type="button"
265252
className={'justify-center border border-transparent shadow-xs px-2 py-1 ml-2 text-xs rounded-md font-medium text-white hover:bg-gray-900 focus:outline-none focus:ring-1 focus:ring-offset-1 focus:ring-gray-700'}
266-
onClick={() => {
267-
trackEvent(
268-
'Diagnostics',
269-
'settings_open',
270-
'Opened governance settings'
271-
);
272-
modal.show({ activeTab: 'governance' })
273-
}}
253+
onClick={() => modal.show({ activeTab: 'governance' })}
274254
>
275255
<VscSettingsGear className='w-4 h-4' />
276256
</button>
@@ -294,23 +274,14 @@ export const ProblemsTabContent: FunctionComponent<ProblemsTabProps> = () => {
294274
<td className="px-2 py-1 text-right"><SeverityIcon severity={severity} /></td>
295275
<td
296276
className="px-2 py-1 cursor-pointer"
297-
onClick={() => {
298-
trackEvent('Diagnostics', 'diagnostic_click', `Clicked on diagnostic at line ${range.start.line + 1}`);
277+
onClick={() =>
299278
navigationSvc.scrollToEditorLine(
300279
range.start.line + 1,
301280
range.start.character + 1,
302281
)
303282
}
304-
}
305283
onKeyDown={(e) => {
306284
if (e.key === 'Enter') {
307-
trackEvent(
308-
'Diagnostics',
309-
'diagnostic_click',
310-
`Clicked on diagnostic at line ${
311-
range.start.line + 1
312-
}`
313-
);
314285
navigationSvc.scrollToEditorLine(
315286
range.start.line + 1,
316287
range.start.character + 1,

0 commit comments

Comments
 (0)