Add trackerType to GraphQL schema and detection UI
- Add TrackerType enum to GraphQL schema with all 6 values - Add trackerType field to CookiePattern type (nullable source) - Add optional trackerType to CreateCookiePatternInput - Add Type column to detection page table - Add NewTrackerPattern helper in types package - Regenerate gqlgen + Relay artifacts Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -178,6 +178,7 @@ export default function CookieBannerDetectionPage({
|
||||
<Thead>
|
||||
<Tr>
|
||||
<SortableTh field="NAME">{__("Name")}</SortableTh>
|
||||
<Th>{__("Type")}</Th>
|
||||
<SortableTh field="SOURCE">{__("Source")}</SortableTh>
|
||||
<SortableTh field="LAST_MATCHED_AT">{__("Last Matched")}</SortableTh>
|
||||
<SortableTh field="UPDATED_AT">{__("Updated")}</SortableTh>
|
||||
|
||||
@@ -46,6 +46,7 @@ import {
|
||||
const detectionPatternFragment = graphql`
|
||||
fragment DetectionPatternRowFragment on CookiePattern {
|
||||
id
|
||||
trackerType
|
||||
displayName
|
||||
source
|
||||
description
|
||||
@@ -123,6 +124,18 @@ const updatePatternMutation = graphql`
|
||||
}
|
||||
`;
|
||||
|
||||
function trackerTypeLabel(type: string, __: (s: string) => string): string {
|
||||
switch (type) {
|
||||
case "COOKIE": return __("Cookie");
|
||||
case "LOCAL_STORAGE": return __("localStorage");
|
||||
case "SESSION_STORAGE": return __("sessionStorage");
|
||||
case "INDEXED_DB": return __("IndexedDB");
|
||||
case "SCRIPT": return __("Script");
|
||||
case "IFRAME": return __("Iframe");
|
||||
default: return type;
|
||||
}
|
||||
}
|
||||
|
||||
interface DetectionPatternRowProps {
|
||||
patternKey: DetectionPatternRowFragment$key;
|
||||
connectionId: string;
|
||||
@@ -288,10 +301,19 @@ export function DetectionPatternRow({ patternKey, connectionId }: DetectionPatte
|
||||
</div>
|
||||
</Td>
|
||||
<Td>
|
||||
<Badge variant={pattern.source === "SCRIPT" ? "info" : "neutral"}>
|
||||
{pattern.source === "SCRIPT" ? __("Script") : __("Pre-existing")}
|
||||
<Badge variant="neutral">
|
||||
{trackerTypeLabel(pattern.trackerType, __)}
|
||||
</Badge>
|
||||
</Td>
|
||||
<Td>
|
||||
{pattern.source
|
||||
? (
|
||||
<Badge variant={pattern.source === "SCRIPT" ? "info" : "neutral"}>
|
||||
{pattern.source === "SCRIPT" ? __("Script") : __("Pre-existing")}
|
||||
</Badge>
|
||||
)
|
||||
: <span className="text-txt-tertiary">-</span>}
|
||||
</Td>
|
||||
<Td>
|
||||
{pattern.lastMatchedAt
|
||||
? (
|
||||
|
||||
Reference in New Issue
Block a user