@ait-co/devtools 0.1.15 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/panel/index.js +24 -8
- package/dist/panel/index.js.map +1 -1
- package/package.json +1 -1
package/dist/panel/index.js
CHANGED
|
@@ -440,22 +440,38 @@ function setConsentViaToggle(granted) {
|
|
|
440
440
|
}
|
|
441
441
|
/**
|
|
442
442
|
* Returns true if the toast should be shown now.
|
|
443
|
-
* Conditions:
|
|
443
|
+
* Conditions:
|
|
444
|
+
* - undecided (no prior choice or policy bumped to a newer version)
|
|
445
|
+
* - denied + reprompt_after set + reprompt_after < now (one re-prompt after
|
|
446
|
+
* the configured silence window; `denyConsent` flips to permanent silence
|
|
447
|
+
* on the second denial by setting reprompt_after to MAX_SAFE_INTEGER).
|
|
444
448
|
*/
|
|
445
449
|
function shouldShowToast() {
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
+
const state = resolveEffectiveConsent();
|
|
451
|
+
if (state === "undecided") {
|
|
452
|
+
const repromptAfter = readRepromptAfter();
|
|
453
|
+
if (repromptAfter === 0) return true;
|
|
454
|
+
return Date.now() > repromptAfter;
|
|
455
|
+
}
|
|
456
|
+
if (state === "denied") {
|
|
457
|
+
const repromptAfter = readRepromptAfter();
|
|
458
|
+
if (repromptAfter === 0 || repromptAfter >= Number.MAX_SAFE_INTEGER) return false;
|
|
459
|
+
return Date.now() > repromptAfter;
|
|
460
|
+
}
|
|
461
|
+
return false;
|
|
450
462
|
}
|
|
451
463
|
/**
|
|
452
|
-
* Sends the DELETE request to remove the user's data from the server
|
|
464
|
+
* Sends the DELETE request to remove the user's data from the server, and
|
|
465
|
+
* rotates the local anon_id on success so any subsequent events are unlinkable
|
|
466
|
+
* from the deleted history.
|
|
453
467
|
*/
|
|
454
468
|
async function deleteMyData(endpoint) {
|
|
455
469
|
const anonId = localStorage.getItem(KEY_ANON_ID);
|
|
456
470
|
if (!anonId) return false;
|
|
457
471
|
try {
|
|
458
|
-
|
|
472
|
+
if (!(await fetch(`${endpoint}/e?anon_id=${encodeURIComponent(anonId)}`, { method: "DELETE" })).ok) return false;
|
|
473
|
+
localStorage.setItem(KEY_ANON_ID, crypto.randomUUID());
|
|
474
|
+
return true;
|
|
459
475
|
} catch {
|
|
460
476
|
return false;
|
|
461
477
|
}
|
|
@@ -3637,7 +3653,7 @@ function mount() {
|
|
|
3637
3653
|
mockBadge.textContent = aitState.state.panelEditable ? "EDIT" : "READ-ONLY";
|
|
3638
3654
|
refreshPanel();
|
|
3639
3655
|
});
|
|
3640
|
-
const headerRight = h("span", { style: "display:flex;align-items:center;gap:6px" }, mockBadge, h("span", { style: "font-size:11px;color:#666;font-weight:400" }, `v0.1.
|
|
3656
|
+
const headerRight = h("span", { style: "display:flex;align-items:center;gap:6px" }, mockBadge, h("span", { style: "font-size:11px;color:#666;font-weight:400" }, `v0.1.16`), closeBtn);
|
|
3641
3657
|
const header = h("div", { className: "ait-panel-header" }, h("span", {}, "AIT DevTools"), headerRight);
|
|
3642
3658
|
tabsEl = h("div", { className: "ait-panel-tabs" });
|
|
3643
3659
|
for (const tab of TABS) {
|