*/ public const array COLORS = [ 'background', 'surface', 'foreground', 'muted', 'primary', 'primaryForeground', 'accent', 'border', ]; /** * Fonts the storefront can load. Key is what the plan stores, value is the font family name. * * @var array */ public const array FONTS = [ 'inter' => 'Inter', 'dm-sans' => 'DM Sans', 'poppins' => 'Poppins', 'manrope' => 'Manrope', 'space-grotesk' => 'Space Grotesk', 'playfair-display' => 'Playfair Display', 'lora' => 'Lora', 'fraunces' => 'Fraunces', // Added in Step 9 part 4, for more personality. 'cormorant-garamond' => 'Cormorant Garamond', 'dm-serif-display' => 'DM Serif Display', 'libre-baskerville' => 'Libre Baskerville', 'bricolage-grotesque' => 'Bricolage Grotesque', 'syne' => 'Syne', 'unbounded' => 'Unbounded', 'archivo-black' => 'Archivo Black', 'bebas-neue' => 'Bebas Neue', 'outfit' => 'Outfit', 'jost' => 'Jost', 'nunito' => 'Nunito', 'caveat' => 'Caveat', ]; /** * Fonts that only suit big headings: one weight, all capitals or handwriting. Never for body text. * * @var list */ public const array HEADING_ONLY_FONTS = ['archivo-black', 'bebas-neue', 'caveat', 'dm-serif-display']; /** * The look of the whole store, beyond colours and fonts. Every option is optional; an old plan without * "style" uses the defaults, which look exactly like stores did before. * * - buttons: solid, outline (a line around, filled on hover) or shadow (a solid offset shadow, playful and bold) * - cards: border (thin line), shadow (soft lift), plain (no edge) or hard (thick line and solid offset shadow) * - spacing: compact, normal or airy (room between sections) * - headings: normal, uppercase (spaced capitals, elegant) or heavy (extra bold and tight) * - backgrounds: plain, or alternate (every other section on a soft band) * - motion: none, or gentle (sections fade up as they come into view; never for visitors who ask for less motion) * * @var array> */ public const array STYLE_OPTIONS = [ 'buttons' => ['solid', 'outline', 'shadow'], 'cards' => ['border', 'shadow', 'plain', 'hard'], 'spacing' => ['compact', 'normal', 'airy'], 'headings' => ['normal', 'uppercase', 'heavy'], 'backgrounds' => ['plain', 'alternate'], 'motion' => ['none', 'gentle'], ]; /** @var array */ public const array STYLE_DEFAULTS = [ 'buttons' => 'solid', 'cards' => 'border', 'spacing' => 'normal', 'headings' => 'normal', 'backgrounds' => 'plain', 'motion' => 'none', ]; /** * Ready-made looks for the Design tab's Style box. Each sets the style, corner roundness and fonts; * colours stay as they are. * * @var array}> */ public const array STYLE_PRESETS = [ 'minimal' => [ 'label' => 'Minimal', 'hint' => 'Clean, lots of space, quiet details', 'radius' => 'small', 'fonts' => ['heading' => 'manrope', 'body' => 'inter'], 'style' => ['buttons' => 'solid', 'cards' => 'plain', 'spacing' => 'airy', 'headings' => 'normal', 'backgrounds' => 'plain', 'motion' => 'gentle'], ], 'soft' => [ 'label' => 'Soft', 'hint' => 'Rounded, gentle shadows, friendly', 'radius' => 'large', 'fonts' => ['heading' => 'outfit', 'body' => 'nunito'], 'style' => ['buttons' => 'solid', 'cards' => 'shadow', 'spacing' => 'airy', 'headings' => 'normal', 'backgrounds' => 'alternate', 'motion' => 'gentle'], ], 'elegant' => [ 'label' => 'Elegant', 'hint' => 'Serif headings, fine lines, premium', 'radius' => 'none', 'fonts' => ['heading' => 'cormorant-garamond', 'body' => 'jost'], 'style' => ['buttons' => 'outline', 'cards' => 'plain', 'spacing' => 'airy', 'headings' => 'uppercase', 'backgrounds' => 'plain', 'motion' => 'gentle'], ], 'bold' => [ 'label' => 'Bold', 'hint' => 'Heavy type, hard shadows, loud', 'radius' => 'none', 'fonts' => ['heading' => 'archivo-black', 'body' => 'space-grotesk'], 'style' => ['buttons' => 'shadow', 'cards' => 'hard', 'spacing' => 'normal', 'headings' => 'heavy', 'backgrounds' => 'alternate', 'motion' => 'gentle'], ], 'playful' => [ 'label' => 'Playful', 'hint' => 'Round shapes, fun type, lively', 'radius' => 'full', 'fonts' => ['heading' => 'bricolage-grotesque', 'body' => 'dm-sans'], 'style' => ['buttons' => 'shadow', 'cards' => 'shadow', 'spacing' => 'normal', 'headings' => 'heavy', 'backgrounds' => 'alternate', 'motion' => 'gentle'], ], 'classic' => [ 'label' => 'Classic', 'hint' => 'How stores looked before: simple and safe', 'radius' => 'medium', 'fonts' => ['heading' => 'manrope', 'body' => 'inter'], 'style' => self::STYLE_DEFAULTS, ], ]; /** * How rounded corners are. * * @var list */ public const array RADII = ['none', 'small', 'medium', 'large', 'full']; /** * Section types and the layout variants each one supports. * * @var array> */ public const array SECTIONS = [ 'header' => ['simple', 'centered'], // centered: text only. split: text beside a photo. image-full: a full-width photo with the text on it. 'hero' => ['centered', 'split', 'image-full'], // A row of short reassurances, such as free shipping and secure payment. row: a band. boxed: small cards. 'trust_bar' => ['row', 'boxed'], 'product_grid' => ['grid', 'minimal'], 'featured_product' => ['image-left', 'image-right'], 'about' => ['simple', 'with-stats'], 'testimonials' => ['cards', 'single'], 'faq' => ['list', 'two-column'], 'newsletter' => ['banner', 'card'], 'contact' => ['simple', 'card'], 'footer' => ['simple', 'centered'], ]; /** * Section types a page may contain. The header and footer are not here: * they live once at the top of the plan and appear on every page. * * @return array> */ public static function pageSections(): array { return array_diff_key(self::SECTIONS, ['header' => true, 'footer' => true]); } /** What a trust row item can be. */ public const array TRUST_KINDS = ['shipping', 'payment', 'whatsapp', 'custom']; /** Icons a trust row item may use. */ public const array TRUST_ICONS = ['truck', 'shield', 'chat', 'refresh', 'leaf', 'star', 'gift', 'clock', 'heart', 'award', 'map-pin', 'package']; /** Sections per page. */ public const int MAX_SECTIONS = 20; public const int MAX_PAGES = 10; /** * Addresses inside a store that are not pages of the plan but still exist, so links to them are fine. * * @var list */ public const array BUILT_IN_PATHS = ['shop', 'products', 'cart']; /** The first page of every plan. */ public const string HOME_PAGE = 'home'; /** * Page ids the AI and merchants may not use, because the app has its own pages at these addresses. * * @var list */ public const array RESERVED_PAGE_IDS = ['shop', 'products', 'cart', 'checkout', 'orders', 'account', 'search']; /** * Links may only point inside the page, inside the site, or to safe outside targets. * This blocks things like "javascript:" links. */ public const string LINK_PATTERN = '/^(#[A-Za-z0-9_-]*|\/(?!\/)[^\s]*|https:\/\/[^\s]+|mailto:[^\s]+|tel:[0-9+\-\s]+)$/'; public const string COLOR_PATTERN = '/^#[0-9A-Fa-f]{6}$/'; public const string PRODUCT_SLUG_PATTERN = '/^[a-z0-9]+(?:-[a-z0-9]+)*$/'; /** Used for both section ids and page ids. */ public const string SECTION_ID_PATTERN = '/^[a-z][a-z0-9-]{0,39}$/'; /** * Validation rules for the content of one section type. * Keys are relative to the section's "content" object. * * @return array> */ public static function contentRules(string $type): array { $text = fn (int $max) => ['required', 'string', 'max:'.$max]; $optionalText = fn (int $max) => ['nullable', 'string', 'max:'.$max]; $link = ['required', 'string', 'max:300', 'regex:'.self::LINK_PATTERN]; $price = ['required', 'numeric', 'min:0', 'max:999999']; return match ($type) { 'header' => [ 'logoText' => $text(40), 'links' => ['present', 'array', 'max:6'], 'links.*.label' => $text(30), 'links.*.href' => $link, 'cta' => ['nullable', 'array'], 'cta.label' => ['required_with:cta', 'string', 'max:30'], 'cta.href' => ['required_with:cta', 'string', 'max:300', 'regex:'.self::LINK_PATTERN], ], 'hero' => [ 'eyebrow' => $optionalText(60), 'headline' => $text(120), 'subheadline' => $text(300), 'primaryCta' => ['required', 'array'], 'primaryCta.label' => $text(30), 'primaryCta.href' => $link, 'secondaryCta' => ['nullable', 'array'], 'secondaryCta.label' => ['required_with:secondaryCta', 'string', 'max:30'], 'secondaryCta.href' => ['required_with:secondaryCta', 'string', 'max:300', 'regex:'.self::LINK_PATTERN], // "upload:12" (a photo uploaded in the Design tab) or "product:web-address-name" (a product's main photo). // Null means automatic: the store's own product photos are used. 'image' => ['nullable', 'string', 'max:140', 'regex:'.HeroImages::PATTERN], ], 'product_grid' => [ 'heading' => $text(80), 'subheading' => $optionalText(200), 'items' => ['required', 'array', 'min:2', 'max:8'], 'items.*.name' => $text(80), 'items.*.price' => $price, 'items.*.badge' => $optionalText(20), ], 'featured_product' => [ 'eyebrow' => $optionalText(60), 'name' => $text(80), 'description' => $text(500), 'price' => $price, 'bullets' => ['present', 'array', 'max:5'], 'bullets.*' => $text(100), 'cta' => ['required', 'array'], 'cta.label' => $text(30), 'cta.href' => $link, // The web-address name of one of the store's real products. When set, the store shows that // product's real name, price and photo instead of "name" and "price" above. 'productSlug' => ['nullable', 'string', 'max:120', 'regex:'.self::PRODUCT_SLUG_PATTERN], ], 'about' => [ 'heading' => $text(80), 'body' => $text(1200), 'stats' => ['present', 'array', 'max:4'], 'stats.*.value' => $text(12), 'stats.*.label' => $text(40), ], 'trust_bar' => [ 'items' => ['required', 'array', 'min:2', 'max:4'], // shipping, payment and whatsapp are written by the store itself from its real settings, so they // stay true when the merchant changes them. custom uses the title and text below. 'items.*.kind' => ['required', 'string', 'in:'.implode(',', self::TRUST_KINDS)], 'items.*.icon' => ['nullable', 'string', 'in:'.implode(',', self::TRUST_ICONS)], 'items.*.title' => ['required_if:items.*.kind,custom', 'nullable', 'string', 'max:40'], 'items.*.text' => ['nullable', 'string', 'max:80'], ], 'testimonials' => [ 'heading' => $text(80), 'items' => ['required', 'array', 'min:1', 'max:6'], 'items.*.quote' => $text(400), 'items.*.name' => $text(60), 'items.*.role' => $optionalText(60), ], 'faq' => [ 'heading' => $text(80), 'items' => ['required', 'array', 'min:1', 'max:10'], 'items.*.question' => $text(160), 'items.*.answer' => $text(600), ], 'newsletter' => [ 'heading' => $text(80), 'body' => $optionalText(240), 'placeholder' => $text(40), 'buttonLabel' => $text(30), ], 'contact' => [ 'heading' => $text(80), 'body' => $optionalText(300), 'email' => ['nullable', 'email', 'max:120'], 'phone' => $optionalText(30), 'whatsapp' => ['nullable', 'string', 'regex:/^[0-9]{8,15}$/'], 'address' => $optionalText(200), ], 'footer' => [ 'text' => $text(160), 'links' => ['present', 'array', 'max:8'], 'links.*.label' => $text(30), 'links.*.href' => $link, ], default => [], }; } }