import type { ActionFunctionArgs } from "@remix-run/node"; import { authenticate } from "../shopify.server"; import { redactCustomerData, type CustomerWebhookPayload } from "../services/gdpr.server"; // GDPR: erase a specific customer's data (fires 10 days after a customer's // data erasure request, or 6 months after their last order on the shop). // Bookings are kept for the shop's own revenue/utilization history — only // the customer-identifying fields (email/phone) are anonymized. export const action = async ({ request }: ActionFunctionArgs) => { const { shop, topic, payload } = await authenticate.webhook(request); const { customer } = payload as CustomerWebhookPayload; const { count } = await redactCustomerData(shop, customer); console.log( `[gdpr] ${topic} for ${shop}: customer ${customer?.id ?? "unknown"} — redacted ${count} booking(s)`, ); return new Response(); };