@simmalugnt-se/payload-consent 0.0.0-stage → 0.2.0
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 +46 -0
- package/LICENSE +21 -0
- package/README.md +242 -2
- package/dist/admin/ScanPanel.d.ts +3 -0
- package/dist/admin/ScanPanel.js +232 -0
- package/dist/admin/ServicesPanel.d.ts +11 -0
- package/dist/admin/ServicesPanel.js +136 -0
- package/dist/block.d.ts +6 -0
- package/dist/block.js +27 -0
- package/dist/defaults.d.ts +56 -0
- package/dist/defaults.js +137 -0
- package/dist/evaluate.d.ts +106 -0
- package/dist/evaluate.js +101 -0
- package/dist/evidence.d.ts +12 -0
- package/dist/evidence.js +114 -0
- package/dist/exports/admin.d.ts +2 -0
- package/dist/exports/admin.js +2 -0
- package/dist/exports/client.d.ts +37 -0
- package/dist/exports/client.js +180 -0
- package/dist/exports/rsc.d.ts +1 -0
- package/dist/exports/rsc.js +1 -0
- package/dist/global.d.ts +14 -0
- package/dist/global.js +317 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +75 -0
- package/dist/integrations.d.ts +40 -0
- package/dist/integrations.js +32 -0
- package/dist/notify.d.ts +15 -0
- package/dist/notify.js +86 -0
- package/dist/records.d.ts +15 -0
- package/dist/records.js +198 -0
- package/dist/scans.d.ts +37 -0
- package/dist/scans.js +424 -0
- package/dist/schedule.d.ts +17 -0
- package/dist/schedule.js +18 -0
- package/dist/services.d.ts +8 -0
- package/dist/services.js +258 -0
- package/dist/site-config.d.ts +128 -0
- package/dist/site-config.js +204 -0
- package/dist/styles/admin.css +202 -0
- package/dist/styles/consent.css +301 -0
- package/dist/types.d.ts +65 -0
- package/dist/types.js +17 -0
- package/dist/widget/ConsentScanWidget.d.ts +8 -0
- package/dist/widget/ConsentScanWidget.js +99 -0
- package/package.json +76 -3
package/dist/evidence.js
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { CONSENT_SCAN_EVIDENCE, CONSENT_SCANS, DEFAULT_KEEP_EVIDENCE, } from "./types.js";
|
|
2
|
+
/** What the scanner sends: `<state>.pdf`, `<state>-2.pdf` for a later batch, `<state>.har.gz`. */
|
|
3
|
+
const FILE_NAME = /^([a-z0-9-]{1,40}?)(?:-(\d+))?\.(pdf|har\.gz)$/;
|
|
4
|
+
const signedIn = ({ req }) => Boolean(req.user);
|
|
5
|
+
/**
|
|
6
|
+
* WEC's evidence per scan: its PDF report and the network traffic (HAR, gzipped) for each consent
|
|
7
|
+
* state. On a host without a persistent disk, such as Vercel, add this collection to the storage
|
|
8
|
+
* adapter.
|
|
9
|
+
*/
|
|
10
|
+
export function evidenceCollection(options) {
|
|
11
|
+
return {
|
|
12
|
+
slug: CONSENT_SCAN_EVIDENCE,
|
|
13
|
+
labels: {
|
|
14
|
+
singular: { en: "Scan evidence", sv: "Skanningsunderlag" },
|
|
15
|
+
plural: { en: "Scan evidence", sv: "Skanningsunderlag" },
|
|
16
|
+
},
|
|
17
|
+
admin: {
|
|
18
|
+
useAsTitle: "filename",
|
|
19
|
+
// Out of the navigation and dashboard: the Cookies global links here.
|
|
20
|
+
group: false,
|
|
21
|
+
defaultColumns: ["filename", "scan", "state", "kind", "createdAt"],
|
|
22
|
+
},
|
|
23
|
+
access: { read: signedIn, create: () => false, update: () => false, delete: signedIn },
|
|
24
|
+
upload: { mimeTypes: ["application/pdf", "application/gzip", "application/x-gzip"] },
|
|
25
|
+
timestamps: true,
|
|
26
|
+
fields: [
|
|
27
|
+
{
|
|
28
|
+
name: "scan",
|
|
29
|
+
type: "relationship",
|
|
30
|
+
relationTo: CONSENT_SCANS,
|
|
31
|
+
index: true,
|
|
32
|
+
label: { en: "Scan", sv: "Skanning" },
|
|
33
|
+
},
|
|
34
|
+
{ name: "state", type: "text", label: { en: "State", sv: "Läge" } },
|
|
35
|
+
{
|
|
36
|
+
name: "kind",
|
|
37
|
+
type: "select",
|
|
38
|
+
label: { en: "Kind", sv: "Typ" },
|
|
39
|
+
options: [
|
|
40
|
+
{ value: "report", label: { en: "Report (PDF)", sv: "Rapport (PDF)" } },
|
|
41
|
+
{ value: "har", label: { en: "Network traffic (HAR)", sv: "Nätverkstrafik (HAR)" } },
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/** Deletes the evidence of all but the latest `keep` finished scans, and any without a scan. */
|
|
48
|
+
export async function pruneEvidence(payload, keep) {
|
|
49
|
+
const { docs } = await payload.find({
|
|
50
|
+
collection: CONSENT_SCANS,
|
|
51
|
+
where: { status: { equals: "done" } },
|
|
52
|
+
sort: "-createdAt",
|
|
53
|
+
limit: keep,
|
|
54
|
+
depth: 0,
|
|
55
|
+
overrideAccess: true,
|
|
56
|
+
});
|
|
57
|
+
const kept = docs.map((doc) => doc.id);
|
|
58
|
+
await payload.delete({
|
|
59
|
+
collection: CONSENT_SCAN_EVIDENCE,
|
|
60
|
+
// Evidence whose scan was deleted has no scan left.
|
|
61
|
+
where: kept.length
|
|
62
|
+
? { or: [{ scan: { not_in: kept } }, { scan: { exists: false } }] }
|
|
63
|
+
: { id: { exists: true } },
|
|
64
|
+
overrideAccess: true,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
/** The scanner posts each evidence file here after the result, one file per request. */
|
|
68
|
+
export function evidenceEndpoint(options, checkToken) {
|
|
69
|
+
return {
|
|
70
|
+
path: "/evidence",
|
|
71
|
+
method: "post",
|
|
72
|
+
handler: async (req) => {
|
|
73
|
+
if (!checkToken(req))
|
|
74
|
+
return Response.json({ error: "Unknown token" }, { status: 401 });
|
|
75
|
+
const scanId = typeof req.query?.scan === "string" ? req.query.scan : undefined;
|
|
76
|
+
const name = typeof req.query?.name === "string" ? req.query.name : "";
|
|
77
|
+
const match = FILE_NAME.exec(name);
|
|
78
|
+
if (!scanId || !match)
|
|
79
|
+
return Response.json({ error: "Expected ?scan=<id>&name=<state>.pdf|.har.gz" }, { status: 400 });
|
|
80
|
+
const { docs } = await req.payload.find({
|
|
81
|
+
collection: CONSENT_SCANS,
|
|
82
|
+
where: { scanId: { equals: scanId } },
|
|
83
|
+
limit: 1,
|
|
84
|
+
depth: 0,
|
|
85
|
+
overrideAccess: true,
|
|
86
|
+
req,
|
|
87
|
+
});
|
|
88
|
+
const scan = docs[0];
|
|
89
|
+
if (!scan)
|
|
90
|
+
return Response.json({ error: "Unknown scan" }, { status: 404 });
|
|
91
|
+
if (scan.status !== "done")
|
|
92
|
+
return Response.json({ error: "The scan has no result yet" }, { status: 409 });
|
|
93
|
+
const data = Buffer.from((await req.arrayBuffer?.()) ?? new ArrayBuffer(0));
|
|
94
|
+
if (!data.length)
|
|
95
|
+
return Response.json({ error: "Empty file" }, { status: 400 });
|
|
96
|
+
const [, state, , extension] = match;
|
|
97
|
+
const pdf = extension === "pdf";
|
|
98
|
+
const doc = await req.payload.create({
|
|
99
|
+
collection: CONSENT_SCAN_EVIDENCE,
|
|
100
|
+
data: { scan: scan.id, state, kind: pdf ? "report" : "har" },
|
|
101
|
+
file: {
|
|
102
|
+
data,
|
|
103
|
+
name: `${scanId.slice(0, 8)}-${name}`,
|
|
104
|
+
mimetype: pdf ? "application/pdf" : "application/gzip",
|
|
105
|
+
size: data.length,
|
|
106
|
+
},
|
|
107
|
+
overrideAccess: true,
|
|
108
|
+
req,
|
|
109
|
+
});
|
|
110
|
+
await pruneEvidence(req.payload, options.scanner?.keepEvidence ?? DEFAULT_KEEP_EVIDENCE);
|
|
111
|
+
return Response.json({ id: doc.id }, { status: 201 });
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type ConsentManagerOptions } from "@c15t/react";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
import type { Category } from "../defaults.ts";
|
|
4
|
+
import type { ConsentConfig, CookieTableData } from "../site-config.ts";
|
|
5
|
+
/** A button that opens the settings dialog, for the site's footer. Render it inside `ConsentProvider`. */
|
|
6
|
+
export { ConsentDialogLink as ConsentSettingsLink } from "@c15t/react";
|
|
7
|
+
type Script = NonNullable<ConsentManagerOptions["scripts"]>[number];
|
|
8
|
+
/**
|
|
9
|
+
* The services the plugin loads, each in its service's category. In basic consent mode nothing
|
|
10
|
+
* loads before consent, including tags c15t would otherwise load at once in a denied state.
|
|
11
|
+
*/
|
|
12
|
+
export declare function integrationScripts(config: ConsentConfig): Script[];
|
|
13
|
+
type Props = {
|
|
14
|
+
/** From `getConsentConfig` on the server. */
|
|
15
|
+
config: ConsentConfig;
|
|
16
|
+
/** More c15t script integrations, created on the client, besides the services the plugin loads. */
|
|
17
|
+
scripts?: ConsentManagerOptions["scripts"];
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
};
|
|
20
|
+
/** The banner, the settings dialog and c15t's consent state around the site. */
|
|
21
|
+
export declare function ConsentProvider({ config, scripts, children }: Props): import("react").JSX.Element;
|
|
22
|
+
type FrameProps = {
|
|
23
|
+
/** The category of the service the content comes from. */
|
|
24
|
+
category: Category;
|
|
25
|
+
children: ReactNode;
|
|
26
|
+
className?: string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Embedded content, such as a video or a map, that is not mounted until the visitor allows its
|
|
30
|
+
* category. Until then a placeholder offers to allow it. Without the banner, the content shows.
|
|
31
|
+
*/
|
|
32
|
+
export declare function ConsentFrame({ category, children, className }: FrameProps): import("react").JSX.Element;
|
|
33
|
+
/** The cookie services by category, from `getCookieTable`, for the site's cookie page. */
|
|
34
|
+
export declare function CookieTable({ data, heading }: {
|
|
35
|
+
data: CookieTableData;
|
|
36
|
+
heading?: string | null;
|
|
37
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { ConsentDialog as C15tDialog, ConsentBanner, ConsentManagerProvider, Frame, useConsentManager, } from "@c15t/react";
|
|
4
|
+
import { gtag } from "@c15t/scripts/google-tag";
|
|
5
|
+
import { googleTagManager } from "@c15t/scripts/google-tag-manager";
|
|
6
|
+
import { hotjar } from "@c15t/scripts/hotjar";
|
|
7
|
+
import { linkedinInsights } from "@c15t/scripts/linkedin-insights";
|
|
8
|
+
import { metaPixel } from "@c15t/scripts/meta-pixel";
|
|
9
|
+
import { clarity } from "@c15t/scripts/microsoft-clarity";
|
|
10
|
+
import { microsoftUet } from "@c15t/scripts/microsoft-uet";
|
|
11
|
+
import { tiktokPixel } from "@c15t/scripts/tiktok-pixel";
|
|
12
|
+
import { createContext, useContext, useEffect, useRef, } from "react";
|
|
13
|
+
import { POLICY_COOKIE } from "../types.js";
|
|
14
|
+
/** A button that opens the settings dialog, for the site's footer. Render it inside `ConsentProvider`. */
|
|
15
|
+
export { ConsentDialogLink as ConsentSettingsLink } from "@c15t/react";
|
|
16
|
+
/** Class names for c15t's unstyled parts, styled by `styles.css`. */
|
|
17
|
+
const slots = {
|
|
18
|
+
consentBanner: "sc-banner",
|
|
19
|
+
consentBannerCard: "sc-card",
|
|
20
|
+
consentBannerHeader: "sc-header",
|
|
21
|
+
consentBannerTitle: "sc-title",
|
|
22
|
+
consentBannerDescription: "sc-description",
|
|
23
|
+
consentBannerFooter: "sc-actions",
|
|
24
|
+
consentBannerFooterSubGroup: "sc-group",
|
|
25
|
+
consentDialog: "sc-dialog",
|
|
26
|
+
consentDialogCard: "sc-dialog-card",
|
|
27
|
+
consentDialogHeader: "sc-header",
|
|
28
|
+
consentDialogTitle: "sc-title",
|
|
29
|
+
consentDialogDescription: "sc-description",
|
|
30
|
+
consentDialogContent: "sc-content",
|
|
31
|
+
consentDialogOverlay: "sc-overlay",
|
|
32
|
+
consentWidget: "sc-widget",
|
|
33
|
+
consentWidgetAccordion: "sc-categories",
|
|
34
|
+
consentWidgetFooter: "sc-actions",
|
|
35
|
+
consentWidgetFooterSubGroup: "sc-group",
|
|
36
|
+
buttonPrimary: "sc-button",
|
|
37
|
+
buttonSecondary: "sc-button",
|
|
38
|
+
toggle: "sc-toggle",
|
|
39
|
+
consentBannerTag: "sc-branding",
|
|
40
|
+
consentDialogTag: "sc-branding",
|
|
41
|
+
};
|
|
42
|
+
const factories = {
|
|
43
|
+
googleTagManager: (id) => googleTagManager({ id }),
|
|
44
|
+
googleTag: (id, category) => gtag({ id, category }),
|
|
45
|
+
metaPixel: (pixelId) => metaPixel({ pixelId }),
|
|
46
|
+
linkedinInsights: (id) => linkedinInsights({ id }),
|
|
47
|
+
tiktokPixel: (pixelId) => tiktokPixel({ pixelId }),
|
|
48
|
+
microsoftUet: (id) => microsoftUet({ id }),
|
|
49
|
+
microsoftClarity: (id) => clarity({ id }),
|
|
50
|
+
hotjar: (siteId) => hotjar({ siteId }),
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* The services the plugin loads, each in its service's category. In basic consent mode nothing
|
|
54
|
+
* loads before consent, including tags c15t would otherwise load at once in a denied state.
|
|
55
|
+
*/
|
|
56
|
+
export function integrationScripts(config) {
|
|
57
|
+
return config.integrations.map(({ key, id, category }) => ({
|
|
58
|
+
...factories[key](id, category),
|
|
59
|
+
category,
|
|
60
|
+
...(config.googleConsentMode === "basic" ? { alwaysLoad: false } : {}),
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
const ConfigContext = createContext(null);
|
|
64
|
+
/** The banner, the settings dialog and c15t's consent state around the site. */
|
|
65
|
+
export function ConsentProvider({ config, scripts, children }) {
|
|
66
|
+
if (!config.enabled)
|
|
67
|
+
return _jsx(_Fragment, { children: children });
|
|
68
|
+
forgetOutdatedConsent(config.policyVersion);
|
|
69
|
+
const options = {
|
|
70
|
+
mode: "offline",
|
|
71
|
+
overrides: { country: "SE" },
|
|
72
|
+
consentCategories: config.categories,
|
|
73
|
+
scripts: [...integrationScripts(config), ...(scripts ?? [])],
|
|
74
|
+
legalLinks: config.legalLinks,
|
|
75
|
+
noStyle: true,
|
|
76
|
+
scrollLock: true,
|
|
77
|
+
theme: { slots },
|
|
78
|
+
i18n: {
|
|
79
|
+
locale: config.locale,
|
|
80
|
+
detectBrowserLanguage: false,
|
|
81
|
+
messages: { [config.locale]: config.messages },
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
// With only necessary storage there is nothing to reject: Settings and the Okay button remain.
|
|
85
|
+
const necessaryOnly = config.categories.length === 1;
|
|
86
|
+
return (_jsx(ConfigContext.Provider, { value: config, children: _jsxs(ConsentManagerProvider, { options: options, children: [children, _jsx(ConsentBanner, { hideBranding: true, layout: necessaryOnly ? [["customize", "accept"]] : undefined }), _jsx(SettingsDialog, {}), _jsx(ConsentRecorder, { config: config })] }) }));
|
|
87
|
+
}
|
|
88
|
+
function readPolicy() {
|
|
89
|
+
const match = document.cookie.match(new RegExp(`(?:^|; )${POLICY_COOKIE}=([^;]*)`));
|
|
90
|
+
return match ? decodeURIComponent(match[1] ?? "") : null;
|
|
91
|
+
}
|
|
92
|
+
const checkedPolicies = new Set();
|
|
93
|
+
/**
|
|
94
|
+
* Removes a choice made under another policy version before c15t reads it, so nothing it allowed
|
|
95
|
+
* loads before the visitor is asked again. Runs once per page load and version: a choice saved on
|
|
96
|
+
* this page writes the new version itself.
|
|
97
|
+
*/
|
|
98
|
+
function forgetOutdatedConsent(version) {
|
|
99
|
+
if (typeof document === "undefined" || checkedPolicies.has(version))
|
|
100
|
+
return;
|
|
101
|
+
checkedPolicies.add(version);
|
|
102
|
+
if (readPolicy() === version || !/(?:^|; )c15t=/.test(document.cookie))
|
|
103
|
+
return;
|
|
104
|
+
document.cookie = "c15t=; Path=/; Max-Age=0";
|
|
105
|
+
try {
|
|
106
|
+
window.localStorage.removeItem("c15t");
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
// Without storage access there is nothing stored to remove.
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function writePolicy(version) {
|
|
113
|
+
const secure = window.location.protocol === "https:" ? "; Secure" : "";
|
|
114
|
+
document.cookie = `${POLICY_COOKIE}=${encodeURIComponent(version)}; Path=/; Max-Age=${365 * 24 * 60 * 60}; SameSite=Lax${secure}`;
|
|
115
|
+
}
|
|
116
|
+
/** Posts each choice saved on this page to the site's consent records, with its policy version. */
|
|
117
|
+
function ConsentRecorder({ config }) {
|
|
118
|
+
const { consentInfo, consents } = useConsentManager();
|
|
119
|
+
const mountedAt = useRef(Date.now());
|
|
120
|
+
const savedAt = consentInfo?.time;
|
|
121
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: a new save time is a new choice.
|
|
122
|
+
useEffect(() => {
|
|
123
|
+
if (!savedAt || savedAt < mountedAt.current)
|
|
124
|
+
return;
|
|
125
|
+
writePolicy(config.policyVersion);
|
|
126
|
+
if (!config.recordUrl || !consentInfo?.subjectId)
|
|
127
|
+
return;
|
|
128
|
+
const choices = Object.fromEntries(config.categories.map((category) => [category, Boolean(consents[category])]));
|
|
129
|
+
fetch(config.recordUrl, {
|
|
130
|
+
method: "POST",
|
|
131
|
+
headers: { "Content-Type": "application/json" },
|
|
132
|
+
keepalive: true,
|
|
133
|
+
body: JSON.stringify({
|
|
134
|
+
subjectId: consentInfo.subjectId,
|
|
135
|
+
choices,
|
|
136
|
+
policyVersion: config.policyVersion,
|
|
137
|
+
locale: config.locale,
|
|
138
|
+
path: window.location.pathname,
|
|
139
|
+
}),
|
|
140
|
+
}).catch(() => {
|
|
141
|
+
// The choice still applies in the browser; only the record is missing.
|
|
142
|
+
});
|
|
143
|
+
}, [savedAt]);
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
/** c15t's dialog; a click on the backdrop discards unsaved toggles and returns to the banner. */
|
|
147
|
+
function SettingsDialog() {
|
|
148
|
+
const { consents, selectedConsents, setSelectedConsent, hasConsented, setActiveUI } = useConsentManager();
|
|
149
|
+
function dismiss(event) {
|
|
150
|
+
if (event.target !== event.currentTarget)
|
|
151
|
+
return;
|
|
152
|
+
for (const name of Object.keys(selectedConsents))
|
|
153
|
+
setSelectedConsent(name, consents[name] ?? false);
|
|
154
|
+
setActiveUI(hasConsented() ? "none" : "banner");
|
|
155
|
+
}
|
|
156
|
+
// With only necessary storage there is nothing to reject; c15t's dialog has no option to drop
|
|
157
|
+
// the button, so a class hides it (see consent.css).
|
|
158
|
+
const necessaryOnly = useContext(ConfigContext)?.categories.length === 1;
|
|
159
|
+
return (_jsx(C15tDialog.Root, { className: necessaryOnly ? "sc-dialog--necessary-only" : undefined, onClick: dismiss, children: _jsx(C15tDialog.ConsentCustomizationCard, { hideBranding: true }) }));
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Embedded content, such as a video or a map, that is not mounted until the visitor allows its
|
|
163
|
+
* category. Until then a placeholder offers to allow it. Without the banner, the content shows.
|
|
164
|
+
*/
|
|
165
|
+
export function ConsentFrame({ category, children, className }) {
|
|
166
|
+
const config = useContext(ConfigContext);
|
|
167
|
+
if (!config)
|
|
168
|
+
return _jsx(_Fragment, { children: children });
|
|
169
|
+
return (_jsx(Frame, { category: category, className: className, noStyle: true, placeholder: _jsx(EmbedPlaceholder, { category: category, config: config }), children: children }));
|
|
170
|
+
}
|
|
171
|
+
function EmbedPlaceholder({ category, config }) {
|
|
172
|
+
const { setConsent } = useConsentManager();
|
|
173
|
+
const title = config.messages.consentTypes?.[category]?.title ?? category;
|
|
174
|
+
return (_jsxs("div", { className: "sc-frame", children: [_jsx("p", { children: config.embeds.title.replaceAll("{category}", title) }), _jsx("button", { type: "button", onClick: () => setConsent(category, true), children: config.embeds.button.replaceAll("{category}", title) })] }));
|
|
175
|
+
}
|
|
176
|
+
/** The cookie services by category, from `getCookieTable`, for the site's cookie page. */
|
|
177
|
+
export function CookieTable({ data, heading }) {
|
|
178
|
+
const { labels } = data;
|
|
179
|
+
return (_jsxs("section", { className: "sc-cookie-table", children: [heading ? _jsx("h2", { children: heading }) : null, data.categories.map((category) => (_jsxs("section", { children: [_jsx("h3", { children: category.title }), _jsx("p", { children: category.description }), category.services.length ? null : _jsx("p", { children: labels.noServices }), category.services.map((service) => (_jsxs("div", { className: "sc-cookie-service", children: [_jsxs("h4", { children: [service.name, service.provider ? ` · ${service.provider}` : null] }), service.purpose ? _jsx("p", { children: service.purpose }) : null, service.policyUrl ? (_jsx("p", { children: _jsx("a", { href: service.policyUrl, rel: "noopener noreferrer", target: "_blank", children: labels.policy }) })) : null, service.storage.length ? (_jsxs("table", { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { scope: "col", children: labels.name }), _jsx("th", { scope: "col", children: labels.type }), _jsx("th", { scope: "col", children: labels.duration }), _jsx("th", { scope: "col", children: labels.thirdParty }), _jsx("th", { scope: "col", children: labels.purpose })] }) }), _jsx("tbody", { children: service.storage.map((entry) => (_jsxs("tr", { children: [_jsx("td", { children: _jsx("code", { children: entry.name }) }), _jsx("td", { children: entry.type }), _jsx("td", { children: entry.duration ?? "–" }), _jsx("td", { children: entry.thirdParty ? labels.yes : labels.no }), _jsx("td", { children: entry.description ?? "–" })] }, `${entry.type}:${entry.name}`))) })] })) : null] }, service.name)))] }, category.key)))] }));
|
|
180
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ConsentScanWidget } from "../widget/ConsentScanWidget.tsx";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ConsentScanWidget } from "../widget/ConsentScanWidget.js";
|
package/dist/global.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { GlobalConfig } from "payload";
|
|
2
|
+
import { type Category } from "./defaults.ts";
|
|
3
|
+
import type { ScanSchedule } from "./schedule.ts";
|
|
4
|
+
import { type ConsentPluginOptions } from "./types.ts";
|
|
5
|
+
type Label = {
|
|
6
|
+
en: string;
|
|
7
|
+
sv: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const categoryLabels: Record<Category, Label>;
|
|
10
|
+
export declare function consentGlobal(options: ConsentPluginOptions, { usersSlug, schedule }: {
|
|
11
|
+
usersSlug: string;
|
|
12
|
+
schedule: ScanSchedule;
|
|
13
|
+
}): GlobalConfig;
|
|
14
|
+
export {};
|