payaza-storefront-layouts 1.0.49 → 1.0.50

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.
@@ -86,7 +86,7 @@ export function FoodHomePage({ storeConfig: initialConfig }) {
86
86
  console.log('[FoodHomePage] Sliders found:', layoutConfig?.sections?.hero?.sliders?.length || 0);
87
87
  }
88
88
  // Try new structure first (sections.hero.sliders)
89
- let heroSlides = [];
89
+ let heroSlides = [{ image: 'https://images.unsplash.com/photo-1546069901-ba9599a7e63c?q=80&w=2000&auto=format&fit=crop', title: 'Taste the', highlight: 'Extraordinary', description: 'Experience culinary excellence delivered straight to your doorstep.', primaryBtn: 'Order Now', primaryBtnLink: '/menu', secondaryBtn: 'View Menu', secondaryBtnLink: '/menu' }];
90
90
  if (layoutConfig?.sections?.hero?.sliders && Array.isArray(layoutConfig.sections.hero.sliders) && layoutConfig.sections.hero.sliders.length > 0) {
91
91
  if (process.env.NODE_ENV === 'development') {
92
92
  console.log('[FoodHomePage] Using sections.hero.sliders structure');
@@ -1 +1 @@
1
- {"version":3,"file":"LayoutPreview.d.ts","sourceRoot":"","sources":["../../src/preview/LayoutPreview.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoD,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAUjE,UAAU,kBAAkB;IAC1B,MAAM,EAAE,eAAe,GAAG,MAAM,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CAC7B;AA2HD,eAAO,MAAM,aAAa,gDAExB,CAAC"}
1
+ {"version":3,"file":"LayoutPreview.d.ts","sourceRoot":"","sources":["../../src/preview/LayoutPreview.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoD,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAUjE,UAAU,kBAAkB;IAC1B,MAAM,EAAE,eAAe,GAAG,MAAM,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CAC7B;AAuID,eAAO,MAAM,aAAa,gDAExB,CAAC"}
@@ -50,6 +50,18 @@ function LayoutPreviewWithRouter({ layout, className, initialRoute, onRouteChang
50
50
  setCurrentRoute(initialRoute.startsWith('/') ? initialRoute : `/${initialRoute}`);
51
51
  }
52
52
  }, []);
53
+ // CRITICAL: Update route when initialRoute prop changes (e.g., from UPDATE_ROUTE message)
54
+ // This ensures the preview updates when the editor switches pages
55
+ useEffect(() => {
56
+ if (!isClient)
57
+ return;
58
+ if (initialRoute) {
59
+ const normalizedRoute = initialRoute.startsWith('/') ? initialRoute : `/${initialRoute}`;
60
+ if (currentRoute !== normalizedRoute) {
61
+ setCurrentRoute(normalizedRoute);
62
+ }
63
+ }
64
+ }, [initialRoute, isClient, currentRoute]);
53
65
  // Single source of truth for URL changes
54
66
  useEffect(() => {
55
67
  if (!isClient)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payaza-storefront-layouts",
3
- "version": "1.0.49",
3
+ "version": "1.0.50",
4
4
  "type": "module",
5
5
  "description": "Shared layout components for StoreFront applications",
6
6
  "main": "dist/index.js",