Skip to content

Commit 42a77a2

Browse files
committed
Turn on Mixpanel tracking for deployment
1 parent e99f402 commit 42a77a2

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/app/containers/MainContainer.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ function MainContainer(): any {
3232
const port = chrome.runtime.connect();
3333

3434
// listen for a message containing snapshots from the background script
35-
port.onMessage.addListener((message:{action:string, payload:Record<string, unknown>, sourceTab:number}) => {
35+
port.onMessage.addListener((message: { action: string, payload: Record<string, unknown>, sourceTab: number }) => {
3636
const { action, payload, sourceTab } = message;
3737
let maxTab;
3838
if (!sourceTab) {
39-
const tabsArray:any = Object.keys(payload);
39+
const tabsArray: any = Object.keys(payload);
4040
maxTab = Math.max(...tabsArray);
4141
}
4242
switch (action) {
@@ -75,23 +75,23 @@ function MainContainer(): any {
7575
/**
7676
* get set cookies for mixpanel analytics
7777
**/
78-
useEffect( () => {
78+
useEffect(() => {
7979
/**
8080
* create new user and attempt to read cookies
81-
*/
81+
*/
8282
const user = new MPID();
8383
/**
8484
* If developing turn tracking off by setting user.debug to true;
85-
* End goal: set user.debug variable in npm run dev
85+
* End goal: set an environment variable to automate this toggle
8686
*/
87-
user.debug = true;
87+
user.debug = false;
8888

8989
if (!user.debug) {
9090
//set current user cookie if it does not exist in cookies;
91-
if (user.checkDocumentCookie(document)) {
91+
if (user.checkDocumentCookie(document)) {
9292
user.getCookie();
9393
mixpanel.people.increment(user.get_dId(), "times");
94-
} else {
94+
} else {
9595
user.setCookie();
9696
mixpanel.people.set(user.get_dId(), { times: 1 });
9797
}
@@ -132,7 +132,7 @@ function MainContainer(): any {
132132
// if viewIndex is -1, then use the sliderIndex instead
133133
const snapshotView = viewIndex === -1 ? snapshots[sliderIndex] : snapshots[viewIndex];
134134
// cleaning hierarchy and snapshotView from stateless data
135-
const statelessCleaning = (obj:{name?:string; componentData?:object; state?:string|any;stateSnaphot?:object; children?:any[];}) => {
135+
const statelessCleaning = (obj: { name?: string; componentData?: object; state?: string | any; stateSnaphot?: object; children?: any[]; }) => {
136136
const newObj = { ...obj };
137137
if (newObj.name === 'nameless') {
138138
delete newObj.name;
@@ -149,7 +149,7 @@ function MainContainer(): any {
149149
if (newObj.children) {
150150
newObj.children = [];
151151
if (obj.children.length > 0) {
152-
obj.children.forEach((element:{state?:object|string, children?:[]}) => {
152+
obj.children.forEach((element: { state?: object | string, children?: [] }) => {
153153
if (element.state !== 'stateless' || element.children.length > 0) {
154154
const clean = statelessCleaning(element);
155155
newObj.children.push(clean);

0 commit comments

Comments
 (0)