@grubgenie/sdui-contracts
v1.0.4
Published
Shared contracts for the GrubGenie SDUI (Server-Driven UI) system — Zod schemas, TypeScript types, constants, and the `sduiCatalog` used by both the frontend and backend.
Readme
@grubgenie/sdui-contracts
Shared contracts for the GrubGenie SDUI (Server-Driven UI) system — Zod schemas, TypeScript types, constants, and the sduiCatalog used by both the frontend and backend.
Install
npm install @grubgenie/sdui-contractsWhat's exported
Constants
import {
SDUI_TRIGGER, // valid trigger values
SDUI_DISPLAY_CONTEXT, // valid slot IDs (SDUISlotId)
SDUI_COMPONENT_TYPE, // valid component type strings
SDUI_ACTION, // valid action names
SUPPORTED_CURRENCIES, // ['aed', 'inr']
} from '@grubgenie/sdui-contracts';Types
import type { SDUISlotId } from '@grubgenie/sdui-contracts';
// SDUISlotId = union of all SDUI_DISPLAY_CONTEXT valuesComponent prop schemas
import { comboCardProps, reorderNudgeProps, /* ... */ } from '@grubgenie/sdui-contracts';
// One Zod schema per component type. Use .parse() / .safeParse() to validate props.Action param schemas
import { addToCartParams, dismissParams, /* ... */ } from '@grubgenie/sdui-contracts';
// One Zod schema per action. Use .parse() / .safeParse() to validate action params.Catalog
import { sduiCatalog } from '@grubgenie/sdui-contracts';
// defineCatalog(@json-render) result — use directly with defineRegistry on the frontend
// or for schema lookups on the backend.Development
# Build (ESM + CJS + DTS)
npm run build:contracts
# Typecheck
npm -w @grubgenie/sdui-contracts run typecheckPublish
# Bump version in packages/sdui-contracts/package.json first
npm run publish:contracts