@officexapp/catalogs-cli 0.4.7 → 0.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +32 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -321,6 +321,27 @@ function deepValidateCatalog(schema) {
321
321
  const routing = schema.routing || {};
322
322
  const edges = routing.edges || [];
323
323
  const entry = routing.entry;
324
+ const RESERVED_PAGE_IDS = /* @__PURE__ */ new Set([
325
+ "checkout",
326
+ "__checkout",
327
+ "__global",
328
+ "submitted",
329
+ "__submitted"
330
+ ]);
331
+ for (const pageId of pageIds) {
332
+ if (RESERVED_PAGE_IDS.has(pageId)) {
333
+ errors.push(
334
+ `page "${pageId}" uses a reserved ID. CatalogKit reserves this name for its built-in ${pageId.replace(/^_+/, "")} system. Please rename it (e.g. "${pageId}-review", "order-${pageId}")`
335
+ );
336
+ }
337
+ if (pageId.startsWith("__")) {
338
+ if (!RESERVED_PAGE_IDS.has(pageId)) {
339
+ warnings.push(
340
+ `page "${pageId}" uses a double-underscore prefix which is reserved for internal CatalogKit components`
341
+ );
342
+ }
343
+ }
344
+ }
324
345
  const KNOWN_TYPES = /* @__PURE__ */ new Set([
325
346
  // Display / layout
326
347
  "heading",
@@ -2656,6 +2677,17 @@ function buildPreviewHtml(schema, port, validation, devConfig) {
2656
2677
  openCart: () => setCartOpen(true),
2657
2678
  closeCart: () => setCartOpen(false),
2658
2679
  getCartItems: () => [...cartItems],
2680
+ startCheckout: () => {
2681
+ // Fire before_checkout listeners, then show checkout
2682
+ let prevented = false;
2683
+ const payload = { items: [...cartItems], preventDefault: () => { prevented = true; } };
2684
+ const bcSet = listeners['before_checkout'];
2685
+ if (bcSet) { for (const cb of bcSet) { try { cb(payload); } catch (e) { console.error('[CatalogKit] before_checkout error:', e); } } }
2686
+ if (prevented) return;
2687
+ setCartOpen(false);
2688
+ setShowCheckout(true);
2689
+ devEvents.emit('checkout_start', { item_count: cartItems.length });
2690
+ },
2659
2691
  getGlobal: (key) => globalsRef.current[key],
2660
2692
  setGlobal: (key, value) => { globalsRef.current[key] = value; },
2661
2693
  setComponentProp: (id, prop, value) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@officexapp/catalogs-cli",
3
- "version": "0.4.7",
3
+ "version": "0.4.8",
4
4
  "description": "CLI for Catalog Kit — upload videos, push catalogs, manage assets",
5
5
  "type": "module",
6
6
  "bin": {