Skip to content

Commit 9bca6ec

Browse files
committed
Add identifying
1 parent 8fea375 commit 9bca6ec

File tree

19 files changed

+81
-18
lines changed

19 files changed

+81
-18
lines changed

packages/app/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@
230230
"react-stripe-elements": "^1.2.0",
231231
"react-tagsinput": "^3.19.0",
232232
"react-virtualized": "^9.19.1",
233+
"sha1": "^1.1.1",
233234
"shelljs": "^0.7.8",
234235
"shortid": "^2.2.8",
235236
"socket.io-client": "^2.1.1",

packages/app/src/app/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { ApolloProvider } from 'react-apollo';
66
import { Provider } from 'mobx-react';
77

88
import history from 'app/utils/history';
9-
import _debug from 'app/utils/debug';
9+
import _debug from 'common/utils/debug';
1010
import { client } from 'app/graphql/client';
1111
import VERSION from 'common/version';
1212
import registerServiceWorker from 'common/registerServiceWorker';

packages/app/src/app/pages/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { inject, observer } from 'mobx-react';
44
import Loadable from 'app/utils/Loadable';
55
import { Route, Switch, Redirect } from 'react-router-dom';
66

7-
import _debug from 'app/utils/debug';
7+
import _debug from 'common/utils/debug';
88
import Notifications from 'app/pages/common/Notifications';
99
import { DragDropContext } from 'react-dnd';
1010

packages/app/src/app/store/actions.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import axios from 'axios';
22

33
import { generateFileFromSandbox } from 'common/templates/configuration/package-json';
4-
import track, { identify } from 'common/utils/analytics';
4+
import track, { identify, setUserId } from 'common/utils/analytics';
55

66
import { parseConfigurations } from './utils/parse-configurations';
77
import { mainModule, defaultOpenedModule } from './utils/main-module';
@@ -327,9 +327,10 @@ export function removeJwtFromStorage({ jwt }) {
327327
jwt.reset();
328328
}
329329

330-
export function setSignedInCookie() {
330+
export function setSignedInCookie({ props }) {
331331
document.cookie = 'signedIn=true; Path=/;';
332332
identify('signed_in', true);
333+
setUserId(props.user.id);
333334
}
334335

335336
export function listenToConnectionChange({ connection }) {

packages/app/src/app/store/providers/Jwt.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Provider } from 'cerebral';
22
import store from 'store/dist/store.modern';
3-
import { identify } from 'common/utils/analytics';
3+
import { identify, resetUserId } from 'common/utils/analytics';
44

55
export default Provider({
66
get() {
@@ -18,6 +18,7 @@ export default Provider({
1818
document.cookie = `jwt=; Path=/; expires=Thu, 01 Jan 1970 00:00:01 GMT;`;
1919

2020
identify('signed_in', false);
21+
resetUserId();
2122

2223
return store.set('jwt', null);
2324
},

packages/app/src/app/store/providers/Socket.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Provider } from 'cerebral';
22
import { Socket } from 'phoenix';
3-
import _debug from 'app/utils/debug';
3+
import _debug from 'common/utils/debug';
44

55
let socket = null;
66
const debug = _debug('cs:socket');

packages/app/src/app/utils/analytics.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// @flow
2-
import _debug from 'app/utils/debug';
2+
import _debug from 'common/utils/debug';
33
import type { CurrentUser } from 'common/types';
44

55
const debug = _debug('cs:analytics');

packages/app/src/sandbox/compile-old.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { dispatch, clearErrorTransformers } from 'codesandbox-api';
22

3-
import _debug from 'app/utils/debug';
3+
import _debug from 'common/utils/debug';
44
import { inject, unmount } from 'sandbox-hooks/react-error-overlay/overlay';
55
import initializeErrorTransformers from 'sandbox-hooks/errors/transformers';
66
import { Encode } from 'console-feed/lib/Transform';

packages/app/src/sandbox/compile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { dispatch, reattach, clearErrorTransformers } from 'codesandbox-api';
22
import { absolute } from 'common/utils/path';
3-
import _debug from 'app/utils/debug';
3+
import _debug from 'common/utils/debug';
44
import parseConfigurations from 'common/templates/configuration/parse';
55
import initializeErrorTransformers from 'sandbox-hooks/errors/transformers';
66
import { inject, unmount } from 'sandbox-hooks/react-error-overlay/overlay';

packages/app/src/sandbox/eval/cache.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Responsible for consuming and syncing with the server/local cache
22
import localforage from 'localforage';
3-
import _debug from 'app/utils/debug';
3+
import _debug from 'common/utils/debug';
44
import type { default as Manager } from './manager';
55

66
import { SCRIPT_VERSION } from '../';

0 commit comments

Comments
 (0)