Skip to content

Commit

Permalink
no ad
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Oct 21, 2019
1 parent 91e191c commit f6c86ea
Show file tree
Hide file tree
Showing 12 changed files with 5,506 additions and 8,055 deletions.
20 changes: 1 addition & 19 deletions build/ci-scripts/sending.bundle.size.analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,6 @@ const fs = require('fs');
const path = require('path');
const fetch = require('node-fetch');

function sendToRedash(body) {
return fetch('https://analytics.atlassian.com/analytics/events', {
method: 'POST',
headers: {
Accept: 'application/json, */*',
'Content-Type': 'application/json',
},
body,
});
}

const buildEventPayload = (properties, eventName) => {
return {
Expand Down Expand Up @@ -64,13 +54,5 @@ const prepareData = pathToFolder => {
buildEventPayload(pkgData, 'atlaskit.computed.bundle.size.per.package'),
),
});
sendToRedash(bundleSizeDataEvents)
.then(res => {
console.log(`Sent bundle size data to Redash`);
})
.catch(err => {
console.log(`Something went wrong while sending data: ${err}`);
// Doing so, we don't fail the script in pipelines if an error occurs.
process.exit(0);
});

})();
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"author": "Atlassian Pty Ltd",
"license": "Apache-2.0",
"scripts": {
"build": " cd build/ci-scripts && yarn build @atlaskit/local-linking2",
"build": " cd build/ci-scripts && yarn build ",
"build:clean": " yarn delete:build:artifacts && yarn build",
"build:editor-mobile-bridge": " cd packages/editor/editor-mobile-bridge && yarn build",
"build:adf-schema:checkuptodate": " cd packages/editor/adf-schema && yarn run generate:json-schema && git diff --exit-code",
Expand Down
33 changes: 1 addition & 32 deletions packages/editor/editor-core/src/create-editor/ErrorBoundary.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as React from 'react';
import { sendLogs } from '../utils/sendLogs';
import { ContextIdentifierProvider } from '@atlaskit/editor-common';

export type ErrorBoundaryProps = {
Expand All @@ -18,37 +17,7 @@ export default class ErrorBoundary extends React.Component<
error: undefined,
};

async componentDidCatch(error: Error, errorInfo: any) {
let product = 'atlaskit';
if (this.props.contextIdentifierProvider) {
const context = await this.props.contextIdentifierProvider;
if (context.product) {
product = context.product;
}
}
await sendLogs({
events: [
{
name: 'atlaskit.fabric.editor.editorCrash',
product,
properties: {
error: error.message,
stack: error.stack,
componentTrace: errorInfo,
},
serverTime: new Date().getTime(),
server: 'local',
user: '-',
},
],
});
this.setState(
{
error,
},
() => this.setState({ error: undefined }),
);
}


render() {
if (this.state.error) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Step } from 'prosemirror-transform';
import { Plugin, Transaction } from 'prosemirror-state';
import { sendLogs } from '../../../utils/sendLogs';


const hasInvalidSteps = (tr: Transaction) =>
((tr.steps || []) as (Step & { from: number; to: number })[]).some(
Expand All @@ -17,20 +17,7 @@ export default () => {
tr.steps,
);

sendLogs({
events: [
{
name: 'atlaskit.fabric.editor.invalidstep',
product: 'atlaskit',
properties: {
message: 'Blocked transaction with invalid steps',
},
serverTime: new Date().getTime(),
server: 'local',
user: '-',
},
],
});

return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,6 @@ function mockJiraApi(delayMs: number, canSearchUsers: boolean) {
);
}

function mockAnalyticsApi() {
fetchMock.mock('https://analytics.atlassian.com/analytics/events', 200);
}

function mockAutocompleteApi(delayMs: number, autocomplete: string[]) {
fetchMock.get(
new RegExp('gateway/api/ccsearch-autocomplete'),
Expand Down Expand Up @@ -194,7 +190,7 @@ export function setupMocks(configOverrides: Partial<MocksConfig> = {}) {
);
const queryPeopleSearch = makePeopleSearchData();

mockAnalyticsApi();

mockCrossProductSearchApi(config.crossProductSearchDelay, queryMockSearch);
mockCrossProductExperimentApi(
config.crossProductSearchDelay,
Expand Down
2 changes: 1 addition & 1 deletion website/public/sitemap.xml

Large diffs are not rendered by default.

27 changes: 0 additions & 27 deletions website/scripts/uploadBundleAnalyticsEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,3 @@ const events = knownSplitsAssets.map(asset => ({
},
}));

sendAnalyticsEvents(events)
.then(() => console.log('Success!'))
.catch(err => {
console.log(err);
process.exit(1);
});

function sendAnalyticsEvents(events) {
return fetchUrl('https://analytics.atlassian.com/analytics/events', {
method: 'POST',
headers: {
Accept: 'application/json, */*',
'Content-Type': 'application/json',
},
body: JSON.stringify({
events: events.map(event => ({
name: event.name,
properties: event.properties,
server: 'dev',
product: 'atlaskit',
subproduct: 'website-bundle-splits',
user: '-',
serverTime: Date.now(),
})),
}),
});
}
8 changes: 0 additions & 8 deletions website/src/components/WrappedLoader.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import Loadable from 'react-loadable';
import { sendApdex } from './Analytics/GoogleAnalyticsListener';

function checkMarkAndSendAnalytics() {
if (!performance.mark) {
Expand All @@ -18,13 +17,6 @@ function checkMarkAndSendAnalytics() {
if (navigate && loaded) {
performance.measure('analytics-measure', navigate.name, 'loaded');

let entries = performance.getEntriesByName('analytics-measure', 'measure');
if (entries.length === 1 && entries[0].duration) {
sendApdex(
navigate.name.replace('navigate-', ''),
Math.round(entries[0].duration),
);
}
}

performance.clearMarks('loaded');
Expand Down
63 changes: 29 additions & 34 deletions website/src/containers/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import { BrowserRouter, Switch, Route } from 'react-router-dom';
import { DESKTOP_BREAKPOINT_MIN } from '../constants';
import FullscreenExamples from '../pages/Examples';
import { modalRoutes, pageRoutes } from '../routes';
import ScrollHandler from '../components/ScrollToTop';
import ErrorBoundary from '../components/ErrorBoundary';
import AnalyticsListeners from '../components/Analytics/AnalyticsListeners';
import DesktopNav from './DesktopNav';
import MobileNav from './MobileNav';

Expand All @@ -20,39 +18,36 @@ export default () => {
<BrowserRouter>
<Media query={`(min-width: ${DESKTOP_BREAKPOINT_MIN}px)`}>
{(isDesktop: boolean) => (
<AnalyticsListeners>
<ScrollHandler />
<Switch>
<Route
path="/examples/:groupId?/:pkgId?/:exampleId*"
component={FullscreenExamples}
/>
<Route
render={appRouteDetails => (
<Page
navigation={
isDesktop ? <DesktopNav {...appRouteDetails} /> : false
}
>
{!isDesktop && (
<MobileNav appRouteDetails={appRouteDetails} />
)}
<ErrorBoundary>
<Switch>
{pageRoutes.map((routeProps: RouteProps, index) => (
<Route {...routeProps} key={index} />
))}
</Switch>

{modalRoutes.map((modal, index) => (
<Route {...modal} key={index} />
<Switch>
<Route
path="/examples/:groupId?/:pkgId?/:exampleId*"
component={FullscreenExamples}
/>
<Route
render={appRouteDetails => (
<Page
navigation={
isDesktop ? <DesktopNav {...appRouteDetails} /> : false
}
>
{!isDesktop && (
<MobileNav appRouteDetails={appRouteDetails} />
)}
<ErrorBoundary>
<Switch>
{pageRoutes.map((routeProps: RouteProps, index) => (
<Route {...routeProps} key={index} />
))}
</ErrorBoundary>
</Page>
)}
/>
</Switch>
</AnalyticsListeners>
</Switch>

{modalRoutes.map((modal, index) => (
<Route {...modal} key={index} />
))}
</ErrorBoundary>
</Page>
)}
/>
</Switch>
)}
</Media>
</BrowserRouter>
Expand Down
1 change: 0 additions & 1 deletion website/src/containers/DesktopNav/navigations/Docs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export type DocsNavProps = {
};

export default function DocsNav({ pathname, docs, onClick }: DocsNavProps) {
console.log(docs)
const groups = buildNavGroups('docs', PageIcon, pathname, docs);
return <div>{renderNav(groups, { pathname, onClick })}</div>;
}
19 changes: 0 additions & 19 deletions website/src/pages/Examples/loader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ import packageResolver from '../../utils/packageResolver';
import * as fs from '../../utils/fs';
import { File } from '../../types';
import Loading from '../../components/Loading';
import {
sendInitialApdex,
initializeGA,
observePerformanceMetrics,
} from '../../components/Analytics/GoogleAnalyticsListener';

const ErrorMessage = styled.div`
background-color: ${colors.R400};
Expand Down Expand Up @@ -115,21 +110,7 @@ ${error}`);
}
}

componentDidMount() {
if (window.self === window.top) {
const location = window.location.pathname + window.location.search;
window.addEventListener(
'load',
() => {
sendInitialApdex(location);
},
{ once: true },
);
observePerformanceMetrics(location);
}

initializeGA();
}

render() {
const { example, packageId, exampleId } = packageResolver(
Expand Down
Loading

0 comments on commit f6c86ea

Please sign in to comment.