@officexapp/catalogs-cli 0.4.6 → 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 +57 -2
  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) => {
@@ -3085,6 +3117,19 @@ function buildPreviewHtml(schema, port, validation, devConfig) {
3085
3117
  },
3086
3118
  // Top bar
3087
3119
  topBarEnabled ? h('div', { className: 'cf-topbar fixed top-[28px] left-0 right-0 z-50 border-b border-gray-200/60' },
3120
+ // Announcement strip
3121
+ topBar?.announcement && (topBar.announcement.text || topBar.announcement.html)
3122
+ ? h('div', {
3123
+ className: 'cf-topbar-announcement text-center text-sm py-2 px-4 ' + (topBar.announcement.className || ''),
3124
+ style: {
3125
+ backgroundColor: topBar.announcement.bg_color || themeColor,
3126
+ color: topBar.announcement.text_color || '#ffffff',
3127
+ ...(topBar.announcement.style || {}),
3128
+ },
3129
+ ...(topBar.announcement.html ? { dangerouslySetInnerHTML: { __html: topBar.announcement.html } } : {}),
3130
+ }, topBar.announcement.html ? undefined : topBar.announcement.text)
3131
+ : null,
3132
+ // Nav row
3088
3133
  h('div', { className: 'relative flex items-center justify-center px-4 py-3 min-h-[48px]' },
3089
3134
  history.length > 0 ? h('button', {
3090
3135
  className: 'absolute left-3 top-1/2 -translate-y-1/2 w-9 h-9 flex items-center justify-center rounded-xl text-gray-400 hover:text-gray-700 hover:bg-gray-100/80 transition-all',
@@ -3094,8 +3139,18 @@ function buildPreviewHtml(schema, port, validation, devConfig) {
3094
3139
  h('path', { strokeLinecap: 'round', strokeLinejoin: 'round', d: 'M15.75 19.5L8.25 12l7.5-7.5' })
3095
3140
  )
3096
3141
  ) : null,
3097
- topBar?.title ? h('span', { className: 'text-sm font-medium text-gray-700' }, topBar.title) : null,
3098
- progressSteps ? h(Stepper, { steps: progressSteps, currentPageId, themeColor }) : null,
3142
+ topBar?.custom_html
3143
+ ? h('div', { dangerouslySetInnerHTML: { __html: topBar.custom_html } })
3144
+ : h(React.Fragment, null,
3145
+ topBar?.title ? h('span', { className: 'text-sm text-gray-700 ' + (
3146
+ topBar.title_weight === 'light' ? 'font-light' :
3147
+ topBar.title_weight === 'normal' ? 'font-normal' :
3148
+ topBar.title_weight === 'semibold' ? 'font-semibold' :
3149
+ topBar.title_weight === 'bold' ? 'font-bold' :
3150
+ 'font-medium'
3151
+ ) }, topBar.title) : null,
3152
+ progressSteps ? h(Stepper, { steps: progressSteps, currentPageId, themeColor }) : null,
3153
+ ),
3099
3154
  )
3100
3155
  ) : null,
3101
3156
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@officexapp/catalogs-cli",
3
- "version": "0.4.6",
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": {