From edfde535d268a259ab50c7228ee00d7b73b53c56 Mon Sep 17 00:00:00 2001 From: Kuba Orlik Date: Mon, 22 Nov 2021 12:03:55 +0100 Subject: [PATCH] Shorter HAR files. More precise controls over what's missing in the consent popup --- report-window/domain-summary.tsx | 64 +++++++------------------------- report-window/email-template.tsx | 29 +++++++++------ report-window/report-window.tsx | 6 +-- request-cluster.ts | 52 +++++++++++++++++++++++++- util.ts | 9 +++++ 5 files changed, 91 insertions(+), 69 deletions(-) diff --git a/report-window/domain-summary.tsx b/report-window/domain-summary.tsx index 187c93a..9350658 100644 --- a/report-window/domain-summary.tsx +++ b/report-window/domain-summary.tsx @@ -15,13 +15,6 @@ const emailSources: Record = { queryparams: "jako część adresu URL (query-params)", }; -const source_priority: Array = [ - "cookie", - "pathname", - "queryparams", - "header", -]; - export default function DomainSummary({ cluster, }: { @@ -32,49 +25,20 @@ export default function DomainSummary({ Właściciel domeny {cluster.id} otrzymał:{" "}
  • Mój adres IP
  • - {cluster - .getMarks() - .sort((markA, markB) => { - if (markA.entry.value > markB.entry.value) { - return -1; - } else if (markA.entry.value < markB.entry.value) { - return 1; - } else { - const indexA = source_priority.indexOf(markA.source); - const indexB = source_priority.indexOf(markB.source); - if (indexA < indexB) { - return -1; - } else if (indexA > indexB) { - return 1; - } else { - return markA.name > markB.name ? -1 : 1; - } - } - }) - .filter((_, index, array) => { - if (index == 0) { - return true; - } - if (array[index].valuePreview === array[index - 1].valuePreview) { - return false; - } else { - return true; - } - }) - .map((mark) => ( -
  • - {emailClassifications[mark.classification]}{" "} - {emailSources[mark.source]} (nazwa: {mark.name},{" "} - {mark.key ? ( - <> - pozycja {mark.key}, - - ) : ( - "" - )} - wartość: {mark.valuePreview}) -
  • - ))} + {cluster.getRepresentativeMarks().map((mark) => ( +
  • + {emailClassifications[mark.classification]}{" "} + {emailSources[mark.source]} (nazwa: {mark.name},{" "} + {mark.key ? ( + <> + pozycja {mark.key}, + + ) : ( + "" + )} + wartość: {mark.valuePreview}) +
  • + ))}
); diff --git a/report-window/email-template.tsx b/report-window/email-template.tsx index 0d18588..2406262 100644 --- a/report-window/email-template.tsx +++ b/report-window/email-template.tsx @@ -4,12 +4,11 @@ import { RequestCluster } from "../request-cluster"; import { getDate, toBase64 } from "../util"; import DomainSummary from "./domain-summary"; -type PopupState = "not_clicked" | "clicked_but_invalid"; +type PopupState = "not_clicked" | "clicked_but_no_reject_all"; export default function EmailTemplate({ marks, clusters, - version, }: { marks: Mark[]; clusters: Record; @@ -32,9 +31,11 @@ export default function EmailTemplate({ onChange={(e) => setPopupState(e.target.value as PopupState)} > - + - {popupState === "clicked_but_invalid" ? ( + {popupState === "clicked_but_no_reject_all" ? ( <>