import { GlobalConfig } from "payload"; import { requirePermission } from "@/utils/access-control/hasPermission"; export const Shims: GlobalConfig = { slug: "shims", access: { read: requirePermission("shims:read"), update: requirePermission("shims:update"), }, fields: [ { name: "shims", type: "array", fields: [ { name: "name", type: "text", required: true, unique: true, admin: { description: "Unique identifier for this shim. Used internally for stable hashing.", }, }, { name: "summary", type: "text", admin: { description: "Brief description of what this shim does (for admin reference).", }, }, { name: "enabled", type: "checkbox", defaultValue: false, admin: { description: "Disabled shims are never injected, regardless of targeting rules.", }, }, { name: "type", type: "select", options: [ { label: "CSS", value: "css" }, { label: "JavaScript", value: "js" }, ], required: true, defaultValue: "css", }, { name: "content", type: "code", required: true, admin: { components: { Field: "@/components/admin/shims/ShimContentField", }, description: "CSS or JS code to inject. CSS is added as a