Skip to content

Commit 85dccf6

Browse files
authored
2.56 (#20)
* version * safe nuke * hey andy * fix urls * fix extend dataset * labels * update macro endpoints
1 parent 2e91fef commit 85dccf6

File tree

6 files changed

+76
-25
lines changed

6 files changed

+76
-25
lines changed

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "MP Tweaks!",
3-
"version": "2.55",
3+
"version": "2.56",
44
"manifest_version": 3,
55
"description": "this is an extension (by AK) to add feature flags to Mixpanel",
66
"homepage_url": "https://mixpanel.com",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mptweaks",
3-
"version": "2.55",
3+
"version": "2.56",
44
"description": "a chrome extension to tweak mixpanel",
55
"main": "index.js",
66
"scripts": {

src/app.html

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ <h1>
2525
<div class="header-links">
2626
<a href="https://www.notion.so/mxpnl/Fixpanel-1ece0ba9256280b9b10ad1ad09b80bca?source=copy_link" target="_blank" class="header-link" title="Documentation">docs</a>
2727
<a href="https://www.loom.com/share/795c7e6de6e24d8ab6b5d664628f4dd6?sid=107b6af9-7905-491f-be4e-3ab7e1a1dbe7" target="_blank" class="header-link" title="Demo Video">demo</a>
28-
<a href="https://github.com/ak--47/mp-tweaks" target="_blank" class="header-link" title="Source Code">code</a>
28+
<a href="https://github.com/mixpanel/mp-tweaks" target="_blank" class="header-link" title="Source Code">code</a>
2929
<a href="https://mixpanel.com/p/WozKy565PFggRBWYKieVaN" target="_blank" class="header-link" title="Analytics">metrics</a>
3030
<a href="https://chromewebstore.google.com/detail/mp-tweaks/inohmabgpakdlckangklebmpakgimipd" target="_blank" class="header-link" title="Chrome Web Store">share</a>
3131
<a href="#" id="refreshCache" class="header-link" title="Refresh cache and reload data">refresh</a>
@@ -518,20 +518,22 @@ <h2 data-section="persistentOptions">
518518
</div>
519519

520520

521-
<!-- ODDS N ENDS -->
521+
<!-- FIX RANDOM STUFF -->
522522
<div id="oddsEnds"
523523
class="section">
524524
<h2 class="lower" data-section="oddsEnds">
525525
<div class="section-header">
526-
<span>&#127922; Odds and Ends</span>
526+
<span>🔧 Fix Random Stuff</span>
527527
</div>
528528
<span class="collapse-toggle"></span>
529529
</h2>
530530
<div class="section-content">
531-
<p class="small">some <b>random stuff</b> that is helpful for <span class="highlight">development and testing</span></p>
531+
<p class="small">inject <b>random JS</b> on the page to <span class="highlight">fix or reset app state</span></p>
532532
<div class="button-input-group">
533-
<button class="button" id="nukeCookies">Nuke Cookies</button>
534-
<button class="button" id="embedSDK">Embed SDK</button>
533+
<button class="button" id="nukeCookies">💣 Nuke Cookies</button>
534+
<button class="button" id="embedSDK">📦 Embed SDK</button>
535+
<button class="button" id="safeNukeLS">🧹 Safe Nuke (localStorage)</button>
536+
<button class="button" id="realNukeLS">☢️ Real Nuke (localStorage)</button>
535537
</div>
536538
</div>
537539
</div>
@@ -542,7 +544,7 @@ <h2 class="lower" data-section="oddsEnds">
542544

543545
<p>
544546
<span>version <span id="versionLabel">{{version}}</span> made with &#129392; by <a
545-
href="https://github.com/ak--47/mp-tweaks"
547+
href="https://github.com/mixpanel/mp-tweaks"
546548
target="_blank">AK</a></span>
547549
<a class="byline"
548550
href="https://forms.gle/sn4aYQAnMEihbwvs8"

src/app.js

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// @ts-ignore
44
let STORAGE;
55

6-
const APP_VERSION = `2.55`;
6+
const APP_VERSION = `2.56`;
77
// const FEATURE_FLAG_URI = `https://docs.google.com/spreadsheets/d/e/2PACX-1vTks7GMkQBfvqKgjIyzLkRYAGRhcN6yZhI46lutP8G8OokZlpBO6KxclQXGINgS63uOmhreG9ClnFpb/pub?gid=0&single=true&output=csv`;
88
// const DEMO_GROUPS_URI = `https://docs.google.com/spreadsheets/d/e/2PACX-1vQdxs7SWlOc3f_b2f2j4fBk2hwoU7GBABAmJhtutEdPvqIU4I9_QRG6m3KSWNDnw5CYB4pEeRAiSjN7/pub?gid=0&single=true&output=csv`;
99
// const TOOLS_URI = `https://docs.google.com/spreadsheets/d/e/2PACX-1vRN5Eu0Lj2dfxM7OSZiR91rcN4JSTprUz07wk8jZZyxOhOHZvRnlgGHJKIOHb6DIb4sjQQma35dCzPZ/pub?gid=0&single=true&output=csv`;
@@ -263,6 +263,10 @@ async function checkAIMagicEnabled() {
263263
APP.DOM.aiGoButton.textContent = 'Go! (fill required fields)';
264264
}
265265
}
266+
// Update source project display for extend-dataset
267+
const sourceEl = document.getElementById('ai-source-project');
268+
if (sourceEl) sourceEl.textContent = projectId;
269+
266270
return { projectId, region };
267271
} else if (jobRunning) {
268272
if (APP.DOM.aiProjectLabel) APP.DOM.aiProjectLabel.textContent = projectId || 'not detected';
@@ -602,9 +606,14 @@ function renderAIMacroPanel(macroType) {
602606
const config = AI_MACRO_CONFIGS[macroType];
603607
if (!config) return;
604608

609+
const sourceProjectLine = macroType === 'extend-dataset'
610+
? `<p class="small"><b>Source Project:</b> <span id="ai-source-project">${APP.DOM.aiProjectLabel?.textContent || 'not detected'}</span></p>`
611+
: '';
612+
605613
panel.innerHTML = `
606614
<h4>${config.title}</h4>
607615
<p class="small">${config.description}</p>
616+
${sourceProjectLine}
608617
<div class="ai-fields">
609618
${config.fields.map(f => renderAIField(f)).join('')}
610619
</div>
@@ -614,7 +623,7 @@ function renderAIMacroPanel(macroType) {
614623
// Hide product context for macros that have their own prompt field
615624
const contextSection = APP.DOM.aiProductContext?.closest('.ai-context-section');
616625
if (contextSection) {
617-
contextSection.classList.toggle('hidden', macroType === 'dataset' || macroType === 'e2e' || macroType === 'dashboard' || macroType === 'behaviors-metrics');
626+
contextSection.classList.toggle('hidden', macroType === 'dataset' || macroType === 'extend-dataset' || macroType === 'e2e' || macroType === 'dashboard' || macroType === 'behaviors-metrics' || macroType === 'replay');
618627
}
619628

620629
// Add event listeners to save field values on change (debounced)
@@ -1156,9 +1165,11 @@ function cacheDOM() {
11561165
this.DOM.sessionReplayLabel = document.querySelector('#sessionReplayLabel');
11571166
this.DOM.sessionReplayStatus = document.querySelector('#sessionReplayLabel b');
11581167

1159-
//odds and ends
1168+
//fix random stuff
11601169
this.DOM.nukeCookies = document.querySelector('#nukeCookies');
11611170
this.DOM.embedSDK = document.querySelector('#embedSDK');
1171+
this.DOM.safeNukeLS = document.querySelector('#safeNukeLS');
1172+
this.DOM.realNukeLS = document.querySelector('#realNukeLS');
11621173

11631174
this.DOM.versionLabel = document.querySelector('#versionLabel');
11641175

@@ -1840,6 +1851,16 @@ function bindListeners() {
18401851
await messageWorker('embed-sdk', { tab });
18411852
});
18421853

1854+
this.DOM.safeNukeLS.addEventListener('click', async () => {
1855+
const result = await messageWorker('safe-nuke-localstorage');
1856+
alert(`🧹 Safe Nuke: removed ${result.removed} of ${result.total} localStorage keys`);
1857+
});
1858+
1859+
this.DOM.realNukeLS.addEventListener('click', async () => {
1860+
const result = await messageWorker('real-nuke-localstorage');
1861+
alert(`☢️ Real Nuke: removed ${result.removed} of ${result.total} localStorage keys`);
1862+
});
1863+
18431864
//logo tweak animation
18441865
this.DOM.logoLink.addEventListener('click', () => {
18451866
this.DOM.logoLink.classList.add('tweaking');

src/worker.js

Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function cleanupAllTimers() {
6666
activeTimeouts.clear();
6767
}
6868

69-
const APP_VERSION = `2.55`;
69+
const APP_VERSION = `2.56`;
7070
const SCRIPTS = {
7171
"hundredX": { path: './src/tweaks/hundredX.js', code: "" },
7272
"catchFetch": { path: "./src/tweaks/catchFetch.js", code: "" },
@@ -634,6 +634,32 @@ async function handleRequest(request) {
634634
result = await nukeCookies();
635635
break;
636636

637+
case 'safe-nuke-localstorage':
638+
console.log('mp-tweaks: safe nuke localStorage');
639+
result = await runScript(() => {
640+
const total = localStorage.length;
641+
console.log(`mp-tweaks: [Safe Nuke] START — ${total} total localStorage keys`);
642+
const keys = Object.keys(localStorage).filter(key => key.includes('$mp_current_project_client_cache'));
643+
keys.forEach(key => localStorage.removeItem(key));
644+
console.log(`mp-tweaks: [Safe Nuke] END — removed ${keys.length} of ${total} keys`);
645+
return { removed: keys.length, total };
646+
});
647+
result = result?.[0]?.result;
648+
break;
649+
650+
case 'real-nuke-localstorage':
651+
console.log('mp-tweaks: real nuke localStorage');
652+
result = await runScript(() => {
653+
const total = localStorage.length;
654+
console.log(`mp-tweaks: [Real Nuke] START — ${total} total localStorage keys`);
655+
const keys = Object.keys(localStorage).filter(key => key.startsWith('$mp_'));
656+
keys.forEach(key => localStorage.removeItem(key));
657+
console.log(`mp-tweaks: [Real Nuke] END — removed ${keys.length} of ${total} keys`);
658+
return { removed: keys.length, total };
659+
});
660+
result = result?.[0]?.result;
661+
break;
662+
637663
case 'reload':
638664
console.log('mp-tweaks: reloading page');
639665
await runScript(reload);
@@ -711,18 +737,18 @@ async function waitUntil(promise) {
711737

712738
async function runAIMacro(macroType, params) {
713739
const endpoints = {
714-
'e2e': 'https://mixpanel-power-tools-api-lmozz6xkha-uc.a.run.app/ai-e2e',
715-
'replay': 'https://mixpanel-power-tools-api-lmozz6xkha-uc.a.run.app/meeple-job',
716-
'dataset': 'https://mixpanel-power-tools-api-lmozz6xkha-uc.a.run.app/ai-dataset',
717-
'extend-dataset': 'https://mixpanel-power-tools-api-lmozz6xkha-uc.a.run.app/ai-extend-dataset',
718-
'schema': 'https://mixpanel-power-tools-api-lmozz6xkha-uc.a.run.app/ai-schema',
719-
'merge': 'https://mixpanel-power-tools-api-lmozz6xkha-uc.a.run.app/ai-merge',
720-
'show-hide': 'https://mixpanel-power-tools-api-lmozz6xkha-uc.a.run.app/ai-show-hide',
721-
'dashboard': 'https://mixpanel-power-tools-api-lmozz6xkha-uc.a.run.app/ai-dash-gen',
722-
'behaviors-metrics': 'https://mixpanel-power-tools-api-lmozz6xkha-uc.a.run.app/ai-behaviors-metrics',
723-
'tags': 'https://mixpanel-power-tools-api-lmozz6xkha-uc.a.run.app/ai-tags',
724-
'rename-reports': 'https://mixpanel-power-tools-api-lmozz6xkha-uc.a.run.app/ai-rename-reports',
725-
'rename-entities': 'https://mixpanel-power-tools-api-lmozz6xkha-uc.a.run.app/ai-rename-entities'
740+
'e2e': 'https://mixpanel-power-tools-api-lmozz6xkha-uc.a.run.app/macro/ai-e2e',
741+
'replay': 'https://mixpanel-power-tools-api-lmozz6xkha-uc.a.run.app/macro/meeple-job',
742+
'dataset': 'https://mixpanel-power-tools-api-lmozz6xkha-uc.a.run.app/macro/ai-dataset',
743+
'extend-dataset': 'https://mixpanel-power-tools-api-lmozz6xkha-uc.a.run.app/macro/ai-extend-dataset',
744+
'schema': 'https://mixpanel-power-tools-api-lmozz6xkha-uc.a.run.app/macro/ai-schema',
745+
'merge': 'https://mixpanel-power-tools-api-lmozz6xkha-uc.a.run.app/macro/ai-merge',
746+
'show-hide': 'https://mixpanel-power-tools-api-lmozz6xkha-uc.a.run.app/macro/ai-show-hide',
747+
'dashboard': 'https://mixpanel-power-tools-api-lmozz6xkha-uc.a.run.app/macro/ai-dash-gen',
748+
'behaviors-metrics': 'https://mixpanel-power-tools-api-lmozz6xkha-uc.a.run.app/macro/ai-behaviors-metrics',
749+
'tags': 'https://mixpanel-power-tools-api-lmozz6xkha-uc.a.run.app/macro/ai-tags',
750+
'rename-reports': 'https://mixpanel-power-tools-api-lmozz6xkha-uc.a.run.app/macro/ai-rename-reports',
751+
'rename-entities': 'https://mixpanel-power-tools-api-lmozz6xkha-uc.a.run.app/macro/ai-rename-entities'
726752
};
727753

728754
const url = endpoints[macroType];

tests/setup.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ if (!isDebugMode) {
1919
};
2020
}
2121

22+
//hello ANDY!
23+
2224
// Log test mode
2325
if (isDebugMode) {
2426
console.log('🐛 Running tests in DEBUG mode - browser will be visible');

0 commit comments

Comments
 (0)