import { useEffect, useRef } from "react" import type { CSSProperties } from "react" import { addPropertyControls, ControlType, RenderTarget } from "framer" /** * Spurvik · Interactive EU AI Act Art. 50 & 2 Dec 2026 C2PA Trust-Center Card for Framer. * * Paste into Assets → Code → New Code File, then drag "SpurvikAIActTrustCard" onto * your /trust, /security, or /privacy page. On the published site it loads * https://spurvik.com/trust-widget.js (MIT, zero cookies, Shadow DOM, 10 EU languages) * and renders a live 4-signal Art. 50(1) + Art. 50(2) C2PA status card with DPO Brief * and C2PA Check links. The Framer canvas displays a crisp static preview. * * Set "Spurvik link" to Hide on Spurvik Pro (€19/mo or €190/yr) or Done-For-You (€199 once): * https://console.spurvik.com/signup?plan=pro */ type Theme = "dark" | "light" type TrustLocale = "auto" | "en" | "de" | "fr" | "nl" | "da" | "sv" | "fi" | "es" | "it" | "pl" interface Props { domain: string locale: TrustLocale theme: Theme liveCheck: boolean attribution: boolean style?: CSSProperties } interface SpurvikTrustWidgetApi { create: (options: { target?: HTMLElement | null domain?: string locale?: string theme?: Theme live?: boolean attribution?: boolean }) => HTMLElement | null } const WIDGET_SRC = "https://spurvik.com/trust-widget.js" const LOCALES: TrustLocale[] = ["en", "de", "fr", "nl", "da", "sv", "fi", "es", "it", "pl"] function widgetApi(): SpurvikTrustWidgetApi | undefined { return (window as unknown as { SpurvikTrustWidget?: SpurvikTrustWidgetApi }).SpurvikTrustWidget } let loading: Promise | null = null function loadTrustWidget(): Promise { const ready = widgetApi() if (ready) return Promise.resolve(ready) if (loading) return loading loading = new Promise((resolve, reject) => { const existing = document.querySelector(`script[src="${WIDGET_SRC}"]`) const script = existing ?? document.createElement("script") script.addEventListener( "load", () => { const api = widgetApi() if (api) resolve(api) else reject(new Error("trust-widget.js loaded without window.SpurvikTrustWidget")) }, { once: true } ) script.addEventListener( "error", () => { loading = null reject(new Error(`Could not load ${WIDGET_SRC}`)) }, { once: true } ) if (!existing) { script.src = WIDGET_SRC script.async = true script.setAttribute("data-spurvik-mounted", "framer") script.setAttribute("data-cookieconsent", "ignore") script.setAttribute("data-uc-allowed", "true") document.head.appendChild(script) } }) return loading } /** * @framerSupportedLayoutWidth any-prefer-fixed * @framerSupportedLayoutHeight auto * @framerIntrinsicWidth 460 */ export default function SpurvikAIActTrustCard(props: Props) { const { domain = "yourdomain.com", locale = "auto", theme = "dark", liveCheck = true, attribution = true, style, } = props const slot = useRef(null) const onCanvas = RenderTarget.current() === RenderTarget.canvas useEffect(() => { if (onCanvas) return const mountNode = slot.current if (!mountNode) return let cancelled = false mountNode.replaceChildren() const inner = document.createElement("div") mountNode.appendChild(inner) loadTrustWidget() .then((api) => { if (cancelled) return const cleanDomain = domain.trim() || window.location.hostname api.create({ target: inner, domain: cleanDomain, locale: locale === "auto" ? undefined : locale, theme, live: liveCheck, attribution, }) }) .catch((error: unknown) => { console.error("[spurvik-framer-trust-card]", error) }) return () => { cancelled = true mountNode.replaceChildren() } }, [onCanvas, domain, locale, theme, liveCheck, attribution]) if (onCanvas) { const light = theme === "light" const cleanHost = domain.trim() || "yourdomain.com" return (
EU AI Act Art. 50 Readiness
{cleanHost}
ART. 50(1) AI NOTICE
24 EU languages
ART. 50(2) · 2 DEC 2026
C2PA & CDN check
EU Frankfurt (fra1) · 0 cookies {attribution ? Art. 50 · Spurvik : White-label (Pro)}
) } return
} function cardShell(light: boolean): CSSProperties { return { padding: 14, borderRadius: 14, fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif", background: light ? "#FFFFFF" : "#070B14", color: light ? "#0F172A" : "#F8FAFC", border: `1px solid ${light ? "rgba(15, 23, 42, 0.14)" : "rgba(16, 185, 129, 0.32)"}`, boxShadow: "0 12px 28px rgba(0, 0, 0, 0.24)", minWidth: 300, } } function cell(light: boolean): CSSProperties { return { padding: "8px 10px", borderRadius: 10, background: light ? "#F8FAFC" : "rgba(15, 23, 42, 0.72)", border: `1px solid ${light ? "rgba(15, 23, 42, 0.08)" : "rgba(148, 163, 184, 0.14)"}`, } } function cellLabel(light: boolean): CSSProperties { return { fontSize: 9, fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace", letterSpacing: 0.4, color: light ? "#64748B" : "#94A3B8", marginBottom: 2, } } const dot: CSSProperties = { width: 8, height: 8, borderRadius: 9999, background: "#10B981", boxShadow: "0 0 8px #10B981", flexShrink: 0, } const pill: CSSProperties = { fontSize: 10, fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace", color: "#10B981", padding: "2px 8px", borderRadius: 999, background: "rgba(16, 185, 129, 0.12)", border: "1px solid rgba(16, 185, 129, 0.28)", } addPropertyControls(SpurvikAIActTrustCard, { domain: { type: ControlType.String, title: "Domain", defaultValue: "yourdomain.com", placeholder: "yourdomain.com", }, locale: { type: ControlType.Enum, title: "Language", options: ["auto", ...LOCALES], optionTitles: ["Auto (TLD / page lang)", ...LOCALES.map((code) => code.toUpperCase())], defaultValue: "auto", }, theme: { type: ControlType.Enum, title: "Theme", options: ["dark", "light"], optionTitles: ["Dark", "Light"], defaultValue: "dark", displaySegmentedControl: true, }, liveCheck: { type: ControlType.Boolean, title: "Live check", defaultValue: true, enabledTitle: "On", disabledTitle: "Static", }, attribution: { type: ControlType.Boolean, title: "Spurvik link", description: "Off = Pro white-label (€19/mo or €190/yr).", defaultValue: true, enabledTitle: "Show", disabledTitle: "Hide", }, })