payaza-storefront-layouts 1.0.0
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.
- package/README.md +108 -0
- package/dist/components/learning/CertificateTemplates.d.ts +25 -0
- package/dist/components/learning/CertificateTemplates.d.ts.map +1 -0
- package/dist/components/learning/CertificateTemplates.js +31 -0
- package/dist/components/learning/CertificateViewer.d.ts +11 -0
- package/dist/components/learning/CertificateViewer.d.ts.map +1 -0
- package/dist/components/learning/CertificateViewer.js +114 -0
- package/dist/components/learning/MentorshipProgress.d.ts +18 -0
- package/dist/components/learning/MentorshipProgress.d.ts.map +1 -0
- package/dist/components/learning/MentorshipProgress.js +19 -0
- package/dist/components/ui/address-selector.d.ts +11 -0
- package/dist/components/ui/address-selector.d.ts.map +1 -0
- package/dist/components/ui/address-selector.js +21 -0
- package/dist/components/ui/avatar-image.d.ts +11 -0
- package/dist/components/ui/avatar-image.d.ts.map +1 -0
- package/dist/components/ui/avatar-image.js +39 -0
- package/dist/components/ui/background-patterns.d.ts +27 -0
- package/dist/components/ui/background-patterns.d.ts.map +1 -0
- package/dist/components/ui/background-patterns.js +5 -0
- package/dist/components/ui/badge.d.ts +10 -0
- package/dist/components/ui/badge.d.ts.map +1 -0
- package/dist/components/ui/badge.js +20 -0
- package/dist/components/ui/breadcrumbs.d.ts +11 -0
- package/dist/components/ui/breadcrumbs.d.ts.map +1 -0
- package/dist/components/ui/breadcrumbs.js +8 -0
- package/dist/components/ui/button.d.ts +11 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.js +33 -0
- package/dist/components/ui/card.d.ts +10 -0
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/card.js +24 -0
- package/dist/components/ui/category-tree.d.ts +16 -0
- package/dist/components/ui/category-tree.d.ts.map +1 -0
- package/dist/components/ui/category-tree.js +74 -0
- package/dist/components/ui/checkout-button.d.ts +11 -0
- package/dist/components/ui/checkout-button.d.ts.map +1 -0
- package/dist/components/ui/checkout-button.js +174 -0
- package/dist/components/ui/guest-checkout-modal.d.ts +19 -0
- package/dist/components/ui/guest-checkout-modal.d.ts.map +1 -0
- package/dist/components/ui/guest-checkout-modal.js +92 -0
- package/dist/components/ui/image-skeleton.d.ts +7 -0
- package/dist/components/ui/image-skeleton.d.ts.map +1 -0
- package/dist/components/ui/image-skeleton.js +15 -0
- package/dist/components/ui/image-with-fallback.d.ts +9 -0
- package/dist/components/ui/image-with-fallback.d.ts.map +1 -0
- package/dist/components/ui/image-with-fallback.js +203 -0
- package/dist/components/ui/input.d.ts +6 -0
- package/dist/components/ui/input.d.ts.map +1 -0
- package/dist/components/ui/input.js +8 -0
- package/dist/components/ui/loading-skeleton-wrapper.d.ts +6 -0
- package/dist/components/ui/loading-skeleton-wrapper.d.ts.map +1 -0
- package/dist/components/ui/loading-skeleton-wrapper.js +10 -0
- package/dist/components/ui/modal.d.ts +11 -0
- package/dist/components/ui/modal.d.ts.map +1 -0
- package/dist/components/ui/modal.js +26 -0
- package/dist/components/ui/otp-input.d.ts +10 -0
- package/dist/components/ui/otp-input.d.ts.map +1 -0
- package/dist/components/ui/otp-input.js +57 -0
- package/dist/components/ui/out-of-stock-overlay.d.ts +8 -0
- package/dist/components/ui/out-of-stock-overlay.d.ts.map +1 -0
- package/dist/components/ui/out-of-stock-overlay.js +12 -0
- package/dist/components/ui/page-animate-wrapper.d.ts +7 -0
- package/dist/components/ui/page-animate-wrapper.d.ts.map +1 -0
- package/dist/components/ui/page-animate-wrapper.js +16 -0
- package/dist/components/ui/page-content-loader.d.ts +13 -0
- package/dist/components/ui/page-content-loader.d.ts.map +1 -0
- package/dist/components/ui/page-content-loader.js +12 -0
- package/dist/components/ui/page-loader.d.ts +20 -0
- package/dist/components/ui/page-loader.d.ts.map +1 -0
- package/dist/components/ui/page-loader.js +31 -0
- package/dist/components/ui/product-card.d.ts +11 -0
- package/dist/components/ui/product-card.d.ts.map +1 -0
- package/dist/components/ui/product-card.js +95 -0
- package/dist/components/ui/product-rating.d.ts +17 -0
- package/dist/components/ui/product-rating.d.ts.map +1 -0
- package/dist/components/ui/product-rating.js +54 -0
- package/dist/components/ui/review-form.d.ts +9 -0
- package/dist/components/ui/review-form.d.ts.map +1 -0
- package/dist/components/ui/review-form.js +28 -0
- package/dist/components/ui/route-skeleton-loader.d.ts +7 -0
- package/dist/components/ui/route-skeleton-loader.d.ts.map +1 -0
- package/dist/components/ui/route-skeleton-loader.js +75 -0
- package/dist/components/ui/sheet.d.ts +12 -0
- package/dist/components/ui/sheet.d.ts.map +1 -0
- package/dist/components/ui/sheet.js +29 -0
- package/dist/components/ui/skeleton.d.ts +3 -0
- package/dist/components/ui/skeleton.d.ts.map +1 -0
- package/dist/components/ui/skeleton.js +6 -0
- package/dist/components/ui/skeletons/category-grid-skeleton.d.ts +6 -0
- package/dist/components/ui/skeletons/category-grid-skeleton.d.ts.map +1 -0
- package/dist/components/ui/skeletons/category-grid-skeleton.js +16 -0
- package/dist/components/ui/skeletons/checkout-skeleton.d.ts +2 -0
- package/dist/components/ui/skeletons/checkout-skeleton.d.ts.map +1 -0
- package/dist/components/ui/skeletons/checkout-skeleton.js +4 -0
- package/dist/components/ui/skeletons/index.d.ts +6 -0
- package/dist/components/ui/skeletons/index.d.ts.map +1 -0
- package/dist/components/ui/skeletons/index.js +5 -0
- package/dist/components/ui/skeletons/page-skeleton.d.ts +2 -0
- package/dist/components/ui/skeletons/page-skeleton.d.ts.map +1 -0
- package/dist/components/ui/skeletons/page-skeleton.js +4 -0
- package/dist/components/ui/skeletons/product-card-skeleton.d.ts +2 -0
- package/dist/components/ui/skeletons/product-card-skeleton.d.ts.map +1 -0
- package/dist/components/ui/skeletons/product-card-skeleton.js +4 -0
- package/dist/components/ui/skeletons/product-detail-skeleton.d.ts +2 -0
- package/dist/components/ui/skeletons/product-detail-skeleton.d.ts.map +1 -0
- package/dist/components/ui/skeletons/product-detail-skeleton.js +4 -0
- package/dist/components/ui/skeletons/product-grid-skeleton.d.ts +7 -0
- package/dist/components/ui/skeletons/product-grid-skeleton.d.ts.map +1 -0
- package/dist/components/ui/skeletons/product-grid-skeleton.js +12 -0
- package/dist/components/ui/store-logos.d.ts +43 -0
- package/dist/components/ui/store-logos.d.ts.map +1 -0
- package/dist/components/ui/store-logos.js +83 -0
- package/dist/components/ui/toast.d.ts +19 -0
- package/dist/components/ui/toast.d.ts.map +1 -0
- package/dist/components/ui/toast.js +33 -0
- package/dist/components/ui/video-player.d.ts +48 -0
- package/dist/components/ui/video-player.d.ts.map +1 -0
- package/dist/components/ui/video-player.js +96 -0
- package/dist/hooks/use-analytics.d.ts +14 -0
- package/dist/hooks/use-analytics.d.ts.map +1 -0
- package/dist/hooks/use-analytics.js +66 -0
- package/dist/hooks/use-api.d.ts +17 -0
- package/dist/hooks/use-api.d.ts.map +1 -0
- package/dist/hooks/use-api.js +53 -0
- package/dist/hooks/use-cart-api.d.ts +17 -0
- package/dist/hooks/use-cart-api.d.ts.map +1 -0
- package/dist/hooks/use-cart-api.js +134 -0
- package/dist/hooks/use-content-ready.d.ts +17 -0
- package/dist/hooks/use-content-ready.d.ts.map +1 -0
- package/dist/hooks/use-content-ready.js +197 -0
- package/dist/hooks/use-navigation-loading.d.ts +4 -0
- package/dist/hooks/use-navigation-loading.d.ts.map +1 -0
- package/dist/hooks/use-navigation-loading.js +14 -0
- package/dist/hooks/use-payaza-checkout.d.ts +14 -0
- package/dist/hooks/use-payaza-checkout.d.ts.map +1 -0
- package/dist/hooks/use-payaza-checkout.js +56 -0
- package/dist/hooks/use-products-api.d.ts +19 -0
- package/dist/hooks/use-products-api.d.ts.map +1 -0
- package/dist/hooks/use-products-api.js +84 -0
- package/dist/hooks/use-store-api.d.ts +12 -0
- package/dist/hooks/use-store-api.d.ts.map +1 -0
- package/dist/hooks/use-store-api.js +73 -0
- package/dist/index.d.ts +116 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +126 -0
- package/dist/json/booking-agenda.json +18 -0
- package/dist/json/booking.json +71 -0
- package/dist/json/clothing-minimal.json +26 -0
- package/dist/json/clothing.json +169 -0
- package/dist/json/electronics-grid.json +18 -0
- package/dist/json/electronics.json +50 -0
- package/dist/json/food-modern.json +38 -0
- package/dist/json/food.json +85 -0
- package/dist/json/json-map.d.ts +7 -0
- package/dist/json/json-map.d.ts.map +1 -0
- package/dist/json/json-map.js +36 -0
- package/dist/json/motivational-speaker.json +96 -0
- package/dist/layouts/booking/components/BookingHomePage.d.ts +7 -0
- package/dist/layouts/booking/components/BookingHomePage.d.ts.map +1 -0
- package/dist/layouts/booking/components/BookingHomePage.js +49 -0
- package/dist/layouts/booking/index.d.ts +9 -0
- package/dist/layouts/booking/index.d.ts.map +1 -0
- package/dist/layouts/booking/index.js +9 -0
- package/dist/layouts/booking/pages/AboutPage.d.ts +7 -0
- package/dist/layouts/booking/pages/AboutPage.d.ts.map +1 -0
- package/dist/layouts/booking/pages/AboutPage.js +45 -0
- package/dist/layouts/booking/pages/BookPage.d.ts +8 -0
- package/dist/layouts/booking/pages/BookPage.d.ts.map +1 -0
- package/dist/layouts/booking/pages/BookPage.js +441 -0
- package/dist/layouts/booking/pages/CategoriesPage.d.ts +7 -0
- package/dist/layouts/booking/pages/CategoriesPage.d.ts.map +1 -0
- package/dist/layouts/booking/pages/CategoriesPage.js +162 -0
- package/dist/layouts/booking/pages/CategoryPage.d.ts +8 -0
- package/dist/layouts/booking/pages/CategoryPage.d.ts.map +1 -0
- package/dist/layouts/booking/pages/CategoryPage.js +67 -0
- package/dist/layouts/booking/pages/ContactPage.d.ts +7 -0
- package/dist/layouts/booking/pages/ContactPage.d.ts.map +1 -0
- package/dist/layouts/booking/pages/ContactPage.js +20 -0
- package/dist/layouts/booking/pages/ProductDetailPage.d.ts +8 -0
- package/dist/layouts/booking/pages/ProductDetailPage.d.ts.map +1 -0
- package/dist/layouts/booking/pages/ProductDetailPage.js +502 -0
- package/dist/layouts/booking/pages/ServicesPage.d.ts +9 -0
- package/dist/layouts/booking/pages/ServicesPage.d.ts.map +1 -0
- package/dist/layouts/booking/pages/ServicesPage.js +31 -0
- package/dist/layouts/booking-agenda/components/BookingHomePageAgenda.d.ts +7 -0
- package/dist/layouts/booking-agenda/components/BookingHomePageAgenda.d.ts.map +1 -0
- package/dist/layouts/booking-agenda/components/BookingHomePageAgenda.js +186 -0
- package/dist/layouts/booking-agenda/index.d.ts +9 -0
- package/dist/layouts/booking-agenda/index.d.ts.map +1 -0
- package/dist/layouts/booking-agenda/index.js +9 -0
- package/dist/layouts/booking-agenda/pages/AboutPage.d.ts +7 -0
- package/dist/layouts/booking-agenda/pages/AboutPage.d.ts.map +1 -0
- package/dist/layouts/booking-agenda/pages/AboutPage.js +45 -0
- package/dist/layouts/booking-agenda/pages/BookPage.d.ts +8 -0
- package/dist/layouts/booking-agenda/pages/BookPage.d.ts.map +1 -0
- package/dist/layouts/booking-agenda/pages/BookPage.js +441 -0
- package/dist/layouts/booking-agenda/pages/CategoriesPage.d.ts +7 -0
- package/dist/layouts/booking-agenda/pages/CategoriesPage.d.ts.map +1 -0
- package/dist/layouts/booking-agenda/pages/CategoriesPage.js +162 -0
- package/dist/layouts/booking-agenda/pages/CategoryPage.d.ts +8 -0
- package/dist/layouts/booking-agenda/pages/CategoryPage.d.ts.map +1 -0
- package/dist/layouts/booking-agenda/pages/CategoryPage.js +67 -0
- package/dist/layouts/booking-agenda/pages/ContactPage.d.ts +7 -0
- package/dist/layouts/booking-agenda/pages/ContactPage.d.ts.map +1 -0
- package/dist/layouts/booking-agenda/pages/ContactPage.js +20 -0
- package/dist/layouts/booking-agenda/pages/ProductDetailPage.d.ts +8 -0
- package/dist/layouts/booking-agenda/pages/ProductDetailPage.d.ts.map +1 -0
- package/dist/layouts/booking-agenda/pages/ProductDetailPage.js +502 -0
- package/dist/layouts/booking-agenda/pages/ServicesPage.d.ts +9 -0
- package/dist/layouts/booking-agenda/pages/ServicesPage.d.ts.map +1 -0
- package/dist/layouts/booking-agenda/pages/ServicesPage.js +31 -0
- package/dist/layouts/clothing/components/ClothingHomePage.d.ts +7 -0
- package/dist/layouts/clothing/components/ClothingHomePage.d.ts.map +1 -0
- package/dist/layouts/clothing/components/ClothingHomePage.js +295 -0
- package/dist/layouts/clothing/index.d.ts +8 -0
- package/dist/layouts/clothing/index.d.ts.map +1 -0
- package/dist/layouts/clothing/index.js +8 -0
- package/dist/layouts/clothing/pages/AboutPage.d.ts +7 -0
- package/dist/layouts/clothing/pages/AboutPage.d.ts.map +1 -0
- package/dist/layouts/clothing/pages/AboutPage.js +45 -0
- package/dist/layouts/clothing/pages/CategoriesPage.d.ts +7 -0
- package/dist/layouts/clothing/pages/CategoriesPage.d.ts.map +1 -0
- package/dist/layouts/clothing/pages/CategoriesPage.js +162 -0
- package/dist/layouts/clothing/pages/CategoryPage.d.ts +8 -0
- package/dist/layouts/clothing/pages/CategoryPage.d.ts.map +1 -0
- package/dist/layouts/clothing/pages/CategoryPage.js +67 -0
- package/dist/layouts/clothing/pages/ContactPage.d.ts +7 -0
- package/dist/layouts/clothing/pages/ContactPage.d.ts.map +1 -0
- package/dist/layouts/clothing/pages/ContactPage.js +20 -0
- package/dist/layouts/clothing/pages/ProductDetailPage.d.ts +8 -0
- package/dist/layouts/clothing/pages/ProductDetailPage.d.ts.map +1 -0
- package/dist/layouts/clothing/pages/ProductDetailPage.js +502 -0
- package/dist/layouts/clothing/pages/ProductsPage.d.ts +7 -0
- package/dist/layouts/clothing/pages/ProductsPage.d.ts.map +1 -0
- package/dist/layouts/clothing/pages/ProductsPage.js +297 -0
- package/dist/layouts/clothing-minimal/components/ClothingHomePageMinimal.d.ts +7 -0
- package/dist/layouts/clothing-minimal/components/ClothingHomePageMinimal.d.ts.map +1 -0
- package/dist/layouts/clothing-minimal/components/ClothingHomePageMinimal.js +48 -0
- package/dist/layouts/clothing-minimal/index.d.ts +8 -0
- package/dist/layouts/clothing-minimal/index.d.ts.map +1 -0
- package/dist/layouts/clothing-minimal/index.js +8 -0
- package/dist/layouts/clothing-minimal/pages/AboutPage.d.ts +7 -0
- package/dist/layouts/clothing-minimal/pages/AboutPage.d.ts.map +1 -0
- package/dist/layouts/clothing-minimal/pages/AboutPage.js +45 -0
- package/dist/layouts/clothing-minimal/pages/CategoriesPage.d.ts +7 -0
- package/dist/layouts/clothing-minimal/pages/CategoriesPage.d.ts.map +1 -0
- package/dist/layouts/clothing-minimal/pages/CategoriesPage.js +162 -0
- package/dist/layouts/clothing-minimal/pages/CategoryPage.d.ts +8 -0
- package/dist/layouts/clothing-minimal/pages/CategoryPage.d.ts.map +1 -0
- package/dist/layouts/clothing-minimal/pages/CategoryPage.js +67 -0
- package/dist/layouts/clothing-minimal/pages/ContactPage.d.ts +7 -0
- package/dist/layouts/clothing-minimal/pages/ContactPage.d.ts.map +1 -0
- package/dist/layouts/clothing-minimal/pages/ContactPage.js +20 -0
- package/dist/layouts/clothing-minimal/pages/ProductDetailPage.d.ts +8 -0
- package/dist/layouts/clothing-minimal/pages/ProductDetailPage.d.ts.map +1 -0
- package/dist/layouts/clothing-minimal/pages/ProductDetailPage.js +502 -0
- package/dist/layouts/clothing-minimal/pages/ProductsPage.d.ts +7 -0
- package/dist/layouts/clothing-minimal/pages/ProductsPage.d.ts.map +1 -0
- package/dist/layouts/clothing-minimal/pages/ProductsPage.js +297 -0
- package/dist/layouts/electronics/components/ElectronicsCategoriesPage.d.ts +7 -0
- package/dist/layouts/electronics/components/ElectronicsCategoriesPage.d.ts.map +1 -0
- package/dist/layouts/electronics/components/ElectronicsCategoriesPage.js +34 -0
- package/dist/layouts/electronics/components/ElectronicsGridProductCard.d.ts +10 -0
- package/dist/layouts/electronics/components/ElectronicsGridProductCard.d.ts.map +1 -0
- package/dist/layouts/electronics/components/ElectronicsGridProductCard.js +107 -0
- package/dist/layouts/electronics/components/ElectronicsHomePage.d.ts +7 -0
- package/dist/layouts/electronics/components/ElectronicsHomePage.d.ts.map +1 -0
- package/dist/layouts/electronics/components/ElectronicsHomePage.js +78 -0
- package/dist/layouts/electronics/components/ElectronicsPageWrapper.d.ts +8 -0
- package/dist/layouts/electronics/components/ElectronicsPageWrapper.d.ts.map +1 -0
- package/dist/layouts/electronics/components/ElectronicsPageWrapper.js +10 -0
- package/dist/layouts/electronics/components/ElectronicsProductsPage.d.ts +7 -0
- package/dist/layouts/electronics/components/ElectronicsProductsPage.d.ts.map +1 -0
- package/dist/layouts/electronics/components/ElectronicsProductsPage.js +100 -0
- package/dist/layouts/electronics/components/ElectronicsStoreFooter.d.ts +7 -0
- package/dist/layouts/electronics/components/ElectronicsStoreFooter.d.ts.map +1 -0
- package/dist/layouts/electronics/components/ElectronicsStoreFooter.js +10 -0
- package/dist/layouts/electronics/components/ElectronicsStoreHeader.d.ts +7 -0
- package/dist/layouts/electronics/components/ElectronicsStoreHeader.d.ts.map +1 -0
- package/dist/layouts/electronics/components/ElectronicsStoreHeader.js +27 -0
- package/dist/layouts/electronics/index.d.ts +19 -0
- package/dist/layouts/electronics/index.d.ts.map +1 -0
- package/dist/layouts/electronics/index.js +19 -0
- package/dist/layouts/electronics/pages/AboutPage.d.ts +7 -0
- package/dist/layouts/electronics/pages/AboutPage.d.ts.map +1 -0
- package/dist/layouts/electronics/pages/AboutPage.js +45 -0
- package/dist/layouts/electronics/pages/CategoriesPage.d.ts +7 -0
- package/dist/layouts/electronics/pages/CategoriesPage.d.ts.map +1 -0
- package/dist/layouts/electronics/pages/CategoriesPage.js +6 -0
- package/dist/layouts/electronics/pages/CategoryPage.d.ts +8 -0
- package/dist/layouts/electronics/pages/CategoryPage.d.ts.map +1 -0
- package/dist/layouts/electronics/pages/CategoryPage.js +67 -0
- package/dist/layouts/electronics/pages/ContactPage.d.ts +7 -0
- package/dist/layouts/electronics/pages/ContactPage.d.ts.map +1 -0
- package/dist/layouts/electronics/pages/ContactPage.js +20 -0
- package/dist/layouts/electronics/pages/HelpCenterPage.d.ts +7 -0
- package/dist/layouts/electronics/pages/HelpCenterPage.d.ts.map +1 -0
- package/dist/layouts/electronics/pages/HelpCenterPage.js +55 -0
- package/dist/layouts/electronics/pages/PrivacyPolicyPage.d.ts +7 -0
- package/dist/layouts/electronics/pages/PrivacyPolicyPage.d.ts.map +1 -0
- package/dist/layouts/electronics/pages/PrivacyPolicyPage.js +8 -0
- package/dist/layouts/electronics/pages/ProductDetailPage.d.ts +8 -0
- package/dist/layouts/electronics/pages/ProductDetailPage.d.ts.map +1 -0
- package/dist/layouts/electronics/pages/ProductDetailPage.js +502 -0
- package/dist/layouts/electronics/pages/ProductsPage.d.ts +7 -0
- package/dist/layouts/electronics/pages/ProductsPage.d.ts.map +1 -0
- package/dist/layouts/electronics/pages/ProductsPage.js +297 -0
- package/dist/layouts/electronics/pages/ShippingReturnsPage.d.ts +7 -0
- package/dist/layouts/electronics/pages/ShippingReturnsPage.d.ts.map +1 -0
- package/dist/layouts/electronics/pages/ShippingReturnsPage.js +7 -0
- package/dist/layouts/electronics/pages/TermsPage.d.ts +7 -0
- package/dist/layouts/electronics/pages/TermsPage.d.ts.map +1 -0
- package/dist/layouts/electronics/pages/TermsPage.js +8 -0
- package/dist/layouts/electronics/pages/TrackOrderPage.d.ts +7 -0
- package/dist/layouts/electronics/pages/TrackOrderPage.d.ts.map +1 -0
- package/dist/layouts/electronics/pages/TrackOrderPage.js +371 -0
- package/dist/layouts/electronics-grid/components/ElectronicsGridProductCard.d.ts +10 -0
- package/dist/layouts/electronics-grid/components/ElectronicsGridProductCard.d.ts.map +1 -0
- package/dist/layouts/electronics-grid/components/ElectronicsGridProductCard.js +107 -0
- package/dist/layouts/electronics-grid/components/ElectronicsHomePageGrid.d.ts +7 -0
- package/dist/layouts/electronics-grid/components/ElectronicsHomePageGrid.d.ts.map +1 -0
- package/dist/layouts/electronics-grid/components/ElectronicsHomePageGrid.js +89 -0
- package/dist/layouts/electronics-grid/index.d.ts +15 -0
- package/dist/layouts/electronics-grid/index.d.ts.map +1 -0
- package/dist/layouts/electronics-grid/index.js +15 -0
- package/dist/layouts/electronics-grid/pages/AboutPage.d.ts +7 -0
- package/dist/layouts/electronics-grid/pages/AboutPage.d.ts.map +1 -0
- package/dist/layouts/electronics-grid/pages/AboutPage.js +45 -0
- package/dist/layouts/electronics-grid/pages/CategoriesPage.d.ts +7 -0
- package/dist/layouts/electronics-grid/pages/CategoriesPage.d.ts.map +1 -0
- package/dist/layouts/electronics-grid/pages/CategoriesPage.js +6 -0
- package/dist/layouts/electronics-grid/pages/CategoryPage.d.ts +8 -0
- package/dist/layouts/electronics-grid/pages/CategoryPage.d.ts.map +1 -0
- package/dist/layouts/electronics-grid/pages/CategoryPage.js +67 -0
- package/dist/layouts/electronics-grid/pages/ContactPage.d.ts +7 -0
- package/dist/layouts/electronics-grid/pages/ContactPage.d.ts.map +1 -0
- package/dist/layouts/electronics-grid/pages/ContactPage.js +20 -0
- package/dist/layouts/electronics-grid/pages/ElectronicsGridCategoriesPage.d.ts +7 -0
- package/dist/layouts/electronics-grid/pages/ElectronicsGridCategoriesPage.d.ts.map +1 -0
- package/dist/layouts/electronics-grid/pages/ElectronicsGridCategoriesPage.js +15 -0
- package/dist/layouts/electronics-grid/pages/HelpCenterPage.d.ts +7 -0
- package/dist/layouts/electronics-grid/pages/HelpCenterPage.d.ts.map +1 -0
- package/dist/layouts/electronics-grid/pages/HelpCenterPage.js +55 -0
- package/dist/layouts/electronics-grid/pages/PrivacyPolicyPage.d.ts +7 -0
- package/dist/layouts/electronics-grid/pages/PrivacyPolicyPage.d.ts.map +1 -0
- package/dist/layouts/electronics-grid/pages/PrivacyPolicyPage.js +8 -0
- package/dist/layouts/electronics-grid/pages/ProductDetailPage.d.ts +8 -0
- package/dist/layouts/electronics-grid/pages/ProductDetailPage.d.ts.map +1 -0
- package/dist/layouts/electronics-grid/pages/ProductDetailPage.js +502 -0
- package/dist/layouts/electronics-grid/pages/ProductsPage.d.ts +7 -0
- package/dist/layouts/electronics-grid/pages/ProductsPage.d.ts.map +1 -0
- package/dist/layouts/electronics-grid/pages/ProductsPage.js +297 -0
- package/dist/layouts/electronics-grid/pages/ShippingReturnsPage.d.ts +7 -0
- package/dist/layouts/electronics-grid/pages/ShippingReturnsPage.d.ts.map +1 -0
- package/dist/layouts/electronics-grid/pages/ShippingReturnsPage.js +7 -0
- package/dist/layouts/electronics-grid/pages/TermsPage.d.ts +7 -0
- package/dist/layouts/electronics-grid/pages/TermsPage.d.ts.map +1 -0
- package/dist/layouts/electronics-grid/pages/TermsPage.js +8 -0
- package/dist/layouts/electronics-grid/pages/TrackOrderPage.d.ts +7 -0
- package/dist/layouts/electronics-grid/pages/TrackOrderPage.d.ts.map +1 -0
- package/dist/layouts/electronics-grid/pages/TrackOrderPage.js +371 -0
- package/dist/layouts/food/components/FoodHomePage.d.ts +7 -0
- package/dist/layouts/food/components/FoodHomePage.d.ts.map +1 -0
- package/dist/layouts/food/components/FoodHomePage.js +304 -0
- package/dist/layouts/food/index.d.ts +9 -0
- package/dist/layouts/food/index.d.ts.map +1 -0
- package/dist/layouts/food/index.js +9 -0
- package/dist/layouts/food/pages/AboutPage.d.ts +7 -0
- package/dist/layouts/food/pages/AboutPage.d.ts.map +1 -0
- package/dist/layouts/food/pages/AboutPage.js +45 -0
- package/dist/layouts/food/pages/CategoriesPage.d.ts +7 -0
- package/dist/layouts/food/pages/CategoriesPage.d.ts.map +1 -0
- package/dist/layouts/food/pages/CategoriesPage.js +162 -0
- package/dist/layouts/food/pages/CategoryPage.d.ts +8 -0
- package/dist/layouts/food/pages/CategoryPage.d.ts.map +1 -0
- package/dist/layouts/food/pages/CategoryPage.js +67 -0
- package/dist/layouts/food/pages/ContactPage.d.ts +7 -0
- package/dist/layouts/food/pages/ContactPage.d.ts.map +1 -0
- package/dist/layouts/food/pages/ContactPage.js +20 -0
- package/dist/layouts/food/pages/MenuPage.d.ts +8 -0
- package/dist/layouts/food/pages/MenuPage.d.ts.map +1 -0
- package/dist/layouts/food/pages/MenuPage.js +75 -0
- package/dist/layouts/food/pages/ProductDetailPage.d.ts +8 -0
- package/dist/layouts/food/pages/ProductDetailPage.d.ts.map +1 -0
- package/dist/layouts/food/pages/ProductDetailPage.js +502 -0
- package/dist/layouts/food/pages/ProductsPage.d.ts +7 -0
- package/dist/layouts/food/pages/ProductsPage.d.ts.map +1 -0
- package/dist/layouts/food/pages/ProductsPage.js +297 -0
- package/dist/layouts/food-modern/components/FoodHomePageModern.d.ts +7 -0
- package/dist/layouts/food-modern/components/FoodHomePageModern.d.ts.map +1 -0
- package/dist/layouts/food-modern/components/FoodHomePageModern.js +118 -0
- package/dist/layouts/food-modern/index.d.ts +9 -0
- package/dist/layouts/food-modern/index.d.ts.map +1 -0
- package/dist/layouts/food-modern/index.js +9 -0
- package/dist/layouts/food-modern/pages/AboutPage.d.ts +7 -0
- package/dist/layouts/food-modern/pages/AboutPage.d.ts.map +1 -0
- package/dist/layouts/food-modern/pages/AboutPage.js +45 -0
- package/dist/layouts/food-modern/pages/CategoriesPage.d.ts +7 -0
- package/dist/layouts/food-modern/pages/CategoriesPage.d.ts.map +1 -0
- package/dist/layouts/food-modern/pages/CategoriesPage.js +162 -0
- package/dist/layouts/food-modern/pages/CategoryPage.d.ts +8 -0
- package/dist/layouts/food-modern/pages/CategoryPage.d.ts.map +1 -0
- package/dist/layouts/food-modern/pages/CategoryPage.js +67 -0
- package/dist/layouts/food-modern/pages/ContactPage.d.ts +7 -0
- package/dist/layouts/food-modern/pages/ContactPage.d.ts.map +1 -0
- package/dist/layouts/food-modern/pages/ContactPage.js +20 -0
- package/dist/layouts/food-modern/pages/MenuPage.d.ts +8 -0
- package/dist/layouts/food-modern/pages/MenuPage.d.ts.map +1 -0
- package/dist/layouts/food-modern/pages/MenuPage.js +75 -0
- package/dist/layouts/food-modern/pages/ProductDetailPage.d.ts +8 -0
- package/dist/layouts/food-modern/pages/ProductDetailPage.d.ts.map +1 -0
- package/dist/layouts/food-modern/pages/ProductDetailPage.js +502 -0
- package/dist/layouts/food-modern/pages/ProductsPage.d.ts +7 -0
- package/dist/layouts/food-modern/pages/ProductsPage.d.ts.map +1 -0
- package/dist/layouts/food-modern/pages/ProductsPage.js +297 -0
- package/dist/layouts/motivational-speaker/components/MotivationalHomePage.d.ts +7 -0
- package/dist/layouts/motivational-speaker/components/MotivationalHomePage.d.ts.map +1 -0
- package/dist/layouts/motivational-speaker/components/MotivationalHomePage.js +115 -0
- package/dist/layouts/motivational-speaker/components/MotivationalPageWrapper.d.ts +8 -0
- package/dist/layouts/motivational-speaker/components/MotivationalPageWrapper.d.ts.map +1 -0
- package/dist/layouts/motivational-speaker/components/MotivationalPageWrapper.js +10 -0
- package/dist/layouts/motivational-speaker/index.d.ts +10 -0
- package/dist/layouts/motivational-speaker/index.d.ts.map +1 -0
- package/dist/layouts/motivational-speaker/index.js +10 -0
- package/dist/layouts/motivational-speaker/pages/AboutPage.d.ts +7 -0
- package/dist/layouts/motivational-speaker/pages/AboutPage.d.ts.map +1 -0
- package/dist/layouts/motivational-speaker/pages/AboutPage.js +45 -0
- package/dist/layouts/motivational-speaker/pages/CategoryPage.d.ts +8 -0
- package/dist/layouts/motivational-speaker/pages/CategoryPage.d.ts.map +1 -0
- package/dist/layouts/motivational-speaker/pages/CategoryPage.js +67 -0
- package/dist/layouts/motivational-speaker/pages/ContactPage.d.ts +7 -0
- package/dist/layouts/motivational-speaker/pages/ContactPage.d.ts.map +1 -0
- package/dist/layouts/motivational-speaker/pages/ContactPage.js +20 -0
- package/dist/layouts/motivational-speaker/pages/ProductsPage.d.ts +7 -0
- package/dist/layouts/motivational-speaker/pages/ProductsPage.d.ts.map +1 -0
- package/dist/layouts/motivational-speaker/pages/ProductsPage.js +297 -0
- package/dist/layouts/motivational-speaker/pages/ServiceDetailPage.d.ts +8 -0
- package/dist/layouts/motivational-speaker/pages/ServiceDetailPage.d.ts.map +1 -0
- package/dist/layouts/motivational-speaker/pages/ServiceDetailPage.js +144 -0
- package/dist/layouts/motivational-speaker/pages/ServicesPage.d.ts +9 -0
- package/dist/layouts/motivational-speaker/pages/ServicesPage.d.ts.map +1 -0
- package/dist/layouts/motivational-speaker/pages/ServicesPage.js +31 -0
- package/dist/layouts/motivational-speaker/pages/SubscriptionPage.d.ts +7 -0
- package/dist/layouts/motivational-speaker/pages/SubscriptionPage.d.ts.map +1 -0
- package/dist/layouts/motivational-speaker/pages/SubscriptionPage.js +136 -0
- package/dist/layouts/shared/components/BaseStoreLayout.d.ts +8 -0
- package/dist/layouts/shared/components/BaseStoreLayout.d.ts.map +1 -0
- package/dist/layouts/shared/components/BaseStoreLayout.js +59 -0
- package/dist/layouts/shared/components/GenericPageWrapper.d.ts +8 -0
- package/dist/layouts/shared/components/GenericPageWrapper.d.ts.map +1 -0
- package/dist/layouts/shared/components/GenericPageWrapper.js +19 -0
- package/dist/layouts/shared/components/PromoBanner.d.ts +9 -0
- package/dist/layouts/shared/components/PromoBanner.d.ts.map +1 -0
- package/dist/layouts/shared/components/PromoBanner.js +14 -0
- package/dist/layouts/shared/components/StoreFooter.d.ts +7 -0
- package/dist/layouts/shared/components/StoreFooter.d.ts.map +1 -0
- package/dist/layouts/shared/components/StoreFooter.js +147 -0
- package/dist/layouts/shared/components/StoreHeader.d.ts +8 -0
- package/dist/layouts/shared/components/StoreHeader.d.ts.map +1 -0
- package/dist/layouts/shared/components/StoreHeader.js +87 -0
- package/dist/layouts/shared/components/TestimonialCard.d.ts +8 -0
- package/dist/layouts/shared/components/TestimonialCard.d.ts.map +1 -0
- package/dist/layouts/shared/components/TestimonialCard.js +10 -0
- package/dist/layouts/shared/index.d.ts +23 -0
- package/dist/layouts/shared/index.d.ts.map +1 -0
- package/dist/layouts/shared/index.js +23 -0
- package/dist/layouts/shared/pages/AccountPage.d.ts +7 -0
- package/dist/layouts/shared/pages/AccountPage.d.ts.map +1 -0
- package/dist/layouts/shared/pages/AccountPage.js +605 -0
- package/dist/layouts/shared/pages/CartPage.d.ts +7 -0
- package/dist/layouts/shared/pages/CartPage.d.ts.map +1 -0
- package/dist/layouts/shared/pages/CartPage.js +83 -0
- package/dist/layouts/shared/pages/CheckoutPage.d.ts +7 -0
- package/dist/layouts/shared/pages/CheckoutPage.d.ts.map +1 -0
- package/dist/layouts/shared/pages/CheckoutPage.js +860 -0
- package/dist/layouts/shared/pages/CookiePolicyPage.d.ts +7 -0
- package/dist/layouts/shared/pages/CookiePolicyPage.d.ts.map +1 -0
- package/dist/layouts/shared/pages/CookiePolicyPage.js +8 -0
- package/dist/layouts/shared/pages/FeatureDisabledPage.d.ts +9 -0
- package/dist/layouts/shared/pages/FeatureDisabledPage.d.ts.map +1 -0
- package/dist/layouts/shared/pages/FeatureDisabledPage.js +8 -0
- package/dist/layouts/shared/pages/HelpCenterPage.d.ts +7 -0
- package/dist/layouts/shared/pages/HelpCenterPage.d.ts.map +1 -0
- package/dist/layouts/shared/pages/HelpCenterPage.js +55 -0
- package/dist/layouts/shared/pages/MaintenancePage.d.ts +7 -0
- package/dist/layouts/shared/pages/MaintenancePage.d.ts.map +1 -0
- package/dist/layouts/shared/pages/MaintenancePage.js +44 -0
- package/dist/layouts/shared/pages/PortfolioPage.d.ts +7 -0
- package/dist/layouts/shared/pages/PortfolioPage.d.ts.map +1 -0
- package/dist/layouts/shared/pages/PortfolioPage.js +130 -0
- package/dist/layouts/shared/pages/PrivacyPolicyPage.d.ts +7 -0
- package/dist/layouts/shared/pages/PrivacyPolicyPage.d.ts.map +1 -0
- package/dist/layouts/shared/pages/PrivacyPolicyPage.js +8 -0
- package/dist/layouts/shared/pages/ShippingReturnsPage.d.ts +7 -0
- package/dist/layouts/shared/pages/ShippingReturnsPage.d.ts.map +1 -0
- package/dist/layouts/shared/pages/ShippingReturnsPage.js +7 -0
- package/dist/layouts/shared/pages/SizeGuidePage.d.ts +7 -0
- package/dist/layouts/shared/pages/SizeGuidePage.d.ts.map +1 -0
- package/dist/layouts/shared/pages/SizeGuidePage.js +10 -0
- package/dist/layouts/shared/pages/StyleGuidePage.d.ts +7 -0
- package/dist/layouts/shared/pages/StyleGuidePage.d.ts.map +1 -0
- package/dist/layouts/shared/pages/StyleGuidePage.js +126 -0
- package/dist/layouts/shared/pages/TeamPage.d.ts +7 -0
- package/dist/layouts/shared/pages/TeamPage.d.ts.map +1 -0
- package/dist/layouts/shared/pages/TeamPage.js +39 -0
- package/dist/layouts/shared/pages/TermsPage.d.ts +7 -0
- package/dist/layouts/shared/pages/TermsPage.d.ts.map +1 -0
- package/dist/layouts/shared/pages/TermsPage.js +8 -0
- package/dist/layouts/shared/pages/TrackOrderPage.d.ts +7 -0
- package/dist/layouts/shared/pages/TrackOrderPage.d.ts.map +1 -0
- package/dist/layouts/shared/pages/TrackOrderPage.js +371 -0
- package/dist/layouts/shared/pages/WishlistPage.d.ts +7 -0
- package/dist/layouts/shared/pages/WishlistPage.d.ts.map +1 -0
- package/dist/layouts/shared/pages/WishlistPage.js +162 -0
- package/dist/lib/api.d.ts +8 -0
- package/dist/lib/api.d.ts.map +1 -0
- package/dist/lib/api.js +109 -0
- package/dist/lib/auth-context.d.ts +30 -0
- package/dist/lib/auth-context.d.ts.map +1 -0
- package/dist/lib/auth-context.js +207 -0
- package/dist/lib/content-selectors.d.ts +21 -0
- package/dist/lib/content-selectors.d.ts.map +1 -0
- package/dist/lib/content-selectors.js +75 -0
- package/dist/lib/countries.d.ts +11 -0
- package/dist/lib/countries.d.ts.map +1 -0
- package/dist/lib/countries.js +252 -0
- package/dist/lib/currency-symbols.d.ts +36 -0
- package/dist/lib/currency-symbols.d.ts.map +1 -0
- package/dist/lib/currency-symbols.js +153 -0
- package/dist/lib/guest-user.d.ts +27 -0
- package/dist/lib/guest-user.d.ts.map +1 -0
- package/dist/lib/guest-user.js +71 -0
- package/dist/lib/loading-context.d.ts +19 -0
- package/dist/lib/loading-context.d.ts.map +1 -0
- package/dist/lib/loading-context.js +197 -0
- package/dist/lib/mock-stores.d.ts +22 -0
- package/dist/lib/mock-stores.d.ts.map +1 -0
- package/dist/lib/mock-stores.js +2099 -0
- package/dist/lib/payaza-checkout.d.ts +167 -0
- package/dist/lib/payaza-checkout.d.ts.map +1 -0
- package/dist/lib/payaza-checkout.js +455 -0
- package/dist/lib/services/analytics.service.d.ts +58 -0
- package/dist/lib/services/analytics.service.d.ts.map +1 -0
- package/dist/lib/services/analytics.service.js +182 -0
- package/dist/lib/services/auth.service.d.ts +63 -0
- package/dist/lib/services/auth.service.d.ts.map +1 -0
- package/dist/lib/services/auth.service.js +101 -0
- package/dist/lib/services/booking.service.d.ts +53 -0
- package/dist/lib/services/booking.service.d.ts.map +1 -0
- package/dist/lib/services/booking.service.js +52 -0
- package/dist/lib/services/cart.service.d.ts +37 -0
- package/dist/lib/services/cart.service.d.ts.map +1 -0
- package/dist/lib/services/cart.service.js +55 -0
- package/dist/lib/services/category.service.d.ts +21 -0
- package/dist/lib/services/category.service.d.ts.map +1 -0
- package/dist/lib/services/category.service.js +41 -0
- package/dist/lib/services/checkout.service.d.ts +79 -0
- package/dist/lib/services/checkout.service.d.ts.map +1 -0
- package/dist/lib/services/checkout.service.js +37 -0
- package/dist/lib/services/customer.service.d.ts +52 -0
- package/dist/lib/services/customer.service.d.ts.map +1 -0
- package/dist/lib/services/customer.service.js +64 -0
- package/dist/lib/services/fees.service.d.ts +23 -0
- package/dist/lib/services/fees.service.d.ts.map +1 -0
- package/dist/lib/services/fees.service.js +13 -0
- package/dist/lib/services/index.d.ts +19 -0
- package/dist/lib/services/index.d.ts.map +1 -0
- package/dist/lib/services/index.js +18 -0
- package/dist/lib/services/order.service.d.ts +107 -0
- package/dist/lib/services/order.service.d.ts.map +1 -0
- package/dist/lib/services/order.service.js +82 -0
- package/dist/lib/services/payment.service.d.ts +51 -0
- package/dist/lib/services/payment.service.d.ts.map +1 -0
- package/dist/lib/services/payment.service.js +105 -0
- package/dist/lib/services/product.service.d.ts +90 -0
- package/dist/lib/services/product.service.d.ts.map +1 -0
- package/dist/lib/services/product.service.js +86 -0
- package/dist/lib/services/promo.service.d.ts +31 -0
- package/dist/lib/services/promo.service.d.ts.map +1 -0
- package/dist/lib/services/promo.service.js +29 -0
- package/dist/lib/services/review.service.d.ts +47 -0
- package/dist/lib/services/review.service.d.ts.map +1 -0
- package/dist/lib/services/review.service.js +54 -0
- package/dist/lib/services/service.service.d.ts +55 -0
- package/dist/lib/services/service.service.d.ts.map +1 -0
- package/dist/lib/services/service.service.js +37 -0
- package/dist/lib/services/shipping.service.d.ts +44 -0
- package/dist/lib/services/shipping.service.d.ts.map +1 -0
- package/dist/lib/services/shipping.service.js +23 -0
- package/dist/lib/services/store.service.d.ts +87 -0
- package/dist/lib/services/store.service.d.ts.map +1 -0
- package/dist/lib/services/store.service.js +41 -0
- package/dist/lib/services/wishlist.service.d.ts +30 -0
- package/dist/lib/services/wishlist.service.d.ts.map +1 -0
- package/dist/lib/services/wishlist.service.js +53 -0
- package/dist/lib/store-config-utils.d.ts +41 -0
- package/dist/lib/store-config-utils.d.ts.map +1 -0
- package/dist/lib/store-config-utils.js +1535 -0
- package/dist/lib/store-config.d.ts +3 -0
- package/dist/lib/store-config.d.ts.map +1 -0
- package/dist/lib/store-config.js +2 -0
- package/dist/lib/store-context.d.ts +39 -0
- package/dist/lib/store-context.d.ts.map +1 -0
- package/dist/lib/store-context.js +803 -0
- package/dist/lib/store-types.d.ts +663 -0
- package/dist/lib/store-types.d.ts.map +1 -0
- package/dist/lib/store-types.js +1 -0
- package/dist/lib/utils/asset-helpers.d.ts +102 -0
- package/dist/lib/utils/asset-helpers.d.ts.map +1 -0
- package/dist/lib/utils/asset-helpers.js +395 -0
- package/dist/lib/utils/category-tree.d.ts +25 -0
- package/dist/lib/utils/category-tree.d.ts.map +1 -0
- package/dist/lib/utils/category-tree.js +85 -0
- package/dist/lib/utils/demo-detection.d.ts +23 -0
- package/dist/lib/utils/demo-detection.d.ts.map +1 -0
- package/dist/lib/utils/demo-detection.js +36 -0
- package/dist/lib/utils/fee-calculations.d.ts +35 -0
- package/dist/lib/utils/fee-calculations.d.ts.map +1 -0
- package/dist/lib/utils/fee-calculations.js +64 -0
- package/dist/lib/utils/index.d.ts +37 -0
- package/dist/lib/utils/index.d.ts.map +1 -0
- package/dist/lib/utils/index.js +160 -0
- package/dist/lib/utils/url-helpers.d.ts +30 -0
- package/dist/lib/utils/url-helpers.d.ts.map +1 -0
- package/dist/lib/utils/url-helpers.js +56 -0
- package/dist/lib/utils/video-helpers.d.ts +32 -0
- package/dist/lib/utils/video-helpers.d.ts.map +1 -0
- package/dist/lib/utils/video-helpers.js +210 -0
- package/package.json +92 -0
|
@@ -0,0 +1,502 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { Button } from '../../../components/ui/button';
|
|
4
|
+
import { Breadcrumbs } from '../../../components/ui/breadcrumbs';
|
|
5
|
+
import { Modal } from '../../../components/ui/modal';
|
|
6
|
+
import { ShoppingCart, Heart, Star, Truck, CheckCircle, ThumbsUp, User, Minus, Plus, Ruler, Share2, Info, ChevronDown } from 'lucide-react';
|
|
7
|
+
import { useState, useMemo, useEffect } from 'react';
|
|
8
|
+
import { useStore } from '../../../lib/store-context';
|
|
9
|
+
import { useToast } from '../../../components/ui/toast';
|
|
10
|
+
import { useRouter } from 'next/navigation';
|
|
11
|
+
import { useAuth } from '../../../lib/auth-context';
|
|
12
|
+
import { useAnalytics } from '../../../hooks/use-analytics';
|
|
13
|
+
import { customerService } from '../../../lib/services/customer.service';
|
|
14
|
+
import { GuestCheckoutModal } from '../../../components/ui/guest-checkout-modal';
|
|
15
|
+
import { getGuestUserInfo, saveGuestUserInfo } from '../../../lib/guest-user';
|
|
16
|
+
import { ProductCard } from '../../../components/ui/product-card';
|
|
17
|
+
import Image from 'next/image';
|
|
18
|
+
import { ImageWithFallback } from '../../../components/ui/image-with-fallback';
|
|
19
|
+
import { ButtonLoader } from '../../../components/ui/page-loader';
|
|
20
|
+
import { extractImageUrls } from '../../../lib/store-config-utils';
|
|
21
|
+
import { OutOfStockOverlay } from '../../../components/ui/out-of-stock-overlay';
|
|
22
|
+
import { cn, formatCurrency, filterActiveProducts } from '../../../lib/utils';
|
|
23
|
+
import { shippingService } from '../../../lib/services/shipping.service';
|
|
24
|
+
import { countries, getCountryByName, getCitiesByCountry } from '../../../lib/countries';
|
|
25
|
+
// Helper function to format date
|
|
26
|
+
const formatDate = (dateString) => {
|
|
27
|
+
const date = new Date(dateString);
|
|
28
|
+
return date.toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' });
|
|
29
|
+
};
|
|
30
|
+
// Star Rating Component with half-star support
|
|
31
|
+
function StarRating({ rating, size = 'md', className = '' }) {
|
|
32
|
+
const sizeClasses = {
|
|
33
|
+
sm: 'h-3.5 w-3.5',
|
|
34
|
+
md: 'h-4 w-4',
|
|
35
|
+
lg: 'h-6 w-6',
|
|
36
|
+
};
|
|
37
|
+
const starSize = sizeClasses[size];
|
|
38
|
+
return (_jsx("div", { className: `flex items-center gap-0.5 ${className}`, children: [...Array(5)].map((_, i) => {
|
|
39
|
+
const starValue = i + 1;
|
|
40
|
+
const fullStars = Math.floor(rating);
|
|
41
|
+
const hasHalfStar = rating % 1 >= 0.5 && fullStars === i;
|
|
42
|
+
const isFull = starValue <= fullStars;
|
|
43
|
+
const isHalf = hasHalfStar;
|
|
44
|
+
return (_jsxs("div", { className: `relative inline-block ${sizeClasses[size]}`, children: [_jsx(Star, { className: `w-full h-full absolute inset-0 text-gray-200 fill-gray-200` }), isHalf && (_jsx("div", { className: "absolute inset-0", style: { clipPath: 'inset(0 50% 0 0)' }, children: _jsx(Star, { className: `w-full h-full text-gray-900 fill-gray-900` }) })), isFull && (_jsx(Star, { className: `w-full h-full absolute inset-0 text-gray-900 fill-gray-900` }))] }, i));
|
|
45
|
+
}) }));
|
|
46
|
+
}
|
|
47
|
+
function ReviewCard({ review }) {
|
|
48
|
+
return (_jsxs("div", { className: "border-b border-gray-100 pb-8 last:border-b-0 last:pb-0", children: [_jsx("div", { className: "flex items-start justify-between mb-4", children: _jsxs("div", { className: "flex items-center gap-3", children: [_jsxs("div", { className: "w-12 h-12 rounded-full bg-gradient-to-br from-gray-200 to-gray-300 flex items-center justify-center flex-shrink-0 ring-2 ring-white shadow-sm overflow-hidden", children: [review.userAvatar ? (_jsx(Image, { src: review.userAvatar, alt: review.userName, fill: true, className: "w-full h-full object-cover", unoptimized: true })) : null, _jsx(User, { className: "h-6 w-6 text-gray-600", style: { display: review.userAvatar ? 'none' : 'flex' } })] }), _jsxs("div", { children: [_jsxs("div", { className: "flex items-center gap-2 mb-1", children: [_jsx("span", { className: "font-semibold text-gray-900", children: review.userName }), review.verified && (_jsx("span", { className: "text-xs bg-blue-50 text-blue-700 px-2.5 py-1 rounded-full font-medium border border-blue-100", children: "Verified Purchase" }))] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(StarRating, { rating: review.rating, size: "sm" }), _jsx("span", { className: "text-xs text-gray-500", children: formatDate(review.date) })] })] })] }) }), review.title && (_jsx("h4", { className: "font-semibold text-gray-900 mb-3 text-lg", children: review.title })), _jsx("p", { className: "text-gray-700 leading-relaxed mb-4", children: review.comment }), review.images && review.images.length > 0 && (_jsx("div", { className: "flex gap-2 mb-4", children: review.images.map((img, idx) => (_jsx("div", { className: "relative w-20 h-20 rounded-lg overflow-hidden border border-gray-200", children: _jsx(Image, { src: img, alt: `${review.userName}'s review image ${idx + 1}`, fill: true, className: "object-cover", unoptimized: true }) }, idx))) })), review.helpful !== undefined && (_jsx("div", { className: "flex items-center gap-4", children: _jsxs("button", { className: "flex items-center gap-1.5 text-xs text-gray-600 hover:text-gray-900 transition-colors font-medium", children: [_jsx(ThumbsUp, { className: "h-4 w-4" }), _jsxs("span", { children: ["Helpful (", review.helpful, ")"] })] }) }))] }));
|
|
49
|
+
}
|
|
50
|
+
export function ProductDetailPage({ storeConfig, productSlug }) {
|
|
51
|
+
const products = filterActiveProducts(storeConfig.products || []);
|
|
52
|
+
const product = products.find(p => p.slug === productSlug);
|
|
53
|
+
const { addToCart, isCartLoading, toggleWishlist, isInWishlist, isWishlistLoading, setBuyNowItem } = useStore();
|
|
54
|
+
const { addToast } = useToast();
|
|
55
|
+
const router = useRouter();
|
|
56
|
+
const { isAuthenticated } = useAuth();
|
|
57
|
+
const { trackEvent } = useAnalytics();
|
|
58
|
+
// Related products logic
|
|
59
|
+
const relatedProducts = useMemo(() => {
|
|
60
|
+
if (!product)
|
|
61
|
+
return [];
|
|
62
|
+
return products
|
|
63
|
+
.filter(p => p.categoryId === product.categoryId && p.id !== product.id)
|
|
64
|
+
.slice(0, 4);
|
|
65
|
+
}, [product, products]);
|
|
66
|
+
const handleShare = async () => {
|
|
67
|
+
if (typeof navigator !== 'undefined' && navigator.share) {
|
|
68
|
+
try {
|
|
69
|
+
await navigator.share({
|
|
70
|
+
title: product?.name,
|
|
71
|
+
text: product?.description,
|
|
72
|
+
url: window.location.href,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
console.log('Error sharing:', error);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
// Fallback to copy to clipboard
|
|
81
|
+
try {
|
|
82
|
+
await navigator.clipboard.writeText(window.location.href);
|
|
83
|
+
addToast('Link copied to clipboard!', 'success');
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
addToast('Failed to copy link', 'error');
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
const handleQuickView = (p) => {
|
|
91
|
+
// Navigate to product page for now
|
|
92
|
+
router.push(`/${storeConfig.slug}/products/${p.slug}`);
|
|
93
|
+
};
|
|
94
|
+
const handleWishlistClick = async () => {
|
|
95
|
+
if (!product)
|
|
96
|
+
return;
|
|
97
|
+
if (isWishlistLoading) {
|
|
98
|
+
return; // Prevent multiple clicks
|
|
99
|
+
}
|
|
100
|
+
try {
|
|
101
|
+
const wasInWishlist = isInWishlist(product.id);
|
|
102
|
+
await toggleWishlist(product.id);
|
|
103
|
+
addToast(wasInWishlist
|
|
104
|
+
? `${product.name} removed from wishlist`
|
|
105
|
+
: `${product.name} added to wishlist`, 'success');
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
console.error('Failed to toggle wishlist:', error);
|
|
109
|
+
addToast('Failed to update wishlist', 'error');
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
// Extract color and size variants
|
|
113
|
+
const colorVariants = product?.variants?.filter(v => v.name === 'Color') || [];
|
|
114
|
+
const sizeVariants = product?.variants?.filter(v => v.name === 'Size') || [];
|
|
115
|
+
// Initialize state with defaults
|
|
116
|
+
const [selectedImage, setSelectedImage] = useState(0);
|
|
117
|
+
// Ensure selectedImage is within bounds when images change
|
|
118
|
+
useEffect(() => {
|
|
119
|
+
if (product && product.images && product.images.length > 0 && selectedImage >= product.images.length) {
|
|
120
|
+
// Use setTimeout to avoid synchronous setState in effect
|
|
121
|
+
setTimeout(() => setSelectedImage(0), 0);
|
|
122
|
+
}
|
|
123
|
+
}, [product, selectedImage]);
|
|
124
|
+
const [selectedColor, setSelectedColor] = useState(colorVariants.length > 0 ? colorVariants[0].value : null);
|
|
125
|
+
const [selectedSize, setSelectedSize] = useState(sizeVariants.length > 0 ? sizeVariants[0].value : null);
|
|
126
|
+
const [quantity, setQuantity] = useState(1);
|
|
127
|
+
const [showAllReviews, setShowAllReviews] = useState(false);
|
|
128
|
+
const [isReviewModalOpen, setIsReviewModalOpen] = useState(false);
|
|
129
|
+
const [newReview, setNewReview] = useState({ rating: 5, title: '', comment: '' });
|
|
130
|
+
const [showGuestModal, setShowGuestModal] = useState(false);
|
|
131
|
+
const [isBuyNowLoading, setIsBuyNowLoading] = useState(false);
|
|
132
|
+
// Shipping calculation state
|
|
133
|
+
const [shippingAddress, setShippingAddress] = useState({
|
|
134
|
+
country: '',
|
|
135
|
+
city: '',
|
|
136
|
+
zipCode: '',
|
|
137
|
+
});
|
|
138
|
+
const [savedAddresses, setSavedAddresses] = useState([]);
|
|
139
|
+
const [isCountryDropdownOpen, setIsCountryDropdownOpen] = useState(false);
|
|
140
|
+
const [isCityDropdownOpen, setIsCityDropdownOpen] = useState(false);
|
|
141
|
+
const [shippingMethods, setShippingMethods] = useState([]);
|
|
142
|
+
const [isCalculatingShipping, setIsCalculatingShipping] = useState(false);
|
|
143
|
+
const [shippingError, setShippingError] = useState(null);
|
|
144
|
+
const [freeShippingEligible, setFreeShippingEligible] = useState(false);
|
|
145
|
+
const [freeShippingThreshold, setFreeShippingThreshold] = useState(undefined);
|
|
146
|
+
const handleSubmitReview = (e) => {
|
|
147
|
+
e.preventDefault();
|
|
148
|
+
// In a real app, this would submit to API
|
|
149
|
+
addToast('Review submitted successfully!', 'success');
|
|
150
|
+
setIsReviewModalOpen(false);
|
|
151
|
+
setNewReview({ rating: 5, title: '', comment: '' });
|
|
152
|
+
};
|
|
153
|
+
if (!product) {
|
|
154
|
+
return (_jsx("div", { className: "min-h-screen bg-white flex items-center justify-center p-8", children: _jsxs("div", { className: "text-center", children: [_jsx("h1", { className: "text-2xl font-bold mb-2", children: "Product Not Found" }), _jsx("p", { className: "text-gray-600 mb-4", children: "The product you're looking for doesn't exist." })] }) }));
|
|
155
|
+
}
|
|
156
|
+
// Use SKU for display, fallback to generated SKU from slug if not available
|
|
157
|
+
const displaySKU = product.sku || product.slug?.toUpperCase().replace(/-/g, '').substring(0, 12).padEnd(8, 'X') || 'N/A';
|
|
158
|
+
// Build category breadcrumb path with all parent categories
|
|
159
|
+
const buildCategoryPath = (categoryId) => {
|
|
160
|
+
if (!categoryId)
|
|
161
|
+
return [];
|
|
162
|
+
const path = [];
|
|
163
|
+
let currentCategoryId = categoryId;
|
|
164
|
+
// Traverse up the parent chain
|
|
165
|
+
while (currentCategoryId) {
|
|
166
|
+
const category = storeConfig.categories.find(c => c.id === currentCategoryId);
|
|
167
|
+
if (!category)
|
|
168
|
+
break;
|
|
169
|
+
path.unshift(category); // Add to beginning to maintain root-to-leaf order
|
|
170
|
+
currentCategoryId = category.parentId || null;
|
|
171
|
+
}
|
|
172
|
+
return path;
|
|
173
|
+
};
|
|
174
|
+
// Get category path for breadcrumbs
|
|
175
|
+
const categoryPath = product.categoryId ? buildCategoryPath(product.categoryId) : [];
|
|
176
|
+
const directCategory = categoryPath.length > 0 ? categoryPath[categoryPath.length - 1] : null;
|
|
177
|
+
// Generate breadcrumbs with all parent categories
|
|
178
|
+
const breadcrumbItems = [
|
|
179
|
+
{ label: storeConfig.name, href: `/${storeConfig.slug}` },
|
|
180
|
+
// Add all parent categories
|
|
181
|
+
...categoryPath.map(cat => ({
|
|
182
|
+
label: cat.name,
|
|
183
|
+
href: `/${storeConfig.slug}/categories/${cat.slug || ''}`,
|
|
184
|
+
})),
|
|
185
|
+
// Add product name
|
|
186
|
+
{ label: product.name, href: `/${storeConfig.slug}/products/${product.slug}` },
|
|
187
|
+
];
|
|
188
|
+
// Extract product images - product.images should already be string[] from transformation,
|
|
189
|
+
// but handle edge cases where it might still be in object format
|
|
190
|
+
// Use the comprehensive extraction utility from store-config-utils for consistency
|
|
191
|
+
const productImages = (() => {
|
|
192
|
+
// Debug: Log the raw product.images to understand its format
|
|
193
|
+
if (process.env.NODE_ENV === 'development') {
|
|
194
|
+
console.log('[ProductDetailPage] Raw product.images:', {
|
|
195
|
+
productId: product.id,
|
|
196
|
+
productName: product.name,
|
|
197
|
+
images: product.images,
|
|
198
|
+
imagesType: typeof product.images,
|
|
199
|
+
imagesIsArray: Array.isArray(product.images),
|
|
200
|
+
imagesLength: Array.isArray(product.images) ? product.images.length : 'N/A',
|
|
201
|
+
firstItem: Array.isArray(product.images) && product.images.length > 0 ? product.images[0] : 'N/A',
|
|
202
|
+
firstItemType: Array.isArray(product.images) && product.images.length > 0 ? typeof product.images[0] : 'N/A'
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
// If already an array of strings (normal case after transformation)
|
|
206
|
+
if (Array.isArray(product.images) && product.images.length > 0) {
|
|
207
|
+
const firstItem = product.images[0];
|
|
208
|
+
if (typeof firstItem === 'string') {
|
|
209
|
+
const filtered = product.images.filter((img) => typeof img === 'string' && img.trim().length > 0);
|
|
210
|
+
if (process.env.NODE_ENV === 'development') {
|
|
211
|
+
console.log('[ProductDetailPage] Using string array directly:', { count: filtered.length, firstImage: filtered[0]?.substring(0, 100) });
|
|
212
|
+
}
|
|
213
|
+
return filtered;
|
|
214
|
+
}
|
|
215
|
+
// If array but not strings, extract using utility
|
|
216
|
+
if (process.env.NODE_ENV === 'development') {
|
|
217
|
+
console.log('[ProductDetailPage] Array but not strings, using extractImageUrls');
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
// Use the comprehensive extraction utility for any other format (objects, nested structures, etc.)
|
|
221
|
+
const extracted = extractImageUrls(product.images);
|
|
222
|
+
if (process.env.NODE_ENV === 'development') {
|
|
223
|
+
console.log('[ProductDetailPage] Extracted using utility:', { count: extracted.length, firstImage: extracted[0]?.substring(0, 100) });
|
|
224
|
+
}
|
|
225
|
+
return extracted;
|
|
226
|
+
})();
|
|
227
|
+
// For gallery, use actual images only (don't duplicate to fill 5 slots)
|
|
228
|
+
const displayImages = productImages.slice(0, 5);
|
|
229
|
+
const hasMoreImages = productImages.length > 5;
|
|
230
|
+
// Debug logging for images (can be removed in production)
|
|
231
|
+
if (process.env.NODE_ENV === 'development') {
|
|
232
|
+
if (productImages.length === 0) {
|
|
233
|
+
console.warn(`[ProductDetailPage] Product "${product.name}" (${product.id}) has no valid images:`, {
|
|
234
|
+
productId: product.id,
|
|
235
|
+
productName: product.name,
|
|
236
|
+
originalImages: product.images,
|
|
237
|
+
originalType: typeof product.images,
|
|
238
|
+
originalIsArray: Array.isArray(product.images),
|
|
239
|
+
validImagesCount: productImages.length
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
console.log(`[ProductDetailPage] Product "${product.name}" (${product.id}) images:`, {
|
|
244
|
+
productId: product.id,
|
|
245
|
+
validImagesCount: productImages.length,
|
|
246
|
+
displayImagesCount: displayImages.length,
|
|
247
|
+
firstImage: productImages[0]?.substring(0, 100)
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
// Color swatch mapping
|
|
252
|
+
const colorSwatches = {
|
|
253
|
+
'White': '#FFFFFF',
|
|
254
|
+
'Black': '#000000',
|
|
255
|
+
'Gray': '#808080',
|
|
256
|
+
'Grey': '#808080',
|
|
257
|
+
'Blue': '#3B82F6',
|
|
258
|
+
'Red': '#EF4444',
|
|
259
|
+
'Green': '#10B981',
|
|
260
|
+
'Yellow': '#FBBF24',
|
|
261
|
+
'Brown': '#92400E',
|
|
262
|
+
'Navy': '#1E3A8A',
|
|
263
|
+
'Beige': '#F5F5DC',
|
|
264
|
+
};
|
|
265
|
+
// Get reviews
|
|
266
|
+
const reviews = product.reviews || [];
|
|
267
|
+
const displayedReviews = showAllReviews ? reviews : reviews.slice(0, 3);
|
|
268
|
+
const hasMoreReviews = reviews.length > 3;
|
|
269
|
+
// Out of stock check
|
|
270
|
+
const isOutOfStock = !product.inStock;
|
|
271
|
+
// Calculate rating distribution
|
|
272
|
+
const ratingDistribution = [5, 4, 3, 2, 1].map(rating => {
|
|
273
|
+
const count = reviews.filter(r => r.rating === rating).length;
|
|
274
|
+
return {
|
|
275
|
+
rating,
|
|
276
|
+
count,
|
|
277
|
+
percentage: reviews.length > 0 ? (count / reviews.length) * 100 : 0,
|
|
278
|
+
};
|
|
279
|
+
});
|
|
280
|
+
const handleAddToCart = () => {
|
|
281
|
+
if (isOutOfStock) {
|
|
282
|
+
addToast('This product is currently out of stock', 'error');
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
// Find the matching variation UUID based on selected attributes
|
|
286
|
+
// Note: StoreProduct uses 'variants' not 'variations'
|
|
287
|
+
let variationId;
|
|
288
|
+
if (product.variants && Array.isArray(product.variants) && product.variants.length > 0) {
|
|
289
|
+
const matchingVariation = product.variants.find((variation) => {
|
|
290
|
+
const attrs = variation.attributes || {};
|
|
291
|
+
const colorMatch = !selectedColor || attrs.color === selectedColor;
|
|
292
|
+
const sizeMatch = !selectedSize || attrs.size === selectedSize;
|
|
293
|
+
return colorMatch && sizeMatch;
|
|
294
|
+
});
|
|
295
|
+
variationId = matchingVariation?.id;
|
|
296
|
+
}
|
|
297
|
+
// Fallback to composite string for backward compatibility if no variation found
|
|
298
|
+
const variantId = variationId || (selectedColor || selectedSize
|
|
299
|
+
? [selectedColor, selectedSize].filter(Boolean).join(' / ')
|
|
300
|
+
: undefined);
|
|
301
|
+
addToCart(product, quantity, variantId);
|
|
302
|
+
addToast(`${product.name} added to cart`, 'success');
|
|
303
|
+
};
|
|
304
|
+
const handleBuyNow = async () => {
|
|
305
|
+
if (isOutOfStock) {
|
|
306
|
+
addToast('This product is currently out of stock', 'error');
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
if (isBuyNowLoading || isCartLoading) {
|
|
310
|
+
return; // Prevent multiple clicks
|
|
311
|
+
}
|
|
312
|
+
setIsBuyNowLoading(true);
|
|
313
|
+
try {
|
|
314
|
+
// Find the matching variation UUID based on selected attributes
|
|
315
|
+
// Note: StoreProduct uses 'variants' not 'variations'
|
|
316
|
+
let variationId;
|
|
317
|
+
let variantName;
|
|
318
|
+
if (product.variants && Array.isArray(product.variants) && product.variants.length > 0) {
|
|
319
|
+
const matchingVariation = product.variants.find((variation) => {
|
|
320
|
+
const attrs = variation.attributes || {};
|
|
321
|
+
const colorMatch = !selectedColor || attrs.color === selectedColor;
|
|
322
|
+
const sizeMatch = !selectedSize || attrs.size === selectedSize;
|
|
323
|
+
return colorMatch && sizeMatch;
|
|
324
|
+
});
|
|
325
|
+
variationId = matchingVariation?.id;
|
|
326
|
+
variantName = matchingVariation?.name || matchingVariation?.value;
|
|
327
|
+
}
|
|
328
|
+
// Fallback to composite string for backward compatibility if no variation found
|
|
329
|
+
const variantId = variationId || (selectedColor || selectedSize
|
|
330
|
+
? [selectedColor, selectedSize].filter(Boolean).join(' / ')
|
|
331
|
+
: undefined);
|
|
332
|
+
// Create buy now item (don't add to cart)
|
|
333
|
+
const buyNowItemId = variantId ? `${product.id}-${variantId}` : product.id;
|
|
334
|
+
const buyNowItem = {
|
|
335
|
+
id: buyNowItemId,
|
|
336
|
+
productId: product.id,
|
|
337
|
+
quantity,
|
|
338
|
+
variantId,
|
|
339
|
+
variantName: variantName || variantId,
|
|
340
|
+
price: product.price,
|
|
341
|
+
product
|
|
342
|
+
};
|
|
343
|
+
// Set buy now item and navigate directly to checkout
|
|
344
|
+
setBuyNowItem(buyNowItem);
|
|
345
|
+
// Navigate to checkout page for direct checkout
|
|
346
|
+
router.push(`/${storeConfig.slug}/checkout`);
|
|
347
|
+
}
|
|
348
|
+
catch (error) {
|
|
349
|
+
console.error('Buy Now error:', error);
|
|
350
|
+
addToast('Failed to proceed to checkout. Please try again.', 'error');
|
|
351
|
+
}
|
|
352
|
+
finally {
|
|
353
|
+
setIsBuyNowLoading(false);
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
const handleGuestInfoSubmit = (userInfo) => {
|
|
357
|
+
// Save guest info to localStorage
|
|
358
|
+
saveGuestUserInfo(userInfo);
|
|
359
|
+
setShowGuestModal(false);
|
|
360
|
+
// Note: This is now only used for other flows, not buy now
|
|
361
|
+
// Buy now now redirects to checkout page
|
|
362
|
+
};
|
|
363
|
+
// Calculate shipping when address is provided
|
|
364
|
+
const calculateShipping = async () => {
|
|
365
|
+
if (!product || !shippingAddress.country || !shippingAddress.city) {
|
|
366
|
+
setShippingError('Please provide country and city to calculate shipping');
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
setIsCalculatingShipping(true);
|
|
370
|
+
setShippingError(null);
|
|
371
|
+
try {
|
|
372
|
+
const currency = product.currency || storeConfig.settings?.currency || 'USD';
|
|
373
|
+
const subtotal = product.price * quantity;
|
|
374
|
+
const result = await shippingService.calculateShipping({
|
|
375
|
+
storeId: storeConfig.id,
|
|
376
|
+
address: {
|
|
377
|
+
country: shippingAddress.country,
|
|
378
|
+
city: shippingAddress.city,
|
|
379
|
+
zipCode: shippingAddress.zipCode,
|
|
380
|
+
},
|
|
381
|
+
items: [{
|
|
382
|
+
productId: product.id,
|
|
383
|
+
quantity: quantity,
|
|
384
|
+
}],
|
|
385
|
+
subtotal: subtotal,
|
|
386
|
+
currency: currency,
|
|
387
|
+
});
|
|
388
|
+
setShippingMethods(result.methods || []);
|
|
389
|
+
setFreeShippingEligible(result.freeShippingEligible || false);
|
|
390
|
+
setFreeShippingThreshold(result.freeShippingThreshold);
|
|
391
|
+
}
|
|
392
|
+
catch (error) {
|
|
393
|
+
console.error('Shipping calculation error:', error);
|
|
394
|
+
setShippingError(error.message || 'Failed to calculate shipping. Please try again.');
|
|
395
|
+
setShippingMethods([]);
|
|
396
|
+
}
|
|
397
|
+
finally {
|
|
398
|
+
setIsCalculatingShipping(false);
|
|
399
|
+
}
|
|
400
|
+
};
|
|
401
|
+
// Load saved addresses for authenticated users and auto-populate shipping address
|
|
402
|
+
useEffect(() => {
|
|
403
|
+
const loadAddresses = async () => {
|
|
404
|
+
if (isAuthenticated) {
|
|
405
|
+
try {
|
|
406
|
+
const addresses = await customerService.getAddresses();
|
|
407
|
+
setSavedAddresses(addresses);
|
|
408
|
+
// Auto-populate with default address or first address if available
|
|
409
|
+
if (addresses.length > 0) {
|
|
410
|
+
const defaultAddress = addresses.find(a => a.isDefault) || addresses[0];
|
|
411
|
+
if (defaultAddress) {
|
|
412
|
+
setShippingAddress({
|
|
413
|
+
country: defaultAddress.country || '',
|
|
414
|
+
city: defaultAddress.city || '',
|
|
415
|
+
zipCode: defaultAddress.zipCode || '',
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
catch (error) {
|
|
421
|
+
console.error('Failed to load addresses:', error);
|
|
422
|
+
// Don't show error toast - addresses are optional
|
|
423
|
+
// Users can still manually enter shipping address
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
loadAddresses();
|
|
428
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
429
|
+
}, [isAuthenticated]);
|
|
430
|
+
// Auto-calculate shipping when address fields are filled (debounced)
|
|
431
|
+
useEffect(() => {
|
|
432
|
+
if (!shippingAddress.country || !shippingAddress.city || !product) {
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
const timer = setTimeout(() => {
|
|
436
|
+
calculateShipping();
|
|
437
|
+
}, 500); // Debounce 500ms
|
|
438
|
+
return () => clearTimeout(timer);
|
|
439
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
440
|
+
}, [shippingAddress.country, shippingAddress.city, shippingAddress.zipCode, quantity, product?.id, product?.price]);
|
|
441
|
+
// Track product view
|
|
442
|
+
useEffect(() => {
|
|
443
|
+
if (product && storeConfig?.id) {
|
|
444
|
+
trackEvent({
|
|
445
|
+
eventType: 'product_view',
|
|
446
|
+
metadata: {
|
|
447
|
+
productId: product.id,
|
|
448
|
+
productName: product.name,
|
|
449
|
+
categoryId: product.categoryId,
|
|
450
|
+
price: product.price,
|
|
451
|
+
},
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
}, [product?.id, storeConfig?.id, trackEvent]);
|
|
455
|
+
return (_jsxs("div", { className: "min-h-screen bg-white", children: [_jsxs("div", { "data-content-ready": true, className: "container mx-auto px-4 sm:px-6 lg:px-8 py-8 lg:py-12 max-w-7xl", children: [_jsx("div", { className: "mb-6", children: _jsx(Breadcrumbs, { items: breadcrumbItems }) }), _jsxs("div", { className: "grid grid-cols-1 lg:grid-cols-2 gap-8 lg:gap-16 mb-20", children: [_jsxs("div", { className: "relative lg:sticky lg:top-24 self-start z-0", children: [_jsxs("div", { className: "relative aspect-square bg-gray-50 rounded-xl overflow-hidden mb-4 border border-gray-100 shadow-sm group", children: [_jsx(ImageWithFallback, { "data-product-image": true, src: displayImages[selectedImage] || displayImages[0] || productImages[0], alt: product.name, className: cn("w-full h-full object-cover transition-transform duration-300 group-hover:scale-105", isOutOfStock && "grayscale"), skeletonAspectRatio: "square" }), isOutOfStock && (_jsx(OutOfStockOverlay, { badgePosition: "center" }))] }), displayImages.length > 0 && (_jsxs("div", { className: "grid grid-cols-5 gap-2", children: [displayImages.map((image, index) => (_jsx("button", { onClick: () => setSelectedImage(Math.min(index, displayImages.length - 1)), className: `aspect-square rounded-lg overflow-hidden border-2 transition-all ${selectedImage === index
|
|
456
|
+
? 'border-gray-900 ring-2 ring-gray-900 ring-offset-2'
|
|
457
|
+
: 'border-gray-200 hover:border-gray-300'}`, children: _jsx(ImageWithFallback, { src: image, alt: `${product.name} view ${index + 1}`, className: cn("w-full h-full object-cover", isOutOfStock && "grayscale"), skeletonAspectRatio: "square" }) }, index))), hasMoreImages && (_jsxs("div", { className: "aspect-square rounded-lg border-2 border-gray-200 bg-gray-50 flex items-center justify-center text-xs text-gray-500 font-medium", children: ["+", productImages.length - 5, " more"] }))] }))] }), _jsxs("div", { className: "flex flex-col", children: [_jsxs("div", { className: "flex items-center justify-between mb-2", children: [_jsx("span", { className: "text-sm font-semibold text-gray-700 uppercase tracking-wide", children: (() => {
|
|
458
|
+
const brandMatch = product.name.match(/\b(Reebok|Nike|Adidas|Puma|New Balance|Vans|Converse)\b/i);
|
|
459
|
+
return brandMatch ? brandMatch[1] : storeConfig.name;
|
|
460
|
+
})() }), _jsx("button", { onClick: handleShare, className: "text-gray-400 hover:text-gray-900 transition-colors p-2 rounded-full hover:bg-gray-100", title: "Share this product", children: _jsx(Share2, { className: "h-5 w-5" }) })] }), _jsx("h1", { "data-product-name": true, className: "text-3xl sm:text-4xl lg:text-5xl font-bold text-gray-900 mb-3 leading-tight tracking-tight", children: product.name }), _jsxs("p", { className: "text-sm text-gray-500 mb-6 font-mono", children: ["SKU: ", displaySKU] }), _jsx("div", { className: "mb-4 flex items-center gap-2", children: product.inStock ? (_jsxs("span", { className: "inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800", children: [_jsx(CheckCircle, { className: "w-3 h-3 mr-1" }), "In Stock"] })) : (_jsxs("span", { className: "inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-red-100 text-red-800", children: [_jsx(Info, { className: "w-3 h-3 mr-1" }), "Out of Stock"] })) }), _jsxs("div", { className: "mb-8", children: [_jsxs("div", { className: "flex items-baseline gap-4", children: [_jsx("span", { "data-product-price": true, className: "text-4xl lg:text-5xl font-bold text-gray-900", children: formatCurrency(product.price, product.currency || 'USD') }), product.compareAtPrice && (_jsx("span", { className: "text-2xl text-gray-500 line-through", children: formatCurrency(product.compareAtPrice, product.currency || 'USD') }))] }), product.compareAtPrice && (_jsxs("span", { className: "inline-block mt-2 bg-red-100 text-red-700 text-xs font-bold px-2 py-1 rounded", children: ["SAVE ", Math.round(((product.compareAtPrice - product.price) / product.compareAtPrice) * 100), "%"] }))] }), colorVariants.length > 0 && (_jsxs("div", { className: "mb-8", children: [_jsxs("div", { className: "flex items-center gap-2 mb-4", children: [_jsx("span", { className: "text-sm font-semibold text-gray-900", children: "Color:" }), _jsx("span", { className: "text-sm text-gray-600 capitalize", children: selectedColor || colorVariants[0]?.value })] }), _jsx("div", { className: "flex gap-3", children: colorVariants.map((variant) => {
|
|
461
|
+
const colorValue = variant.value;
|
|
462
|
+
const swatchColor = colorSwatches[colorValue] || '#CCCCCC';
|
|
463
|
+
const isSelected = selectedColor === colorValue;
|
|
464
|
+
return (_jsx("button", { onClick: () => setSelectedColor(colorValue), className: `relative w-12 h-12 rounded-full border-2 transition-all ${isSelected
|
|
465
|
+
? 'border-gray-900 ring-2 ring-gray-900 ring-offset-2 scale-105'
|
|
466
|
+
: 'border-gray-200 hover:border-gray-300'}`, style: { backgroundColor: swatchColor }, title: colorValue, children: isSelected && (_jsx("div", { className: "absolute inset-0 flex items-center justify-center", children: _jsx(CheckCircle, { className: `h-5 w-5 ${['White', 'Beige', 'Yellow'].includes(colorValue) ? 'text-gray-900' : 'text-white'} drop-shadow-sm` }) })) }, variant.id));
|
|
467
|
+
}) })] })), sizeVariants.length > 0 && (_jsxs("div", { className: "mb-8", children: [_jsxs("div", { className: "flex items-center justify-between mb-4", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-sm font-semibold text-gray-900", children: "Size:" }), _jsx("span", { className: "text-sm text-gray-600", children: selectedSize || 'Select Size' })] }), _jsxs("a", { href: `/${storeConfig.slug}/size-guide`, target: "_blank", rel: "noopener noreferrer", className: "flex items-center gap-1.5 text-xs font-medium text-gray-600 hover:text-gray-900 underline decoration-gray-400 underline-offset-4", children: [_jsx(Ruler, { className: "h-3.5 w-3.5" }), " Size guide"] })] }), _jsx("div", { className: "grid grid-cols-4 sm:grid-cols-5 gap-2.5", children: sizeVariants.map((variant) => {
|
|
468
|
+
const isSelected = selectedSize === variant.value;
|
|
469
|
+
return (_jsx("button", { onClick: () => setSelectedSize(variant.value), className: `px-4 py-3 rounded-lg border-2 text-sm font-semibold transition-all ${isSelected
|
|
470
|
+
? 'bg-gray-900 text-white border-gray-900 shadow-md transform -translate-y-0.5'
|
|
471
|
+
: 'bg-white text-gray-700 border-gray-200 hover:border-gray-300 hover:bg-gray-50'}`, children: variant.value }, variant.id));
|
|
472
|
+
}) })] })), _jsxs("div", { className: "flex flex-col gap-4 mb-8", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("span", { className: "text-sm font-semibold text-gray-900", children: "Quantity" }), _jsxs("div", { className: "flex items-center border border-gray-300 rounded-lg", children: [_jsx("button", { className: "p-3 text-gray-600 hover:bg-gray-100 rounded-l-lg disabled:opacity-50", onClick: () => setQuantity(Math.max(1, quantity - 1)), disabled: quantity <= 1, children: _jsx(Minus, { className: "h-4 w-4" }) }), _jsx("span", { className: "w-12 text-center font-semibold text-gray-900", children: quantity }), _jsx("button", { className: "p-3 text-gray-600 hover:bg-gray-100 rounded-r-lg", onClick: () => setQuantity(quantity + 1), children: _jsx(Plus, { className: "h-4 w-4" }) })] })] }), _jsxs("div", { className: "flex flex-col sm:flex-row gap-3 mt-2", children: [_jsx(Button, { "data-add-to-cart": true, size: "lg", onClick: handleAddToCart, disabled: isCartLoading || isOutOfStock, className: "flex-1 bg-white border-2 border-gray-900 text-gray-900 hover:bg-gray-50 rounded-full h-14 text-base font-bold shadow-sm transition-all disabled:opacity-50 disabled:cursor-not-allowed", children: isCartLoading ? (_jsxs(_Fragment, { children: [_jsx(ButtonLoader, { className: "mr-2" }), "Adding..."] })) : (_jsxs(_Fragment, { children: [_jsx(ShoppingCart, { className: "h-5 w-5 mr-2" }), "Add to Cart"] })) }), _jsx(Button, { size: "lg", onClick: handleBuyNow, disabled: isOutOfStock || isBuyNowLoading || isCartLoading, className: "flex-1 bg-gray-900 hover:bg-gray-800 text-white rounded-full h-14 text-base font-bold shadow-lg hover:shadow-xl transition-all disabled:opacity-50 disabled:cursor-not-allowed", children: isBuyNowLoading || isCartLoading ? (_jsxs(_Fragment, { children: [_jsx(ButtonLoader, { className: "mr-2" }), "Adding..."] })) : ('Buy Now') }), storeConfig.features.wishlist && (_jsx(Button, { variant: "outline", size: "lg", onClick: handleWishlistClick, disabled: isWishlistLoading || !product, className: cn("h-14 w-14 rounded-full border-2 transition-all disabled:opacity-50 disabled:cursor-not-allowed", product && isInWishlist(product.id)
|
|
473
|
+
? "border-red-500 bg-red-50 text-red-500 hover:bg-red-100"
|
|
474
|
+
: "border-gray-200 hover:border-gray-300 hover:bg-gray-50"), children: isWishlistLoading ? (_jsx(ButtonLoader, { className: "h-5 w-5" })) : (_jsx(Heart, { className: cn("h-5 w-5", product && isInWishlist(product.id) && "fill-current") })) }))] })] }), _jsxs("div", { className: "mb-8 border-t border-b border-gray-100 py-6", children: [_jsxs("h3", { className: "font-bold text-gray-900 flex items-center gap-2 text-sm mb-4 uppercase tracking-wider", children: [_jsx(Truck, { className: "h-4 w-4" }), " Delivery Information"] }), _jsxs("div", { className: "mb-4 p-4 bg-gray-50 rounded-lg border border-gray-200", children: [_jsx("p", { className: "text-xs font-semibold text-gray-700 mb-3 uppercase tracking-wider", children: "Calculate Shipping" }), _jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-3 gap-3", children: [_jsxs("div", { children: [_jsx("label", { className: "text-xs font-medium text-gray-600 mb-1 block", children: "Country" }), _jsxs("div", { className: "relative", children: [_jsxs("button", { type: "button", onClick: () => setIsCountryDropdownOpen(!isCountryDropdownOpen), className: cn("w-full px-3 py-2 text-sm bg-white border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-gray-900 focus:border-transparent transition-all font-medium flex items-center justify-between text-left"), children: [_jsx("span", { className: "flex items-center gap-2", children: (() => {
|
|
475
|
+
const selectedCountry = getCountryByName(shippingAddress.country);
|
|
476
|
+
return selectedCountry ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "text-base", children: selectedCountry.flag }), _jsx("span", { children: selectedCountry.name })] })) : (_jsx("span", { className: "text-gray-400", children: "Select country" }));
|
|
477
|
+
})() }), _jsx(ChevronDown, { className: cn("w-4 h-4 text-gray-400 transition-transform", isCountryDropdownOpen && "transform rotate-180") })] }), isCountryDropdownOpen && (_jsxs(_Fragment, { children: [_jsx("div", { className: "fixed inset-0 z-10", onClick: () => setIsCountryDropdownOpen(false) }), _jsx("div", { className: "absolute z-20 w-full mt-1 bg-white border border-gray-300 rounded-lg shadow-xl max-h-64 overflow-y-auto", children: countries.map((country) => (_jsxs("button", { type: "button", onClick: () => {
|
|
478
|
+
setShippingAddress({ ...shippingAddress, country: country.name, city: '' }); // Clear city when country changes
|
|
479
|
+
setIsCountryDropdownOpen(false);
|
|
480
|
+
setIsCityDropdownOpen(false);
|
|
481
|
+
}, className: cn("w-full px-3 py-2 text-sm text-left flex items-center gap-2 hover:bg-gray-50 transition-colors", shippingAddress.country === country.name && "bg-gray-50 font-medium"), children: [_jsx("span", { className: "text-base", children: country.flag }), _jsx("span", { children: country.name })] }, country.code))) })] }))] })] }), _jsxs("div", { children: [_jsx("label", { className: "text-xs font-medium text-gray-600 mb-1 block", children: "City" }), _jsxs("div", { className: "relative", children: [_jsxs("button", { type: "button", onClick: () => {
|
|
482
|
+
if (shippingAddress.country) {
|
|
483
|
+
setIsCityDropdownOpen(!isCityDropdownOpen);
|
|
484
|
+
}
|
|
485
|
+
else {
|
|
486
|
+
addToast('Please select a country first', 'error');
|
|
487
|
+
}
|
|
488
|
+
}, disabled: !shippingAddress.country, className: cn("w-full px-3 py-2 text-sm bg-white border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-gray-900 focus:border-transparent transition-all font-medium flex items-center justify-between text-left", !shippingAddress.country && "opacity-50 cursor-not-allowed"), children: [_jsx("span", { className: shippingAddress.city ? "text-gray-900" : "text-gray-400", children: shippingAddress.city || 'Select city' }), _jsx(ChevronDown, { className: cn("w-4 h-4 text-gray-400 transition-transform", isCityDropdownOpen && "transform rotate-180") })] }), isCityDropdownOpen && shippingAddress.country && (_jsxs(_Fragment, { children: [_jsx("div", { className: "fixed inset-0 z-10", onClick: () => setIsCityDropdownOpen(false) }), _jsx("div", { className: "absolute z-20 w-full mt-1 bg-white border border-gray-300 rounded-lg shadow-xl max-h-64 overflow-y-auto", children: getCitiesByCountry(shippingAddress.country).length > 0 ? (getCitiesByCountry(shippingAddress.country).map((city) => (_jsx("button", { type: "button", onClick: () => {
|
|
489
|
+
setShippingAddress({ ...shippingAddress, city });
|
|
490
|
+
setIsCityDropdownOpen(false);
|
|
491
|
+
}, className: cn("w-full px-3 py-2 text-sm text-left hover:bg-gray-50 transition-colors", shippingAddress.city === city && "bg-gray-50 font-medium"), children: city }, city)))) : (_jsx("div", { className: "px-3 py-2 text-sm text-gray-500", children: "No cities available for this country" })) })] }))] })] }), _jsxs("div", { children: [_jsx("label", { className: "text-xs font-medium text-gray-600 mb-1 block", children: "Zip/Postal Code" }), _jsx("input", { type: "text", placeholder: "Optional", value: shippingAddress.zipCode, onChange: (e) => setShippingAddress({ ...shippingAddress, zipCode: e.target.value }), className: "w-full px-3 py-2 text-sm border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-gray-900 focus:border-transparent" })] })] }), shippingError && (_jsx("p", { className: "text-xs text-red-600 mt-2", children: shippingError }))] }), freeShippingThreshold !== undefined && !freeShippingEligible && (_jsxs("div", { className: "mb-4 p-3 bg-blue-50 border border-blue-200 rounded-lg", children: [_jsxs("p", { className: "text-xs font-medium text-blue-900 mb-1", children: ["Spend ", formatCurrency(freeShippingThreshold - (product.price * quantity), product.currency || storeConfig.settings?.currency || 'USD'), " more for free shipping!"] }), _jsx("div", { className: "w-full bg-blue-200 rounded-full h-2", children: _jsx("div", { className: "bg-blue-600 h-2 rounded-full transition-all", style: {
|
|
492
|
+
width: `${Math.min(100, ((product.price * quantity) / freeShippingThreshold) * 100)}%`,
|
|
493
|
+
} }) })] })), isCalculatingShipping ? (_jsx("div", { className: "flex items-center justify-center p-8", children: _jsxs("div", { className: "flex items-center gap-2 text-gray-600", children: [_jsx("div", { className: "animate-spin rounded-full h-5 w-5 border-b-2 border-gray-900" }), _jsx("span", { className: "text-sm font-medium", children: "Calculating shipping..." })] }) })) : shippingMethods.length > 0 ? (_jsx("div", { className: "space-y-0 divide-y divide-gray-100 border border-gray-100 rounded-lg overflow-hidden", children: shippingMethods.map((method, index) => (_jsxs("div", { className: cn("flex items-center justify-between p-4 bg-white hover:bg-gray-50 transition-colors group", freeShippingEligible && method.cost === 0 && "bg-green-50 border-green-200"), children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: cn("p-2 rounded-full group-hover:bg-white transition-colors border", freeShippingEligible && method.cost === 0
|
|
494
|
+
? "bg-green-100 border-green-300"
|
|
495
|
+
: "bg-gray-50 border-gray-100"), children: freeShippingEligible && method.cost === 0 ? (_jsx(CheckCircle, { className: "h-4 w-4 text-green-700" })) : (_jsx(Truck, { className: "h-4 w-4 text-gray-900" })) }), _jsxs("div", { children: [_jsxs("p", { className: "font-bold text-gray-900 text-sm", children: [method.name, freeShippingEligible && method.cost === 0 && (_jsx("span", { className: "ml-2 text-xs font-normal text-green-700 bg-green-100 px-2 py-0.5 rounded-full", children: "FREE" }))] }), _jsx("p", { className: "text-[11px] text-gray-500 font-medium mt-0.5", children: method.description || method.estimatedDays
|
|
496
|
+
? `${method.estimatedDaysMin || method.estimatedDays}-${method.estimatedDaysMax || method.estimatedDays} business days`
|
|
497
|
+
: 'Delivery estimate available' })] })] }), _jsxs("div", { className: "text-right", children: [_jsx("p", { className: "font-bold text-gray-900 text-sm", children: freeShippingEligible && method.cost === 0
|
|
498
|
+
? 'FREE'
|
|
499
|
+
: formatCurrency(method.cost, product.currency || storeConfig.settings?.currency || 'USD') }), method.estimatedDays && (_jsx("p", { className: "text-[11px] text-gray-500 font-medium mt-0.5", children: method.estimatedDaysMin && method.estimatedDaysMax
|
|
500
|
+
? `${method.estimatedDaysMin}-${method.estimatedDaysMax} days`
|
|
501
|
+
: `${method.estimatedDays} days` }))] })] }, method.code || index))) })) : shippingAddress.country && shippingAddress.city ? (_jsx("div", { className: "p-4 bg-gray-50 border border-gray-200 rounded-lg text-center", children: _jsx("p", { className: "text-sm text-gray-600", children: "No shipping methods available for this location." }) })) : (_jsx("div", { className: "p-4 bg-gray-50 border border-gray-200 rounded-lg text-center", children: _jsx("p", { className: "text-sm text-gray-600", children: "Enter your address above to see shipping options." }) }))] }), product.description && (_jsxs("div", { className: "mb-8", children: [_jsx("h2", { className: "text-lg font-semibold text-gray-900 mb-3", children: "Description" }), _jsxs("div", { className: "prose prose-sm max-w-none text-gray-600 leading-relaxed", children: [_jsx("p", { children: product.description }), _jsxs("ul", { className: "list-disc pl-5 space-y-1 mt-2", children: [_jsx("li", { children: "Premium quality material" }), _jsx("li", { children: "Comfortable fit for all-day wear" }), _jsx("li", { children: "Durable stitching and finish" })] })] })] })), product.specifications && Object.keys(product.specifications).length > 0 && (_jsxs("div", { className: "mb-8", children: [_jsx("h2", { className: "text-lg font-semibold text-gray-900 mb-4", children: "Specifications" }), _jsx("dl", { className: "grid grid-cols-1 sm:grid-cols-2 gap-x-4 gap-y-4", children: Object.entries(product.specifications).map(([key, value]) => (_jsxs("div", { className: "flex flex-col p-3 bg-gray-50 rounded-lg", children: [_jsx("dt", { className: "text-xs text-gray-500 font-medium uppercase tracking-wider mb-1", children: key }), _jsx("dd", { className: "text-sm font-bold text-gray-900", children: value })] }, key))) })] }))] })] }), _jsx("div", { className: "mt-20 pt-16 border-t border-gray-200", children: _jsxs("div", { className: "max-w-4xl", children: [_jsxs("div", { className: "flex flex-col sm:flex-row items-start sm:items-center justify-between gap-6 mb-10", children: [_jsxs("div", { className: "flex-1", children: [_jsx("h2", { className: "text-2xl lg:text-3xl font-bold text-gray-900 mb-4", children: "Customer Reviews" }), product.reviewCount && product.reviewCount > 0 && product.rating && product.rating > 0 ? (_jsxs("div", { className: "flex items-center gap-4", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(StarRating, { rating: typeof product.rating === 'number' ? product.rating : Number(product.rating) || 0, size: "lg" }), _jsx("span", { className: "text-2xl font-bold text-gray-900", children: Number(product.rating).toFixed(1) }), _jsx("span", { className: "text-lg text-gray-500", children: "out of 5" })] }), _jsx("span", { className: "text-gray-300", children: "|" }), _jsxs("span", { className: "text-lg text-gray-600", children: [product.reviewCount, " ", product.reviewCount === 1 ? 'review' : 'reviews'] })] })) : (_jsx("div", { className: "text-gray-500", children: _jsx("p", { className: "text-base", children: "Be the first to review this product" }) }))] }), _jsx(Button, { onClick: () => setIsReviewModalOpen(true), className: "rounded-full shrink-0 bg-gray-900 hover:bg-gray-800 text-white", children: product.reviewCount && product.reviewCount > 0 ? 'Write a Review' : 'Be the First to Review' })] }), ratingDistribution.some(r => r.count > 0) && (_jsxs("div", { className: "mb-10 p-6 bg-gray-50 rounded-xl border border-gray-100", children: [_jsx("h3", { className: "text-sm font-semibold text-gray-900 mb-5", children: "Rating Breakdown" }), _jsx("div", { className: "space-y-3", children: ratingDistribution.map(({ rating, count, percentage }) => (_jsxs("div", { className: "flex items-center gap-4", children: [_jsxs("div", { className: "flex items-center gap-1.5 w-20", children: [_jsx("span", { className: "text-sm font-semibold text-gray-900", children: rating }), _jsx(Star, { className: "h-4 w-4 fill-gray-900 text-gray-900" })] }), _jsx("div", { className: "flex-1 h-2.5 bg-gray-200 rounded-full overflow-hidden", children: _jsx("div", { className: "h-full bg-gradient-to-r from-gray-700 to-gray-900 rounded-full transition-all duration-500", style: { width: `${percentage}%` } }) }), _jsx("span", { className: "text-sm font-medium text-gray-700 w-12 text-right", children: count })] }, rating))) })] })), reviews.length > 0 ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "space-y-6", children: displayedReviews.map((review) => (_jsx(ReviewCard, { review: review }, review.id))) }), hasMoreReviews && !showAllReviews && (_jsx("div", { className: "mt-8 text-center", children: _jsxs(Button, { variant: "outline", onClick: () => setShowAllReviews(true), className: "px-8 rounded-full h-12 border-gray-300", children: ["Show All ", reviews.length, " Reviews"] }) }))] })) : (_jsxs("div", { className: "text-center py-12 bg-gray-50 rounded-xl border border-dashed border-gray-300", children: [_jsx("div", { className: "inline-flex items-center justify-center w-12 h-12 rounded-full bg-white shadow-sm mb-4", children: _jsx(Star, { className: "h-6 w-6 text-gray-400" }) }), _jsx("h3", { className: "text-lg font-semibold text-gray-900 mb-2", children: "No Reviews Yet" }), _jsx("p", { className: "text-gray-500 max-w-sm mx-auto mb-6", children: "Be the first to review this product and help other customers make informed decisions." }), _jsx(Button, { onClick: () => setIsReviewModalOpen(true), className: "bg-gray-900 hover:bg-gray-800 text-white", children: "Write the First Review" })] }))] }) }), relatedProducts.length > 0 && (_jsxs("div", { className: "mt-20 pt-16 border-t border-gray-200", children: [_jsx("h2", { className: "text-2xl lg:text-3xl font-bold text-gray-900 mb-8", children: "You Might Also Like" }), _jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-6", children: relatedProducts.map((relatedProduct) => (_jsx("div", { className: "h-[400px]", children: _jsx(ProductCard, { product: relatedProduct, storeSlug: storeConfig.slug, onAddToCart: (p) => addToCart(p, 1), onQuickView: handleQuickView, className: "h-full" }) }, relatedProduct.id))) })] }))] }), _jsx(Modal, { isOpen: isReviewModalOpen, onClose: () => setIsReviewModalOpen(false), title: "Write a Review", children: _jsxs("form", { onSubmit: handleSubmitReview, className: "space-y-4", children: [_jsxs("div", { children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: "Rating" }), _jsxs("div", { className: "flex items-center gap-1", children: [[1, 2, 3, 4, 5].map((star) => (_jsxs("div", { className: "relative group", children: [_jsx("button", { type: "button", onClick: () => setNewReview({ ...newReview, rating: star - 0.5 }), className: "absolute top-0 left-0 w-1/2 h-full z-20 focus:outline-none", title: `${star - 0.5} stars` }), _jsx("button", { type: "button", onClick: () => setNewReview({ ...newReview, rating: star }), className: "absolute top-0 right-0 w-1/2 h-full z-20 focus:outline-none", title: `${star} stars` }), _jsxs("div", { className: "relative pointer-events-none transition-transform group-hover:scale-110", children: [_jsx(Star, { className: "h-8 w-8 text-gray-200 fill-gray-200" }), newReview.rating >= star - 0.5 && (_jsx("div", { className: "absolute inset-0 overflow-hidden", style: { width: newReview.rating === star - 0.5 ? '50%' : '100%' }, children: _jsx(Star, { className: "h-8 w-8 text-gray-900 fill-gray-900" }) }))] })] }, star))), _jsx("span", { className: "ml-3 text-lg font-medium text-gray-900 w-12", children: newReview.rating })] })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "title", className: "block text-sm font-medium text-gray-700 mb-1", children: "Review Title" }), _jsx("input", { type: "text", id: "title", required: true, className: "w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-black", placeholder: "Summarize your thoughts", value: newReview.title, onChange: (e) => setNewReview({ ...newReview, title: e.target.value }) })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "comment", className: "block text-sm font-medium text-gray-700 mb-1", children: "Review" }), _jsx("textarea", { id: "comment", required: true, rows: 4, className: "w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-black", placeholder: "What did you like or dislike?", value: newReview.comment, onChange: (e) => setNewReview({ ...newReview, comment: e.target.value }) })] }), _jsxs("div", { className: "pt-4 flex justify-end gap-3", children: [_jsx(Button, { type: "button", variant: "outline", onClick: () => setIsReviewModalOpen(false), children: "Cancel" }), _jsx(Button, { type: "submit", className: "bg-black text-white hover:bg-gray-800", children: "Submit Review" })] })] }) }), _jsx(GuestCheckoutModal, { isOpen: showGuestModal, onClose: () => setShowGuestModal(false), onSubmit: handleGuestInfoSubmit, initialData: getGuestUserInfo() || undefined })] }));
|
|
502
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { StoreConfig } from '../../../lib/store-types';
|
|
2
|
+
interface ProductsPageProps {
|
|
3
|
+
storeConfig: StoreConfig;
|
|
4
|
+
}
|
|
5
|
+
export declare function ProductsPage(props: ProductsPageProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=ProductsPage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductsPage.d.ts","sourceRoot":"","sources":["../../../../src/layouts/food/pages/ProductsPage.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAgB,MAAM,mBAAmB,CAAC;AAqB9D,UAAU,iBAAiB;IACzB,WAAW,EAAE,WAAW,CAAC;CAC1B;AAwvBD,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,2CAMpD"}
|