The host no longer carries a runtime product catalog. products.js shrinks to a legacy single-product stub; the canonical catalog lives in template-manager's productsStore, seeded ONCE on first boot from the new seedProducts.js (after that the store under templates/ is authoritative and the seed is ignored — intentional, so restarts never rewrite an admin-managed catalog). phoneModels.js and templateCategories.js are the supporting constant sets, and docs/template-schema.md documents the v4 schema. templates/ is the admin-managed store itself (_products_index.json + products/<id>/product.json, JSON only) — committed so the configured catalog (sizes, pricing, options built up in the admin UI) survives a fresh checkout rather than regressing to the seed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
70 lines
2.6 KiB
JavaScript
70 lines
2.6 KiB
JavaScript
/**
|
|
* Legacy single-product stub.
|
|
*
|
|
* v0.6 — the host no longer owns a runtime product catalog. The
|
|
* canonical catalog lives in template-manager (productsStore) and is
|
|
* seeded once from src/constants/seedProducts.js.
|
|
*
|
|
* What's left in this file
|
|
* ────────────────────────
|
|
* The legacy single-product editor flow at `/` (apparel-designer's
|
|
* App.jsx) calls `getActiveProduct()` and reads a small set of
|
|
* shape-only fields off the result: `canvasSize`, `printZone`,
|
|
* `productSvg`, `background`. We keep a minimal stub here so that
|
|
* flow continues booting without re-architecting it for the v0.6
|
|
* data shape.
|
|
*
|
|
* Migration intent
|
|
* ────────────────
|
|
* The legacy `/` flow is slated for retirement; the customer-facing
|
|
* surface is `/customize?template=…` which reads the template's
|
|
* embedded variant. When the legacy flow is removed, this file goes
|
|
* with it.
|
|
*/
|
|
|
|
// Bare shirt shape with just enough fields for the legacy
|
|
// getActiveProduct() consumers in App.jsx + the editor's
|
|
// legacy single-product code paths.
|
|
const LEGACY_SHIRT_STUB = {
|
|
id: 'shirt',
|
|
label: 'T-Shirt',
|
|
canvasSize: 300,
|
|
printZone: { x: 90, y: 130, width: 220, height: 220 },
|
|
productSvg: { component: 'shirt', width: 400, height: 470 },
|
|
background: { mode: 'color', defaultColorId: 'white' },
|
|
// No variants — v0.6 catalog lives in template-manager.
|
|
variants: [],
|
|
};
|
|
|
|
/**
|
|
* Return the active product for the legacy single-product editor.
|
|
* Always returns the shirt stub in v0.6.
|
|
*/
|
|
export function getActiveProduct() {
|
|
return LEGACY_SHIRT_STUB;
|
|
}
|
|
|
|
// ── Deprecated exports ────────────────────────────────────────
|
|
//
|
|
// These names are referenced in places that haven't been swept yet.
|
|
// They resolve to the legacy stub or to undefined so any straggling
|
|
// importer doesn't crash on module load. Will be removed in a
|
|
// follow-up cleanup pass.
|
|
|
|
/** @deprecated Use seedProducts.DEFAULT_PRODUCT_ID. */
|
|
export const DEFAULT_PRODUCT_TYPE_ID = 'shirt';
|
|
|
|
/** @deprecated Use seedProducts.DEFAULT_SIZE_ID. */
|
|
export const DEFAULT_VARIANT_ID = 'shirt-default';
|
|
|
|
/** @deprecated Use seedProducts. */
|
|
export const ACTIVE_PRODUCT_ID = 'shirt';
|
|
|
|
/** @deprecated Use seedProducts; map productId/sizeId via the products API. */
|
|
export const PRODUCT_TYPES = { shirt: LEGACY_SHIRT_STUB };
|
|
|
|
/** @deprecated Use the resolved variant from a template GET response. */
|
|
export function getVariant(_productTypeId, _variantId) {
|
|
return null;
|
|
}
|