@simmalugnt-se/payload-consent 0.6.9 → 0.6.11

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/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.11
4
+
5
+ - A scan judges findings by the Cookie services and their categories again, as in 0.6.9. The rules
6
+ added in 0.6.10 are gone: a service in Necessary counts as in order again, whatever it loads, and
7
+ no finding is judged by its kind of request. They were our own reading, not c15t's or the law's.
8
+ - The per-finding instructions and the email's list of them are gone. The Scan tab says per group how
9
+ to handle findings, with c15t's own ways: a known integration, `ConsentFrame`, or `scripts`. The
10
+ email again gives the counts and a link.
11
+ - Add to service starts in Necessary again when the Open Cookie Database has no suggestion.
12
+ - Kept from 0.6.10: unreached pages make a scan incomplete, a finding names a page it was seen on,
13
+ and the README's Google Tag Manager example loads the tag after consent.
14
+
15
+ ## 0.6.10
16
+
17
+ - A scan says what to do. Each finding that needs handling carries one instruction, in the Scan tab
18
+ and in the email, judged from what the scan measured: code or a frame from another site before
19
+ consent must wait, a font or stylesheet from another site belongs on the site's own domain, a plain
20
+ file needs its provider checked, and unexplained storage goes in a service. The email names each
21
+ finding and a page it was seen on. Needs `consent-scanner` at `dcefe83` or later; with an older one,
22
+ hosts get no instruction.
23
+ - A service in Necessary no longer makes code from another site count as in order: seen before any
24
+ choice, it needs action. So does a cookie in Necessary that the Open Cookie Database puts in
25
+ another category. A site may see new findings in its next scan.
26
+ - Add to service starts in Functionality for what must wait for consent, not in Necessary.
27
+ - Pages the scanner could not reach make the scan incomplete and are named.
28
+ - The README's Google Tag Manager example loads the tag after consent: passed as it stood, c15t loads
29
+ it at once.
30
+
3
31
  ## 0.6.9
4
32
 
5
33
  - A scan visits every page it finds as a new visitor, up to 500 in all, and 30 pages in each other
package/README.md CHANGED
@@ -172,6 +172,11 @@ every cookie, localStorage key and third-party host:
172
172
  `_ga_*` rather than one property's `_ga_G123`), and the scan is judged again.
173
173
  - **In order**: explained and seen only where allowed.
174
174
 
175
+ The Scan tab says how to handle each group, using c15t's own ways: a tool in the list under Loaded
176
+ by is picked there, an embed goes in `ConsentFrame`, and other code goes in `scripts`, so c15t loads
177
+ it after consent. The plugin decides nothing about what is necessary: that is the category you give
178
+ the service, by what it does on the site. A finding names a page it was seen on.
179
+
175
180
  Findings new since the previous scan are marked. A scan's raw results stay in `consent-scans`.
176
181
 
177
182
  ### Every month
@@ -264,7 +269,10 @@ The services picked in Admin load on their own. Other c15t integrations go in `s
264
269
  'use client'
265
270
  import { googleTagManager } from '@c15t/scripts/google-tag-manager'
266
271
 
267
- <ConsentProvider config={consent} scripts={[googleTagManager({ id: 'GTM-XXXXXXX' })]}>
272
+ <ConsentProvider
273
+ config={consent}
274
+ scripts={[{ ...googleTagManager({ id: 'GTM-XXXXXXX' }), category: 'measurement', alwaysLoad: false }]}
275
+ >
268
276
  ```
269
277
 
270
278
  Embedded content, such as a video or a map, waits behind a placeholder until the visitor allows
@@ -85,8 +85,8 @@ const COPY = {
85
85
  ok: "In order",
86
86
  },
87
87
  explain: {
88
- action: "Seen where their category is not allowed. Set Loaded by on the service to “This plugin, after consent”, or make the site's code wait for consent.",
89
- unknown: "Add each to a service, new or existing, or remove it from the site.",
88
+ action: "Seen where their category is not allowed. A tool in the list under Loaded by: pick “This plugin, after consent” on the service. An embed: wrap it in ConsentFrame. Other code: pass it to ConsentProvider's scripts, so c15t loads it after consent.",
89
+ unknown: "Add each to a service: Necessary if the site cannot work without it, otherwise the category that fits. Or remove it from the site.",
90
90
  ok: "In a Cookie service, and seen only where its category is allowed.",
91
91
  },
92
92
  // What the finding is, leading the sentence of when it was seen.
@@ -204,8 +204,8 @@ const COPY = {
204
204
  ok: "I ordning",
205
205
  },
206
206
  explain: {
207
- action: "Syns där kategorin inte är tillåten. Välj ”Det här pluginet, efter samtycke” under Laddas av i tjänsten, eller låt webbplatsens kod vänta på samtycke.",
208
- unknown: "Lägg till var och en i en tjänst, ny eller befintlig, eller ta bort den från webbplatsen.",
207
+ action: "Syns där kategorin inte är tillåten. Ett verktyg i listan under Laddas av: välj ”Det här pluginet, efter samtycke” i tjänsten. En inbäddning: lägg den i ConsentFrame. Annan kod: skicka den till ConsentProviders scripts, så laddar c15t den efter samtycke.",
208
+ unknown: "Lägg var och en i en tjänst: Nödvändig om webbplatsen inte fungerar utan den, annars den kategori som passar. Eller ta bort den från webbplatsen.",
209
209
  ok: "Finns i en Cookietjänst och syns bara där kategorin är tillåten.",
210
210
  },
211
211
  seen: {
@@ -44,6 +44,9 @@ export type ScanResultState = {
44
44
  host: string;
45
45
  firstParty: boolean;
46
46
  requests: number;
47
+ /** Requests by Chromium's resource type; from a newer `consent-scanner`; older ones report none. */
48
+ kinds?: Record<string, number>;
49
+ pages?: string[];
47
50
  }[];
48
51
  beacons: {
49
52
  host: string;
@@ -51,6 +54,8 @@ export type ScanResultState = {
51
54
  lists: string[];
52
55
  }[];
53
56
  errors: string[];
57
+ /** Picked pages the scanner never reached. */
58
+ unvisited?: string[];
54
59
  };
55
60
  export type FindingKind = "cookie" | "localStorage" | "host";
56
61
  /**
package/dist/evaluate.js CHANGED
@@ -12,6 +12,8 @@ export function scanProblems(args) {
12
12
  problems.push(`${state.id}: no page could be visited`);
13
13
  for (const error of result?.errors ?? [])
14
14
  problems.push(`${state.id}: ${error}`);
15
+ if (result?.visited?.length && result.unvisited?.length)
16
+ problems.push(`${state.id}: ${result.unvisited.length} pages could not be visited: ${result.unvisited.slice(0, 3).join(", ")}`);
15
17
  }
16
18
  const sitemapErrors = args.pages?.sitemapErrors;
17
19
  for (const entry of Array.isArray(sitemapErrors) ? sitemapErrors : []) {
@@ -89,9 +91,14 @@ export function evaluateScan({ states, results, services, previousKeys = [], })
89
91
  suggestion: entry.suggestion,
90
92
  });
91
93
  const lists = new Map(state.beacons.map((beacon) => [beacon.host, beacon.lists]));
92
- for (const host of state.hosts)
93
- if (!host.firstParty)
94
- add("host", host.host, "", state.id, { trackerLists: lists.get(host.host) });
94
+ for (const host of state.hosts) {
95
+ if (host.firstParty)
96
+ continue;
97
+ add("host", host.host, "", state.id, {
98
+ trackerLists: lists.get(host.host),
99
+ page: host.pages?.[0],
100
+ });
101
+ }
95
102
  }
96
103
  for (const finding of found.values()) {
97
104
  if (finding.kind !== "host" && OWN_STORAGE.test(finding.name)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simmalugnt-se/payload-consent",
3
- "version": "0.6.9",
3
+ "version": "0.6.11",
4
4
  "description": "Cookie consent for Payload sites: banner texts, services and scans in Admin",
5
5
  "keywords": [
6
6
  "payload",