feat: Update legal text for user consent and data processing across multiple locales, ensuring clarity and compliance with regulations

This commit is contained in:
sebseb7
2026-03-25 10:59:10 +01:00
parent e1a545e4a8
commit 91388244d8
3 changed files with 699 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
/**
* POST client errors to /api/telemetry/js-errors (shop API).
* Uses same-origin relative URL so the dev-server proxy forwards to the backend.
*/
const TELEMETRY_PATH = '/api/telemetry/js-errors';
function send(payload) {
fetch(TELEMETRY_PATH, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload),
}).catch(() => {});
}
/**
* Register global listeners once. Safe to call in browser only.
*/
export function installJsErrorTelemetry() {
if (typeof window === 'undefined') {
return;
}
window.addEventListener('error', (event) => {
send({
message: event.message || 'Error',
name: event.error?.name,
filename: event.filename,
lineno: event.lineno,
colno: event.colno,
url: window.location.href,
stack: event.error && event.error.stack,
});
});
window.addEventListener('unhandledrejection', (event) => {
const reason = event.reason;
send({
message:
reason && typeof reason.message === 'string'
? reason.message
: String(reason),
name: reason && reason.name,
stack: reason && reason.stack,
url: window.location.href,
context: { type: 'unhandledrejection' },
});
});
}