chris 1f1dabdb31 Add custom vinyl balloon configurator
Adds a per-letter vinyl text add-on tied to the Custom Vinyl Square item.
Customers pick a balloon shape (Heart/Star/Circle), type their message
(max 30 non-space chars, ASCII only — no emoji), and choose from 8 Google
Fonts rendered as live previews. Price updates in real time at $0.65/letter.

At checkout, vinyl orders expand to two Square line items: the 18" Shape
balloon at its catalog price and the Custom Vinyl service at the calculated
letter count price, with the font attached as a modifier.

Also adds a per-item admin toggle ("Suggest custom vinyl add-on") that shows
a promo note on any balloon's product modal pointing customers toward the
vinyl service.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-29 13:03:38 -04:00

40 lines
1007 B
TypeScript

import { NextResponse } from 'next/server'
import { readFileSync, existsSync } from 'fs'
import path from 'path'
export interface VinylShape {
name: string
variationId: string
priceCents: number
}
export interface VinylFont {
id: string
name: string
family: string
}
export interface VinylConfig {
vinylItemId: string
vinylVariationId: string
pricePerLetterCents: number
maxCharacters: number
shapeItemId: string
shapes: VinylShape[]
fonts: VinylFont[]
}
const CONFIG_PATH = path.join(process.cwd(), 'data', 'vinyl-config.json')
export async function GET() {
if (!existsSync(CONFIG_PATH)) {
return NextResponse.json({ error: 'Vinyl config not found' }, { status: 404 })
}
try {
const config: VinylConfig = JSON.parse(readFileSync(CONFIG_PATH, 'utf-8'))
return NextResponse.json(config)
} catch {
return NextResponse.json({ error: 'Failed to load vinyl config' }, { status: 500 })
}
}