2022-04-13 11:44:59 +02:00
|
|
|
|
import { getMemory } from '../../memory';
|
|
|
|
|
import { RequestCluster } from '../../request-cluster';
|
2021-11-07 17:23:48 +01:00
|
|
|
|
|
2022-01-19 13:12:28 +01:00
|
|
|
|
import StolenDataCluster from './stolen-data-cluster';
|
2021-11-07 09:17:19 +01:00
|
|
|
|
|
2022-01-20 19:03:03 +01:00
|
|
|
|
import './stolen-data.scss';
|
|
|
|
|
|
2021-11-07 09:17:19 +01:00
|
|
|
|
export function StolenData({
|
2022-01-19 13:12:28 +01:00
|
|
|
|
origin,
|
|
|
|
|
minValueLength,
|
2022-02-07 15:28:01 +01:00
|
|
|
|
eventCounts,
|
2022-01-19 13:12:28 +01:00
|
|
|
|
cookiesOnly,
|
|
|
|
|
cookiesOrOriginOnly,
|
2022-04-15 13:58:29 +02:00
|
|
|
|
detailsVisibility,
|
2021-11-07 09:17:19 +01:00
|
|
|
|
}: {
|
2022-01-19 13:12:28 +01:00
|
|
|
|
origin: string;
|
2022-07-09 15:28:37 +02:00
|
|
|
|
eventCounts: Record<string, number | undefined>;
|
2022-01-19 13:12:28 +01:00
|
|
|
|
minValueLength: number;
|
|
|
|
|
cookiesOnly: boolean;
|
|
|
|
|
cookiesOrOriginOnly: boolean;
|
2022-04-15 13:58:29 +02:00
|
|
|
|
detailsVisibility: boolean;
|
2021-11-07 09:17:19 +01:00
|
|
|
|
}) {
|
2022-01-19 13:12:28 +01:00
|
|
|
|
if (!origin) {
|
2022-01-20 19:03:03 +01:00
|
|
|
|
return (
|
|
|
|
|
<div className="stolen-data-container">
|
|
|
|
|
<span>Otwórz nową kartę z wybraną stroną internetową</span>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
2022-01-19 13:12:28 +01:00
|
|
|
|
}
|
|
|
|
|
const clusters = Object.values(getMemory().getClustersForOrigin(origin))
|
|
|
|
|
.sort(RequestCluster.sortCompare)
|
|
|
|
|
.filter((cluster) => !cookiesOnly || cluster.hasCookies())
|
|
|
|
|
.filter(
|
2022-02-07 15:28:01 +01:00
|
|
|
|
(cluster) => !cookiesOrOriginOnly || cluster.hasCookies() || cluster.exposesOrigin()
|
2022-01-19 13:12:28 +01:00
|
|
|
|
);
|
|
|
|
|
return (
|
2022-01-20 19:03:03 +01:00
|
|
|
|
<div className="stolen-data-container">
|
2022-04-15 13:58:29 +02:00
|
|
|
|
<span>Domeny{detailsVisibility ? ' oraz przesłane informacje' : null}</span>
|
2022-01-20 19:03:03 +01:00
|
|
|
|
|
|
|
|
|
{clusters.map((cluster) => {
|
|
|
|
|
return (
|
|
|
|
|
<StolenDataCluster
|
|
|
|
|
origin={origin}
|
|
|
|
|
shorthost={cluster.id}
|
|
|
|
|
key={cluster.id + origin}
|
2022-07-09 15:28:37 +02:00
|
|
|
|
refreshToken={eventCounts[cluster.id] || 0}
|
2022-01-20 19:03:03 +01:00
|
|
|
|
minValueLength={minValueLength}
|
|
|
|
|
cookiesOnly={cookiesOnly}
|
|
|
|
|
cookiesOrOriginOnly={cookiesOrOriginOnly}
|
2022-04-15 13:58:29 +02:00
|
|
|
|
detailsVisibility={detailsVisibility}
|
2022-01-20 19:03:03 +01:00
|
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
})}
|
2022-01-19 13:12:28 +01:00
|
|
|
|
</div>
|
2021-11-24 14:19:12 +01:00
|
|
|
|
);
|
2021-11-07 09:17:19 +01:00
|
|
|
|
}
|