@salla.sa/twilight-theme-engine 1.0.84 → 1.0.86
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/dist/{AddToCartForm-JUMFLSKN.js → AddToCartForm-5X2WZDWR.js} +3 -3
- package/dist/{AddToCartForm-JUMFLSKN.js.map → AddToCartForm-5X2WZDWR.js.map} +1 -1
- package/dist/{BlogAuthorPage-LFAUMKC7.js → BlogAuthorPage-LO7FSSJR.js} +12 -10
- package/dist/BlogAuthorPage-LO7FSSJR.js.map +1 -0
- package/dist/{BlogCategoryPage-NWYFFPCD.js → BlogCategoryPage-KKFQ3PGR.js} +12 -10
- package/dist/BlogCategoryPage-KKFQ3PGR.js.map +1 -0
- package/dist/{BlogPage-BOHXFV7E.js → BlogPage-VLF3NSGE.js} +11 -9
- package/dist/BlogPage-VLF3NSGE.js.map +1 -0
- package/dist/{BlogSinglePage-FYEXQPMB.js → BlogSinglePage-AVK535IW.js} +11 -9
- package/dist/BlogSinglePage-AVK535IW.js.map +1 -0
- package/dist/{BlogTagPage-DAM3RNVA.js → BlogTagPage-F3T4D7RH.js} +12 -10
- package/dist/BlogTagPage-F3T4D7RH.js.map +1 -0
- package/dist/{BrandsPage-GAKQCE6O.js → BrandsPage-LVSBZSVC.js} +11 -9
- package/dist/BrandsPage-LVSBZSVC.js.map +1 -0
- package/dist/{Breadcrumb-NAYSZNRV.js → Breadcrumb-VLFTXRFC.js} +11 -9
- package/dist/Breadcrumb-VLFTXRFC.js.map +1 -0
- package/dist/{CartItem-ZRVLIZT3.js → CartItem-G3H34GW6.js} +11 -9
- package/dist/CartItem-G3H34GW6.js.map +1 -0
- package/dist/{CartSummary-U2TVLG35.js → CartSummary-VH37RPUI.js} +11 -9
- package/dist/CartSummary-VH37RPUI.js.map +1 -0
- package/dist/{Copyright-2LSBADZD.js → Copyright-HE5ZWINZ.js} +3 -3
- package/dist/{Copyright-2LSBADZD.js.map → Copyright-HE5ZWINZ.js.map} +1 -1
- package/dist/{CustomerLayout-WSKXWI7D.js → CustomerLayout-LKBLOAVW.js} +11 -9
- package/dist/CustomerLayout-LKBLOAVW.js.map +1 -0
- package/dist/{Footer-ONNRJU4G.js → Footer-HHXAST72.js} +5 -5
- package/dist/{Footer-ONNRJU4G.js.map → Footer-HHXAST72.js.map} +1 -1
- package/dist/{Header-C6VXLLUC.js → Header-GEVZM2YG.js} +8 -6
- package/dist/{Header-C6VXLLUC.js.map → Header-GEVZM2YG.js.map} +1 -1
- package/dist/{LoyaltyPage-IG5KSYNO.js → LoyaltyPage-M5CT3CFD.js} +11 -9
- package/dist/LoyaltyPage-M5CT3CFD.js.map +1 -0
- package/dist/{LoyaltyPointsPage-RKO56ZER.js → LoyaltyPointsPage-SDJB52U6.js} +10 -3
- package/dist/LoyaltyPointsPage-SDJB52U6.js.map +1 -0
- package/dist/{MainMenu-USOYTKPU.js → MainMenu-I7EYS752.js} +3 -3
- package/dist/{MainMenu-USOYTKPU.js.map → MainMenu-I7EYS752.js.map} +1 -1
- package/dist/{MasterLayout-2W24ACEK.js → MasterLayout-QDK4T3NE.js} +11 -9
- package/dist/{MasterLayout-2W24ACEK.js.map → MasterLayout-QDK4T3NE.js.map} +1 -1
- package/dist/{MobileMenu-E4X2GOZ3.js → MobileMenu-7VTCWAVJ.js} +11 -9
- package/dist/MobileMenu-7VTCWAVJ.js.map +1 -0
- package/dist/{NotificationsPage-BJ5XVWEG.js → NotificationsPage-QCABE6QD.js} +11 -9
- package/dist/NotificationsPage-QCABE6QD.js.map +1 -0
- package/dist/{OrderSinglePage-544E36FJ.js → OrderSinglePage-2HVBKBG4.js} +11 -9
- package/dist/OrderSinglePage-2HVBKBG4.js.map +1 -0
- package/dist/{OrdersPage-AFBWVTZU.js → OrdersPage-5MNCPCM3.js} +11 -9
- package/dist/OrdersPage-5MNCPCM3.js.map +1 -0
- package/dist/{PageSingle-H2EJIL74.js → PageSingle-EN5XIM2B.js} +3 -3
- package/dist/{PageSingle-H2EJIL74.js.map → PageSingle-EN5XIM2B.js.map} +1 -1
- package/dist/{ProductDetails-SDZHALU6.js → ProductDetails-UEWQPPDZ.js} +13 -6
- package/dist/ProductDetails-UEWQPPDZ.js.map +1 -0
- package/dist/{ProfilePage-V5KV6GQK.js → ProfilePage-TZSU3GHZ.js} +11 -9
- package/dist/ProfilePage-TZSU3GHZ.js.map +1 -0
- package/dist/{ReviewsPage-CXKJABXP.js → ReviewsPage-WYZ6CHF2.js} +3 -3
- package/dist/{ReviewsPage-CXKJABXP.js.map → ReviewsPage-WYZ6CHF2.js.map} +1 -1
- package/dist/{SeoCartWidget-JAV6M3X5.js → SeoCartWidget-5JR5RXQM.js} +11 -9
- package/dist/SeoCartWidget-5JR5RXQM.js.map +1 -0
- package/dist/{SettingsPage-43SUCLQR.js → SettingsPage-DIDRQXMM.js} +11 -9
- package/dist/SettingsPage-DIDRQXMM.js.map +1 -0
- package/dist/{StoreClosedNotification-MINBJOGZ.js → StoreClosedNotification-C2G32E34.js} +12 -10
- package/dist/{StoreClosedNotification-MINBJOGZ.js.map → StoreClosedNotification-C2G32E34.js.map} +1 -1
- package/dist/{TestimonialsPage-RLLIDLOA.js → TestimonialsPage-XPHFRBZ7.js} +3 -3
- package/dist/{TestimonialsPage-RLLIDLOA.js.map → TestimonialsPage-XPHFRBZ7.js.map} +1 -1
- package/dist/{ThankYouPage-52SSZ7FV.js → ThankYouPage-UA6YYFB2.js} +11 -9
- package/dist/ThankYouPage-UA6YYFB2.js.map +1 -0
- package/dist/{WalletPage-4AN4UJ52.js → WalletPage-AJVV7LVL.js} +11 -9
- package/dist/WalletPage-AJVV7LVL.js.map +1 -0
- package/dist/{WishlistPage-L6IYJUJZ.js → WishlistPage-UW6LJLSW.js} +11 -9
- package/dist/WishlistPage-UW6LJLSW.js.map +1 -0
- package/dist/api/advertisement.d.ts +33 -0
- package/dist/api/advertisement.d.ts.map +1 -0
- package/dist/api/advertisement.js +8 -0
- package/dist/api/advertisement.js.map +1 -0
- package/dist/boot/critical-style.d.ts +3 -0
- package/dist/boot/critical-style.d.ts.map +1 -0
- package/dist/boot/index.d.ts +15 -0
- package/dist/boot/index.d.ts.map +1 -0
- package/dist/boot.d.ts +1 -0
- package/dist/boot.js +69 -0
- package/dist/boot.js.map +1 -0
- package/dist/{chunk-R5BQDCDK.js → chunk-2HCCIHU7.js} +4 -4
- package/dist/{chunk-R5BQDCDK.js.map → chunk-2HCCIHU7.js.map} +1 -1
- package/dist/chunk-4FJGZQD3.js +6 -0
- package/dist/chunk-4FJGZQD3.js.map +1 -0
- package/dist/{chunk-UNEZZMQA.js → chunk-4WVJJ7SN.js} +20 -4
- package/dist/chunk-4WVJJ7SN.js.map +1 -0
- package/dist/{chunk-FFWSQJLV.js → chunk-BAYGWTNM.js} +3 -3
- package/dist/{chunk-FFWSQJLV.js.map → chunk-BAYGWTNM.js.map} +1 -1
- package/dist/{chunk-WSRVPR7V.js → chunk-CLBFF2CY.js} +3 -3
- package/dist/{chunk-WSRVPR7V.js.map → chunk-CLBFF2CY.js.map} +1 -1
- package/dist/chunk-DBW7XXNE.js +103 -0
- package/dist/chunk-DBW7XXNE.js.map +1 -0
- package/dist/{chunk-CCUE2FMU.js → chunk-DBXH3EMJ.js} +3 -3
- package/dist/{chunk-CCUE2FMU.js.map → chunk-DBXH3EMJ.js.map} +1 -1
- package/dist/{chunk-MECSOKS7.js → chunk-E26YG3AO.js} +4 -4
- package/dist/{chunk-MECSOKS7.js.map → chunk-E26YG3AO.js.map} +1 -1
- package/dist/{chunk-22SH7OVF.js → chunk-E7WWO3V3.js} +3 -3
- package/dist/{chunk-22SH7OVF.js.map → chunk-E7WWO3V3.js.map} +1 -1
- package/dist/{chunk-IC6XW3PD.js → chunk-HQ7WA37L.js} +7 -7
- package/dist/{chunk-IC6XW3PD.js.map → chunk-HQ7WA37L.js.map} +1 -1
- package/dist/chunk-IVBOLREE.js +29 -0
- package/dist/chunk-IVBOLREE.js.map +1 -0
- package/dist/{chunk-RRGEASAL.js → chunk-KP3VYG4F.js} +6 -6
- package/dist/{chunk-RRGEASAL.js.map → chunk-KP3VYG4F.js.map} +1 -1
- package/dist/{chunk-EFF2WO6W.js → chunk-PWTXR4RR.js} +10 -10
- package/dist/{chunk-EFF2WO6W.js.map → chunk-PWTXR4RR.js.map} +1 -1
- package/dist/chunk-QJYUTRAQ.js +14 -0
- package/dist/{chunk-4EA56R6I.js.map → chunk-QJYUTRAQ.js.map} +1 -1
- package/dist/{chunk-YFQUSAET.js → chunk-U55ZJC2X.js} +4 -4
- package/dist/{chunk-YFQUSAET.js.map → chunk-U55ZJC2X.js.map} +1 -1
- package/dist/{chunk-R54GSKJS.js → chunk-WSDG4ZRI.js} +30 -16
- package/dist/chunk-WSDG4ZRI.js.map +1 -0
- package/dist/{chunk-3PWARKZX.js → chunk-X54QP332.js} +8 -8
- package/dist/chunk-X54QP332.js.map +1 -0
- package/dist/components/cart/index.js +1 -1
- package/dist/components/common/index.js +1 -1
- package/dist/components/drawer/index.js +9 -7
- package/dist/components/home/HomePageRenderer.d.ts +6 -0
- package/dist/components/home/HomePageRenderer.d.ts.map +1 -1
- package/dist/components/home/index.js +11 -9
- package/dist/components/layout/PageAdvertisements.d.ts +7 -0
- package/dist/components/layout/PageAdvertisements.d.ts.map +1 -0
- package/dist/components/layout/index.d.ts +1 -0
- package/dist/components/layout/index.d.ts.map +1 -1
- package/dist/components/layout/index.js +8 -1
- package/dist/components/product/index.js +10 -8
- package/dist/components/store/index.js +11 -9
- package/dist/components/store/index.js.map +1 -1
- package/dist/{document-class-SD6BUMZN.js → document-class-7AXAAWGZ.js} +6 -5
- package/dist/{document-class-SD6BUMZN.js.map → document-class-7AXAAWGZ.js.map} +1 -1
- package/dist/hooks/index.js +9 -7
- package/dist/hooks/useGtm.js +9 -7
- package/dist/hooks/useMoney.js +9 -7
- package/dist/hooks/useStore.js +9 -7
- package/dist/index.js +9 -7
- package/dist/index.js.map +1 -1
- package/dist/{not-found-TUU7WQLL.js → not-found-3EEMQZMU.js} +11 -9
- package/dist/not-found-3EEMQZMU.js.map +1 -0
- package/dist/providers/index.js +9 -7
- package/dist/routes/account/orders.js +1 -1
- package/dist/routes/account.js +6 -6
- package/dist/routes/blog.js +5 -5
- package/dist/routes/brands.js +1 -1
- package/dist/routes/cart.js +13 -11
- package/dist/routes/cart.js.map +1 -1
- package/dist/routes/home.js +12 -10
- package/dist/routes/loyalty.js +2 -2
- package/dist/routes/page.js +1 -1
- package/dist/routes/product-listing.js +11 -9
- package/dist/routes/product-listing.js.map +1 -1
- package/dist/routes/product.js +11 -9
- package/dist/routes/product.js.map +1 -1
- package/dist/routes/root/beforeLoad.d.ts +2 -2
- package/dist/routes/root/beforeLoad.d.ts.map +1 -1
- package/dist/routes/root/head.d.ts.map +1 -1
- package/dist/routes/testimonials.js +2 -2
- package/dist/routes/thank-you.js +1 -1
- package/dist/skeleton.js +12 -10
- package/dist/tanstack/document-class.d.ts.map +1 -1
- package/dist/tanstack/index.d.ts +1 -0
- package/dist/tanstack/index.d.ts.map +1 -1
- package/dist/tanstack/stylesheet.d.ts +15 -0
- package/dist/tanstack/stylesheet.d.ts.map +1 -0
- package/dist/tanstack.js +34 -5
- package/dist/tanstack.js.map +1 -1
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/vite/index.js +1 -1
- package/package.json +12 -3
- package/tailwind/components/Component.tsx.txt +21 -0
- package/tailwind/components/ComponentRegistry.ts.txt +66 -0
- package/tailwind/components/cart/CartItem.tsx.txt +211 -0
- package/tailwind/components/cart/CartSummary.tsx.txt +269 -0
- package/tailwind/components/cart/PreOrderNotification.tsx.txt +16 -0
- package/tailwind/components/cart/PriceQuoteButton.tsx.txt +21 -0
- package/tailwind/components/cart/SeoCartWidget.tsx.txt +99 -0
- package/tailwind/components/cart/index.ts.txt +11 -0
- package/tailwind/components/cart/lazy.ts.txt +15 -0
- package/tailwind/components/collapse/Collapse.tsx.txt +95 -0
- package/tailwind/components/collapse/index.ts.txt +41 -0
- package/tailwind/components/common/Breadcrumb.tsx.txt +27 -0
- package/tailwind/components/common/BreadcrumbJsonLd.tsx.txt +40 -0
- package/tailwind/components/common/BreadcrumbTrail.tsx.txt +97 -0
- package/tailwind/components/common/CurrencySymbol.tsx.txt +8 -0
- package/tailwind/components/common/DeferredData.tsx.txt +122 -0
- package/tailwind/components/common/ErrorPage.tsx.txt +69 -0
- package/tailwind/components/common/Image.tsx.txt +119 -0
- package/tailwind/components/common/Link.tsx.txt +36 -0
- package/tailwind/components/common/Link.types.ts.txt +85 -0
- package/tailwind/components/common/NoContent.tsx.txt +27 -0
- package/tailwind/components/common/RenderWhenVisible.tsx.txt +92 -0
- package/tailwind/components/common/index.ts.txt +42 -0
- package/tailwind/components/common/lazy.ts.txt +28 -0
- package/tailwind/components/defineComponent.ts.txt +32 -0
- package/tailwind/components/drawer/Drawer.tsx.txt +219 -0
- package/tailwind/components/drawer/index.ts.txt +38 -0
- package/tailwind/components/dropdown/Dropdown.tsx.txt +166 -0
- package/tailwind/components/dropdown/index.ts.txt +40 -0
- package/tailwind/components/home/BundleComponent.tsx.txt +35 -0
- package/tailwind/components/home/ComponentErrorBoundary.tsx.txt +98 -0
- package/tailwind/components/home/FeaturedProductsStyle1.tsx.txt +125 -0
- package/tailwind/components/home/FeaturedProductsStyle2.tsx.txt +127 -0
- package/tailwind/components/home/FeaturedProductsStyle3.tsx.txt +71 -0
- package/tailwind/components/home/FixedBanner.tsx.txt +68 -0
- package/tailwind/components/home/FixedProducts.tsx.txt +72 -0
- package/tailwind/components/home/HomePageRenderer.tsx.txt +284 -0
- package/tailwind/components/home/PageBlocks.tsx.txt +24 -0
- package/tailwind/components/home/ParallaxBackground.tsx.txt +50 -0
- package/tailwind/components/home/PhotosSlider.tsx.txt +61 -0
- package/tailwind/components/home/ProductsSlider.tsx.txt +87 -0
- package/tailwind/components/home/ReorderProducts.tsx.txt +38 -0
- package/tailwind/components/home/SquarePhotos.tsx.txt +68 -0
- package/tailwind/components/home/StoreFeatures.tsx.txt +34 -0
- package/tailwind/components/home/Testimonials.tsx.txt +36 -0
- package/tailwind/components/home/Youtube.tsx.txt +48 -0
- package/tailwind/components/home/index.ts.txt +50 -0
- package/tailwind/components/home/lazy.ts.txt +17 -0
- package/tailwind/components/home/register.ts.txt +44 -0
- package/tailwind/components/home/reorder-hooks.ts.txt +52 -0
- package/tailwind/components/home/types.ts.txt +4 -0
- package/tailwind/components/layout/Copyright.tsx.txt +23 -0
- package/tailwind/components/layout/CustomerLayout.tsx.txt +91 -0
- package/tailwind/components/layout/Footer.tsx.txt +343 -0
- package/tailwind/components/layout/Header.tsx.txt +154 -0
- package/tailwind/components/layout/MasterLayout.tsx.txt +63 -0
- package/tailwind/components/layout/PageAdvertisements.tsx.txt +131 -0
- package/tailwind/components/layout/WidgetHead.tsx.txt +53 -0
- package/tailwind/components/layout/index.ts.txt +27 -0
- package/tailwind/components/layout/lazy.ts.txt +25 -0
- package/tailwind/components/layout/types.ts.txt +11 -0
- package/tailwind/components/modal/ImageModal.tsx.txt +70 -0
- package/tailwind/components/modal/Modal.tsx.txt +245 -0
- package/tailwind/components/modal/index.ts.txt +39 -0
- package/tailwind/components/modal/lazy.ts.txt +10 -0
- package/tailwind/components/navigation/MainMenu.tsx.txt +94 -0
- package/tailwind/components/navigation/MobileMenu.tsx.txt +160 -0
- package/tailwind/components/navigation/index.ts.txt +4 -0
- package/tailwind/components/navigation/lazy.ts.txt +11 -0
- package/tailwind/components/product/AddToCartForm.tsx.txt +365 -0
- package/tailwind/components/product/ProductCard.tsx.txt +305 -0
- package/tailwind/components/product/ProductDetails.tsx.txt +267 -0
- package/tailwind/components/product/ProductGallery.tsx.txt +234 -0
- package/tailwind/components/product/index.ts.txt +15 -0
- package/tailwind/components/product/lazy.ts.txt +9 -0
- package/tailwind/components/snippets/AppsSnippets.tsx.txt +225 -0
- package/tailwind/components/snippets/SallaSdkScripts.tsx.txt +14 -0
- package/tailwind/components/snippets/index.ts.txt +4 -0
- package/tailwind/components/store/StoreClosedNotification.tsx.txt +73 -0
- package/tailwind/components/store/index.ts.txt +8 -0
- package/tailwind/components/store/lazy.ts.txt +8 -0
- package/tailwind/components/toast/Toaster.tsx.txt +177 -0
- package/tailwind/components/toast/index.ts.txt +10 -0
- package/tailwind/components/toast/types.ts.txt +38 -0
- package/tailwind/components/toast/useToast.ts.txt +61 -0
- package/tailwind/components/tracking/GoogleTag.tsx.txt +77 -0
- package/tailwind/components/tracking/SiftSnippet.tsx.txt +49 -0
- package/tailwind/components/tracking/TwilightBundles.tsx.txt +67 -0
- package/tailwind/components/tracking/index.ts.txt +11 -0
- package/tailwind/components/tracking/lazy.ts.txt +11 -0
- package/tailwind/components/useComponent.ts.txt +12 -0
- package/tailwind/routes/account/index.tsx.txt +16 -0
- package/tailwind/routes/account/notifications/NotificationsPage.tsx.txt +54 -0
- package/tailwind/routes/account/notifications/index.tsx.txt +39 -0
- package/tailwind/routes/account/notifications/loader.ts.txt +22 -0
- package/tailwind/routes/account/notifications/types.ts.txt +18 -0
- package/tailwind/routes/account/orders/OrderSinglePage.tsx.txt +181 -0
- package/tailwind/routes/account/orders/OrdersPage.tsx.txt +28 -0
- package/tailwind/routes/account/orders/index.tsx.txt +86 -0
- package/tailwind/routes/account/orders/loader.ts.txt +66 -0
- package/tailwind/routes/account/orders/single/OrderActions.tsx.txt +197 -0
- package/tailwind/routes/account/orders/single/OrderHeader.tsx.txt +143 -0
- package/tailwind/routes/account/orders/single/OrderItemRow.tsx.txt +209 -0
- package/tailwind/routes/account/orders/single/OrderSections.tsx.txt +215 -0
- package/tailwind/routes/account/orders/single/types.ts.txt +38 -0
- package/tailwind/routes/account/orders/types.ts.txt +29 -0
- package/tailwind/routes/account/profile/ProfilePage.tsx.txt +30 -0
- package/tailwind/routes/account/profile/index.tsx.txt +39 -0
- package/tailwind/routes/account/profile/loader.ts.txt +16 -0
- package/tailwind/routes/account/profile/types.ts.txt +5 -0
- package/tailwind/routes/account/settings/SettingsPage.tsx.txt +13 -0
- package/tailwind/routes/account/settings/index.tsx.txt +39 -0
- package/tailwind/routes/account/settings/loader.ts.txt +13 -0
- package/tailwind/routes/account/settings/types.ts.txt +5 -0
- package/tailwind/routes/account/types.ts.txt +320 -0
- package/tailwind/routes/account/wallet/WalletPage.tsx.txt +195 -0
- package/tailwind/routes/account/wallet/index.tsx.txt +38 -0
- package/tailwind/routes/account/wallet/loader.ts.txt +27 -0
- package/tailwind/routes/account/wallet/types.ts.txt +11 -0
- package/tailwind/routes/account/wishlist/WishlistPage.tsx.txt +314 -0
- package/tailwind/routes/account/wishlist/WishlistShare.tsx.txt +248 -0
- package/tailwind/routes/account/wishlist/index.tsx.txt +40 -0
- package/tailwind/routes/account/wishlist/loader.ts.txt +26 -0
- package/tailwind/routes/account/wishlist/types.ts.txt +9 -0
- package/tailwind/routes/blog/BlogAuthorPage.tsx.txt +82 -0
- package/tailwind/routes/blog/BlogCategoryPage.tsx.txt +84 -0
- package/tailwind/routes/blog/BlogPage.tsx.txt +191 -0
- package/tailwind/routes/blog/BlogSinglePage.tsx.txt +168 -0
- package/tailwind/routes/blog/BlogTagPage.tsx.txt +84 -0
- package/tailwind/routes/blog/BlogTags.tsx.txt +54 -0
- package/tailwind/routes/blog/components.tsx.txt +87 -0
- package/tailwind/routes/blog/index.tsx.txt +238 -0
- package/tailwind/routes/blog/loader.ts.txt +173 -0
- package/tailwind/routes/blog/types.ts.txt +106 -0
- package/tailwind/routes/brands/BrandsPage.tsx.txt +179 -0
- package/tailwind/routes/brands/index.tsx.txt +47 -0
- package/tailwind/routes/brands/loader.ts.txt +14 -0
- package/tailwind/routes/brands/types.ts.txt +53 -0
- package/tailwind/routes/cart/CartPage.tsx.txt +112 -0
- package/tailwind/routes/cart/index.tsx.txt +39 -0
- package/tailwind/routes/cart/loader.ts.txt +15 -0
- package/tailwind/routes/cart/types.ts.txt +6 -0
- package/tailwind/routes/home/HomePage.tsx.txt +53 -0
- package/tailwind/routes/home/index.tsx.txt +56 -0
- package/tailwind/routes/home/loader.ts.txt +24 -0
- package/tailwind/routes/home/types.ts.txt +11 -0
- package/tailwind/routes/index.ts.txt +94 -0
- package/tailwind/routes/lazy.ts.txt +105 -0
- package/tailwind/routes/loyalty/LoyaltyPage.tsx.txt +17 -0
- package/tailwind/routes/loyalty/LoyaltyPointsPage.tsx.txt +11 -0
- package/tailwind/routes/loyalty/index.tsx.txt +81 -0
- package/tailwind/routes/loyalty/loader.ts.txt +53 -0
- package/tailwind/routes/loyalty/types.ts.txt +109 -0
- package/tailwind/routes/not-found.tsx.txt +50 -0
- package/tailwind/routes/page/PageSingle.tsx.txt +34 -0
- package/tailwind/routes/page/index.tsx.txt +60 -0
- package/tailwind/routes/page/loader.ts.txt +19 -0
- package/tailwind/routes/page/types.ts.txt +34 -0
- package/tailwind/routes/product/ProductPage.tsx.txt +77 -0
- package/tailwind/routes/product/index.tsx.txt +157 -0
- package/tailwind/routes/product/loader.ts.txt +35 -0
- package/tailwind/routes/product/types.ts.txt +6 -0
- package/tailwind/routes/product-listing/ProductListPage.tsx.txt +321 -0
- package/tailwind/routes/product-listing/index.tsx.txt +95 -0
- package/tailwind/routes/product-listing/loader.ts.txt +323 -0
- package/tailwind/routes/product-listing/types.ts.txt +96 -0
- package/tailwind/routes/product-listing/useAppliedFilters.ts.txt +130 -0
- package/tailwind/routes/product-short-link.ts.txt +104 -0
- package/tailwind/routes/root/beforeLoad.ts.txt +354 -0
- package/tailwind/routes/root/head.ts.txt +424 -0
- package/tailwind/routes/root/index.ts.txt +2 -0
- package/tailwind/routes/seo-redirects.ts.txt +82 -0
- package/tailwind/routes/testimonials/ReviewsPage.tsx.txt +12 -0
- package/tailwind/routes/testimonials/TestimonialsPage.tsx.txt +80 -0
- package/tailwind/routes/testimonials/index.tsx.txt +80 -0
- package/tailwind/routes/testimonials/loader.ts.txt +29 -0
- package/tailwind/routes/testimonials/types.ts.txt +9 -0
- package/tailwind/routes/thank-you/ThankYouPage.tsx.txt +241 -0
- package/tailwind/routes/thank-you/index.tsx.txt +49 -0
- package/tailwind/routes/thank-you/loader.ts.txt +40 -0
- package/tailwind/routes/thank-you/types.ts.txt +16 -0
- package/tailwind/routes/types.ts.txt +41 -0
- package/dist/BlogAuthorPage-LFAUMKC7.js.map +0 -1
- package/dist/BlogCategoryPage-NWYFFPCD.js.map +0 -1
- package/dist/BlogPage-BOHXFV7E.js.map +0 -1
- package/dist/BlogSinglePage-FYEXQPMB.js.map +0 -1
- package/dist/BlogTagPage-DAM3RNVA.js.map +0 -1
- package/dist/BrandsPage-GAKQCE6O.js.map +0 -1
- package/dist/Breadcrumb-NAYSZNRV.js.map +0 -1
- package/dist/CartItem-ZRVLIZT3.js.map +0 -1
- package/dist/CartSummary-U2TVLG35.js.map +0 -1
- package/dist/CustomerLayout-WSKXWI7D.js.map +0 -1
- package/dist/LoyaltyPage-IG5KSYNO.js.map +0 -1
- package/dist/LoyaltyPointsPage-RKO56ZER.js.map +0 -1
- package/dist/MobileMenu-E4X2GOZ3.js.map +0 -1
- package/dist/NotificationsPage-BJ5XVWEG.js.map +0 -1
- package/dist/OrderSinglePage-544E36FJ.js.map +0 -1
- package/dist/OrdersPage-AFBWVTZU.js.map +0 -1
- package/dist/ProductDetails-SDZHALU6.js.map +0 -1
- package/dist/ProfilePage-V5KV6GQK.js.map +0 -1
- package/dist/SeoCartWidget-JAV6M3X5.js.map +0 -1
- package/dist/SettingsPage-43SUCLQR.js.map +0 -1
- package/dist/ThankYouPage-52SSZ7FV.js.map +0 -1
- package/dist/WalletPage-4AN4UJ52.js.map +0 -1
- package/dist/WishlistPage-L6IYJUJZ.js.map +0 -1
- package/dist/chunk-3PWARKZX.js.map +0 -1
- package/dist/chunk-4EA56R6I.js +0 -14
- package/dist/chunk-R54GSKJS.js.map +0 -1
- package/dist/chunk-UNEZZMQA.js.map +0 -1
- package/dist/not-found-TUU7WQLL.js.map +0 -1
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { SallaButton } from '@salla.sa/twilight-components-react/button';
|
|
2
|
+
import { SallaRatingModal } from '@salla.sa/twilight-components-react/rating-modal';
|
|
3
|
+
import { SallaEditOrderButton } from '@salla.sa/twilight-components-react/edit-order-button';
|
|
4
|
+
import { SallaOrderBranch } from '@salla.sa/twilight-components-react/order-branch';
|
|
5
|
+
import { SallaOrderTotalsCard } from '@salla.sa/twilight-components-react/order-totals-card';
|
|
6
|
+
import { HookSlot, usePageConfig } from '../../../hooks';
|
|
7
|
+
import { useMoney } from '../../../hooks/useMoney';
|
|
8
|
+
import { useTranslation } from '../../../providers/I18nProvider';
|
|
9
|
+
import { useTwilight } from '../../../providers/twilight-context';
|
|
10
|
+
import type { OrderSinglePageProps } from '../types';
|
|
11
|
+
import { OrderHeader } from './single/OrderHeader';
|
|
12
|
+
import { OrderItemRow } from './single/OrderItemRow';
|
|
13
|
+
import { OrderActions } from './single/OrderActions';
|
|
14
|
+
import { OrderOptionsTable, RatingSection, ShippingHeader } from './single/OrderSections';
|
|
15
|
+
import type { TwigOrder } from './single/types';
|
|
16
|
+
|
|
17
|
+
/** Twig's `inner_title` extras: the gift tag and the edit-order button. */
|
|
18
|
+
function TitleRow({ order }: { order: OrderSinglePageProps['order'] }) {
|
|
19
|
+
const { t } = useTranslation();
|
|
20
|
+
return (
|
|
21
|
+
<div className="flex justify-between items-center">
|
|
22
|
+
{order.type === 'buy_as_gift' || order.source?.type === 'buy_as_gift' ? (
|
|
23
|
+
<span className="inline-block text-primary">
|
|
24
|
+
<i className="sicon-gift-sharing"></i> {t('pages.orders.gift_tag')}
|
|
25
|
+
</span>
|
|
26
|
+
) : (
|
|
27
|
+
<span />
|
|
28
|
+
)}
|
|
29
|
+
<div className="flex items-center gap-3 flex-wrap">
|
|
30
|
+
<SallaEditOrderButton data-testid="store-order-edit-btn" orderId={String(order.id)} />
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function RefundMessage({ message }: { message?: string }) {
|
|
37
|
+
if (!message) return null;
|
|
38
|
+
return (
|
|
39
|
+
<div className="min-w-full rounded-md overflow-hidden">
|
|
40
|
+
<div className="bg-white flex items-center gap-1 rounded-md px-3 py-5 md:px-5">
|
|
41
|
+
<i className="sicon-refund h-6 w-6"></i>
|
|
42
|
+
<p className="font-medium text-base" dangerouslySetInnerHTML={{ __html: message }} />
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function RatingNotices({ twig }: { twig: TwigOrder }) {
|
|
49
|
+
const { t } = useTranslation();
|
|
50
|
+
const { store } = useTwilight();
|
|
51
|
+
const settings = store?.settings?.rating;
|
|
52
|
+
const rated = !!twig.rating && !Array.isArray(twig.rating);
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<>
|
|
56
|
+
{settings?.allow_update && rated && (
|
|
57
|
+
<div className="flex items-start gap-2 bg-blue-50 border border-blue-200 text-blue-500 px-2 py-3 rounded-md text-sm">
|
|
58
|
+
<i className="sicon-info"></i>
|
|
59
|
+
<p>
|
|
60
|
+
{t('pages.order.can_edit_or_delete_your_review_within')} {settings.update_period}{' '}
|
|
61
|
+
{t('pages.order.days_since_added')}.
|
|
62
|
+
</p>
|
|
63
|
+
</div>
|
|
64
|
+
)}
|
|
65
|
+
{twig.can_rate && (
|
|
66
|
+
<div className="rating-header gradient-bg center-between">
|
|
67
|
+
<div>
|
|
68
|
+
<h2 className="font-bold mb-1">{t('pages.order.order_rating_title')}</h2>
|
|
69
|
+
<p className="text-sm">{t('pages.order.order_rating_message')}</p>
|
|
70
|
+
</div>
|
|
71
|
+
<SallaButton
|
|
72
|
+
data-testid="store-order-rate-btn"
|
|
73
|
+
color="light"
|
|
74
|
+
className="btn--rounded-full !text-primary"
|
|
75
|
+
onClick={() => window.salla?.event?.dispatch('rating::open')}
|
|
76
|
+
>
|
|
77
|
+
{t('pages.rating.rate')}
|
|
78
|
+
</SallaButton>
|
|
79
|
+
</div>
|
|
80
|
+
)}
|
|
81
|
+
</>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function OrderRatings({ twig }: { twig: TwigOrder }) {
|
|
86
|
+
const { t } = useTranslation();
|
|
87
|
+
const { store } = useTwilight();
|
|
88
|
+
const allowUpdate = !!store?.settings?.rating?.allow_update;
|
|
89
|
+
const rating = Array.isArray(twig.rating) ? undefined : twig.rating;
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<>
|
|
93
|
+
{rating?.store?.stars ? (
|
|
94
|
+
<RatingSection
|
|
95
|
+
title={t('pages.rating.rate_the_store')}
|
|
96
|
+
rating={rating.store}
|
|
97
|
+
type="store"
|
|
98
|
+
allowUpdate={allowUpdate}
|
|
99
|
+
/>
|
|
100
|
+
) : null}
|
|
101
|
+
{rating?.shipping?.stars ? (
|
|
102
|
+
<RatingSection
|
|
103
|
+
title={t('pages.rating.rate_shipping')}
|
|
104
|
+
rating={rating.shipping}
|
|
105
|
+
type="shipping"
|
|
106
|
+
allowUpdate={allowUpdate}
|
|
107
|
+
/>
|
|
108
|
+
) : null}
|
|
109
|
+
</>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* The order page as the Twig storefront renders it (Raed's `pages/customer/orders/single.twig`).
|
|
115
|
+
* The markup and the Twilight components read the order in Twig's shape (`componentsOrder`);
|
|
116
|
+
* `order` supplies what that shape lacks and Twig computed on the server: the actions and the
|
|
117
|
+
* receipt and payment URLs.
|
|
118
|
+
*/
|
|
119
|
+
export function OrderSinglePage({ order, page, componentsOrder }: OrderSinglePageProps) {
|
|
120
|
+
// The order components read the order id from `salla.config.page.id`, which the router
|
|
121
|
+
// only sets on client-side navigations — seed it so a direct load works too.
|
|
122
|
+
usePageConfig(page);
|
|
123
|
+
const { store } = useTwilight();
|
|
124
|
+
const { format } = useMoney();
|
|
125
|
+
const twig = (componentsOrder ?? { items: [] }) as unknown as TwigOrder;
|
|
126
|
+
const paymentExpired =
|
|
127
|
+
order.actions.payable && (order.payment?.pending_payment_ends_at ?? 0) === 0;
|
|
128
|
+
const money = (amount: number, currency?: string) => format(amount, { currency });
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
<div className="space-y-4">
|
|
132
|
+
<TitleRow order={order} />
|
|
133
|
+
|
|
134
|
+
<HookSlot name="customer:orders.single.details.start" />
|
|
135
|
+
|
|
136
|
+
<OrderHeader order={order} links={twig.links} paymentExpired={paymentExpired} />
|
|
137
|
+
|
|
138
|
+
{twig.is_pickable && <SallaOrderBranch data-testid="store-order-branch" stackCards />}
|
|
139
|
+
|
|
140
|
+
<RefundMessage message={order.refund_message} />
|
|
141
|
+
|
|
142
|
+
<RatingNotices twig={twig} />
|
|
143
|
+
|
|
144
|
+
<div className="overflow-hidden space-y-5">
|
|
145
|
+
<div className="shipping-orders">
|
|
146
|
+
<ShippingHeader twig={twig} order={order} />
|
|
147
|
+
{order.items.map((item, index) => (
|
|
148
|
+
<OrderItemRow
|
|
149
|
+
key={item.id}
|
|
150
|
+
item={item}
|
|
151
|
+
twigItem={twig.items[index]}
|
|
152
|
+
money={money}
|
|
153
|
+
currency={order.currency}
|
|
154
|
+
/>
|
|
155
|
+
))}
|
|
156
|
+
</div>
|
|
157
|
+
|
|
158
|
+
{!!twig.options?.length && (
|
|
159
|
+
<OrderOptionsTable options={twig.options} money={money} currency={order.currency} />
|
|
160
|
+
)}
|
|
161
|
+
</div>
|
|
162
|
+
|
|
163
|
+
{componentsOrder && (
|
|
164
|
+
<SallaOrderTotalsCard
|
|
165
|
+
data-testid="store-order-totals"
|
|
166
|
+
order={JSON.stringify(componentsOrder)}
|
|
167
|
+
/>
|
|
168
|
+
)}
|
|
169
|
+
|
|
170
|
+
<OrderActions order={order} paymentExpired={paymentExpired} />
|
|
171
|
+
|
|
172
|
+
<OrderRatings twig={twig} />
|
|
173
|
+
|
|
174
|
+
<HookSlot name="customer:orders.single.details.end" />
|
|
175
|
+
|
|
176
|
+
{(twig.can_rate || store?.settings?.rating?.allow_update) && (
|
|
177
|
+
<SallaRatingModal data-testid="store-order-rating-modal" />
|
|
178
|
+
)}
|
|
179
|
+
</div>
|
|
180
|
+
);
|
|
181
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SallaOrders } from '@salla.sa/twilight-components-react/orders';
|
|
2
|
+
import { HookSlot } from '../../../hooks';
|
|
3
|
+
import { useTranslation } from '../../../providers/I18nProvider';
|
|
4
|
+
import type { OrdersPageProps } from './types';
|
|
5
|
+
|
|
6
|
+
/** The orders list as the Twig storefront renders it: `<salla-orders>` loads and shows it. */
|
|
7
|
+
export function OrdersPage({ orders, query }: OrdersPageProps) {
|
|
8
|
+
const { t } = useTranslation();
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<>
|
|
12
|
+
<HookSlot name="customer:orders.index.items.start" />
|
|
13
|
+
{orders.length ? (
|
|
14
|
+
<SallaOrders
|
|
15
|
+
data-testid="store-orders-list"
|
|
16
|
+
// Typed as status ids; the API also takes the `pending` slug the loader uses.
|
|
17
|
+
params={query?.status ? ({ status: query.status } as never) : undefined}
|
|
18
|
+
/>
|
|
19
|
+
) : (
|
|
20
|
+
<div data-testid="store-orders-empty" className="no-content-placeholder">
|
|
21
|
+
<i className="sicon-packed-box icon"></i>
|
|
22
|
+
<p>{t('pages.orders.non_orders')}</p>
|
|
23
|
+
</div>
|
|
24
|
+
)}
|
|
25
|
+
<HookSlot name="customer:orders.index.items.end" />
|
|
26
|
+
</>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { HeadDescriptor } from '../../../utils/head';
|
|
2
|
+
import { buildHreflangAlternates } from '../../../utils/baseHead';
|
|
3
|
+
import { lazy } from 'react';
|
|
4
|
+
import { ordersLoader, orderSingleLoader } from './loader';
|
|
5
|
+
import type { OrdersPageProps, OrderSinglePageProps, OrdersSearchParams } from './types';
|
|
6
|
+
import type { IdParams } from '../../types';
|
|
7
|
+
import type { TwilightContext } from '../../../twilight/context';
|
|
8
|
+
import { RouteId } from '../../../router/route-ids';
|
|
9
|
+
|
|
10
|
+
// Lazy-load components for code-splitting
|
|
11
|
+
const LazyOrdersPage = lazy(() => import('./OrdersPage').then((m) => ({ default: m.OrdersPage })));
|
|
12
|
+
const LazyOrderSinglePage = lazy(() =>
|
|
13
|
+
import('./OrderSinglePage').then((m) => ({ default: m.OrderSinglePage }))
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
export const OrdersPage = LazyOrdersPage;
|
|
17
|
+
export const OrderSinglePage = LazyOrderSinglePage;
|
|
18
|
+
export { ordersLoader, orderSingleLoader } from './loader';
|
|
19
|
+
export type {
|
|
20
|
+
OrdersPageProps,
|
|
21
|
+
OrderSinglePageProps,
|
|
22
|
+
OrdersSearchParams,
|
|
23
|
+
OrdersQuery,
|
|
24
|
+
} from './types';
|
|
25
|
+
|
|
26
|
+
async function ordersLoaderWithExtend(
|
|
27
|
+
ctx: { search?: OrdersSearchParams; locale?: string; with_items?: boolean | number },
|
|
28
|
+
extend?: (
|
|
29
|
+
data: OrdersPageProps,
|
|
30
|
+
ctx: { params: Record<string, never> }
|
|
31
|
+
) => Promise<Record<string, unknown>> | Record<string, unknown>
|
|
32
|
+
): Promise<OrdersPageProps> {
|
|
33
|
+
const query = ctx.search;
|
|
34
|
+
// ordersLoader already merges the result of `extend`; calling it again here ran it twice.
|
|
35
|
+
return ordersLoader({ query, with_items: ctx.with_items }, extend);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function ordersHead(ctx: TwilightContext, data: OrdersPageProps): HeadDescriptor {
|
|
39
|
+
const isPending = data.query?.status === 'pending';
|
|
40
|
+
const base: HeadDescriptor = {
|
|
41
|
+
title: ctx.i18n.t(isPending ? 'common.titles.pending_orders' : 'common.titles.orders'),
|
|
42
|
+
description: data.page.description,
|
|
43
|
+
alternateLanguages: buildHreflangAlternates(ctx.settings, ctx.location.pathname),
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
return base;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async function orderSingleLoaderWithExtend(
|
|
50
|
+
ctx: { params: IdParams; locale?: string },
|
|
51
|
+
extend?: (
|
|
52
|
+
data: OrderSinglePageProps,
|
|
53
|
+
ctx: { params: IdParams }
|
|
54
|
+
) => Promise<Record<string, unknown>> | Record<string, unknown>
|
|
55
|
+
): Promise<OrderSinglePageProps> {
|
|
56
|
+
const data = await orderSingleLoader({ params: ctx.params });
|
|
57
|
+
|
|
58
|
+
if (extend) {
|
|
59
|
+
const extra = await extend(data, ctx);
|
|
60
|
+
return { ...data, ...extra } as OrderSinglePageProps;
|
|
61
|
+
}
|
|
62
|
+
return data;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function orderSingleHead(ctx: TwilightContext, data: OrderSinglePageProps): HeadDescriptor {
|
|
66
|
+
const base: HeadDescriptor = {
|
|
67
|
+
title: data.page.title,
|
|
68
|
+
description: data.page.description,
|
|
69
|
+
alternateLanguages: buildHreflangAlternates(ctx.settings, ctx.location.pathname),
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
return base;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export const Orders = {
|
|
76
|
+
id: RouteId.CUSTOMER_ORDERS_INDEX,
|
|
77
|
+
loader: ordersLoaderWithExtend,
|
|
78
|
+
head: ordersHead,
|
|
79
|
+
Component: LazyOrdersPage,
|
|
80
|
+
} as const;
|
|
81
|
+
export const OrderSingle = {
|
|
82
|
+
id: RouteId.CUSTOMER_ORDERS_SINGLE,
|
|
83
|
+
loader: orderSingleLoaderWithExtend,
|
|
84
|
+
head: orderSingleHead,
|
|
85
|
+
Component: LazyOrderSinglePage,
|
|
86
|
+
} as const;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { order } from '../../../api/order';
|
|
2
|
+
import { getTwilightContext } from '../../../twilight/context';
|
|
3
|
+
import { RouteId } from '../../../router/route-ids';
|
|
4
|
+
import { orThrow, orUnauthorized, unauthorized } from '../../../providers/NavigationProvider';
|
|
5
|
+
import { getAuthToken } from '../../../api/client';
|
|
6
|
+
import type { OrdersPageProps, OrderSinglePageProps, OrdersQuery } from './types';
|
|
7
|
+
import type { IdParams } from '../../types';
|
|
8
|
+
|
|
9
|
+
export async function ordersLoader(
|
|
10
|
+
ctx: { query?: OrdersQuery; with_items?: boolean | number },
|
|
11
|
+
extend?: (
|
|
12
|
+
data: OrdersPageProps,
|
|
13
|
+
ctx: { params: Record<string, never> }
|
|
14
|
+
) => Promise<Record<string, unknown>> | Record<string, unknown>
|
|
15
|
+
): Promise<OrdersPageProps> {
|
|
16
|
+
if (!getAuthToken()) throw unauthorized();
|
|
17
|
+
const query = ctx.query;
|
|
18
|
+
const isPending = query?.status === 'pending';
|
|
19
|
+
const response = await orUnauthorized(
|
|
20
|
+
order.list({
|
|
21
|
+
// Only decides the empty state; <salla-orders> applies its own review filter (`?tab=waiting`).
|
|
22
|
+
status: query?.status,
|
|
23
|
+
...(ctx.with_items ? { with_items: ctx.with_items } : {}),
|
|
24
|
+
})
|
|
25
|
+
);
|
|
26
|
+
const i18n = getTwilightContext().i18n;
|
|
27
|
+
const pageData: OrdersPageProps = {
|
|
28
|
+
page: {
|
|
29
|
+
title: isPending ? i18n.t('common.titles.pending_orders') : i18n.t('common.titles.orders'),
|
|
30
|
+
slug: RouteId.CUSTOMER_ORDERS_INDEX,
|
|
31
|
+
},
|
|
32
|
+
orders: response.data,
|
|
33
|
+
cursor: response.cursor,
|
|
34
|
+
query,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
if (extend) {
|
|
38
|
+
const extra = await extend(pageData, { params: {} });
|
|
39
|
+
return { ...pageData, ...extra } as OrdersPageProps;
|
|
40
|
+
}
|
|
41
|
+
return pageData;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export async function orderSingleLoader({
|
|
45
|
+
params,
|
|
46
|
+
}: {
|
|
47
|
+
params: IdParams;
|
|
48
|
+
}): Promise<OrderSinglePageProps> {
|
|
49
|
+
if (!getAuthToken()) throw unauthorized();
|
|
50
|
+
const [data, componentsOrder] = await Promise.all([
|
|
51
|
+
order.findOrThrow(params.id),
|
|
52
|
+
orThrow(orUnauthorized(order.findForComponents(params.id))),
|
|
53
|
+
]);
|
|
54
|
+
const i18n = getTwilightContext().i18n;
|
|
55
|
+
return {
|
|
56
|
+
page: {
|
|
57
|
+
slug: RouteId.CUSTOMER_ORDERS_SINGLE,
|
|
58
|
+
id: String(params.id),
|
|
59
|
+
title: i18n
|
|
60
|
+
.t('pages.orders.order_details')
|
|
61
|
+
.replace(':id', String(data.order.reference_id ?? params.id)),
|
|
62
|
+
},
|
|
63
|
+
order: data.order,
|
|
64
|
+
componentsOrder,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { SallaButton } from '@salla.sa/twilight-components-react/button';
|
|
3
|
+
import { SallaModal } from '@salla.sa/twilight-components-react/modal';
|
|
4
|
+
import { useIsClient, useUser } from '../../../../hooks';
|
|
5
|
+
import { useAsyncFn } from '../../../../hooks/useAsyncFn';
|
|
6
|
+
import { useTranslation } from '../../../../providers/I18nProvider';
|
|
7
|
+
import { useLocation, useNavigate } from '../../../../providers/NavigationProvider';
|
|
8
|
+
import type { Order } from './types';
|
|
9
|
+
|
|
10
|
+
function ConfirmModal({
|
|
11
|
+
visible,
|
|
12
|
+
onVisibleChange,
|
|
13
|
+
title,
|
|
14
|
+
subTitle,
|
|
15
|
+
iconStyle,
|
|
16
|
+
confirmColor,
|
|
17
|
+
onConfirm,
|
|
18
|
+
busy,
|
|
19
|
+
}: {
|
|
20
|
+
visible: boolean;
|
|
21
|
+
onVisibleChange: (visible: boolean) => void;
|
|
22
|
+
title: string;
|
|
23
|
+
subTitle: string;
|
|
24
|
+
iconStyle: 'success' | 'error';
|
|
25
|
+
confirmColor?: 'danger';
|
|
26
|
+
onConfirm: () => void;
|
|
27
|
+
busy: boolean;
|
|
28
|
+
}) {
|
|
29
|
+
const { t } = useTranslation();
|
|
30
|
+
// The modal wrapper renders only in the browser, so mount after hydration to match the server.
|
|
31
|
+
const isClient = useIsClient();
|
|
32
|
+
if (!isClient) return null;
|
|
33
|
+
return (
|
|
34
|
+
<SallaModal
|
|
35
|
+
width="sm"
|
|
36
|
+
visible={visible}
|
|
37
|
+
onModalVisibilityChanged={(e) => onVisibleChange(Boolean(e.detail))}
|
|
38
|
+
{...{ 'modal-title': title }}
|
|
39
|
+
subTitle={subTitle}
|
|
40
|
+
iconStyle={iconStyle}
|
|
41
|
+
>
|
|
42
|
+
<div slot="footer" className="grid grid-cols-2 gap-3">
|
|
43
|
+
<SallaButton
|
|
44
|
+
width="wide"
|
|
45
|
+
color={confirmColor}
|
|
46
|
+
className="w-full cursor-pointer"
|
|
47
|
+
onClick={onConfirm}
|
|
48
|
+
disabled={busy}
|
|
49
|
+
>
|
|
50
|
+
{t('common.elements.ok')}
|
|
51
|
+
</SallaButton>
|
|
52
|
+
<SallaButton
|
|
53
|
+
className="w-full"
|
|
54
|
+
fill="outline"
|
|
55
|
+
color="light"
|
|
56
|
+
onClick={() => onVisibleChange(false)}
|
|
57
|
+
disabled={busy}
|
|
58
|
+
>
|
|
59
|
+
{t('common.elements.cancel')}
|
|
60
|
+
</SallaButton>
|
|
61
|
+
</div>
|
|
62
|
+
</SallaModal>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function PaymentOrReorder({
|
|
67
|
+
order,
|
|
68
|
+
paymentExpired,
|
|
69
|
+
canReorder,
|
|
70
|
+
onReorder,
|
|
71
|
+
busy,
|
|
72
|
+
}: {
|
|
73
|
+
order: Order;
|
|
74
|
+
paymentExpired: boolean;
|
|
75
|
+
canReorder: boolean;
|
|
76
|
+
onReorder: () => void;
|
|
77
|
+
busy: boolean;
|
|
78
|
+
}) {
|
|
79
|
+
const { t } = useTranslation();
|
|
80
|
+
if (order.actions.payable) {
|
|
81
|
+
return paymentExpired || !order.urls.checkout ? (
|
|
82
|
+
<span className="text-red-500">{t('pages.orders.pending_payment_expired')}</span>
|
|
83
|
+
) : (
|
|
84
|
+
<SallaButton width="wide" href={order.urls.checkout}>
|
|
85
|
+
<i className="sicon sicon-wallet rtl:ml-2 ltr:mr-2"></i>
|
|
86
|
+
<span>{t('pages.orders.finish_payment')}</span>
|
|
87
|
+
</SallaButton>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
if (!canReorder) return null;
|
|
91
|
+
return (
|
|
92
|
+
<>
|
|
93
|
+
<div className="text-sm">
|
|
94
|
+
<h3 className="font-bold text-lg leading-none mb-1">{t('pages.orders.reorder')}</h3>
|
|
95
|
+
<p className="text-gray-500">{t('pages.orders.reorder_description')}</p>
|
|
96
|
+
</div>
|
|
97
|
+
<SallaButton
|
|
98
|
+
data-testid="store-order-reorder-btn"
|
|
99
|
+
shape="link"
|
|
100
|
+
onClick={onReorder}
|
|
101
|
+
disabled={busy}
|
|
102
|
+
>
|
|
103
|
+
<i className="sicon sicon-rotate rtl:ml-2 ltr:mr-2"></i>
|
|
104
|
+
<span>{t('pages.orders.reorder')}</span>
|
|
105
|
+
</SallaButton>
|
|
106
|
+
</>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** The "Reorder & Cancel" card, its pending-payment state and the two confirmations. */
|
|
111
|
+
export function OrderActions({ order, paymentExpired }: { order: Order; paymentExpired: boolean }) {
|
|
112
|
+
const { t } = useTranslation();
|
|
113
|
+
// Token-based, so the server and the first client render agree (the user query loads later).
|
|
114
|
+
const { isLoggedIn } = useUser();
|
|
115
|
+
const navigate = useNavigate();
|
|
116
|
+
const location = useLocation();
|
|
117
|
+
const [showReorder, setShowReorder] = useState(false);
|
|
118
|
+
const [showCancel, setShowCancel] = useState(false);
|
|
119
|
+
const { reorderable, cancellable, payable } = order.actions;
|
|
120
|
+
const canReorder = isLoggedIn && reorderable;
|
|
121
|
+
|
|
122
|
+
const [reorderState, handleReorder] = useAsyncFn(async () => {
|
|
123
|
+
await window.salla?.order.createCartFromOrder(Number(order.id));
|
|
124
|
+
setShowReorder(false);
|
|
125
|
+
navigate('/cart');
|
|
126
|
+
}, [navigate, order.id]);
|
|
127
|
+
|
|
128
|
+
const [cancelState, handleCancel] = useAsyncFn(async () => {
|
|
129
|
+
await window.salla?.order.cancel(Number(order.id));
|
|
130
|
+
setShowCancel(false);
|
|
131
|
+
navigate(location.pathname, { replace: true });
|
|
132
|
+
}, [navigate, order.id, location.pathname]);
|
|
133
|
+
|
|
134
|
+
if (!reorderable && !cancellable && !payable) return null;
|
|
135
|
+
|
|
136
|
+
return (
|
|
137
|
+
<>
|
|
138
|
+
<div className="bg-white rounded-md p-5 divide-y divide-border-color space-y-4">
|
|
139
|
+
{(reorderable || payable) && (
|
|
140
|
+
<div className={payable ? 'flex-center' : 'center-between'}>
|
|
141
|
+
<PaymentOrReorder
|
|
142
|
+
order={order}
|
|
143
|
+
paymentExpired={paymentExpired}
|
|
144
|
+
canReorder={!!canReorder}
|
|
145
|
+
onReorder={() => setShowReorder(true)}
|
|
146
|
+
busy={reorderState.loading}
|
|
147
|
+
/>
|
|
148
|
+
</div>
|
|
149
|
+
)}
|
|
150
|
+
|
|
151
|
+
{cancellable && (
|
|
152
|
+
<div className="center-between pt-4">
|
|
153
|
+
<div className="text-sm">
|
|
154
|
+
<h3 className="font-bold text-lg leading-none mb-1">{t('pages.orders.cancel')}</h3>
|
|
155
|
+
<p className="text-gray-500">{t('pages.order.order_cancelation_desc')}</p>
|
|
156
|
+
</div>
|
|
157
|
+
<SallaButton
|
|
158
|
+
data-testid="store-order-cancel-btn"
|
|
159
|
+
shape="link"
|
|
160
|
+
color="danger"
|
|
161
|
+
onClick={() => setShowCancel(true)}
|
|
162
|
+
disabled={cancelState.loading}
|
|
163
|
+
>
|
|
164
|
+
<i className="sicon sicon-cancel-circle rtl:ml-2 ltr:mr-2"></i>
|
|
165
|
+
<span>{t('pages.orders.cancel')}</span>
|
|
166
|
+
</SallaButton>
|
|
167
|
+
</div>
|
|
168
|
+
)}
|
|
169
|
+
</div>
|
|
170
|
+
|
|
171
|
+
{/* Always mounted: salla-modal moves itself under <body> and opens from `visible`. */}
|
|
172
|
+
{canReorder && (
|
|
173
|
+
<ConfirmModal
|
|
174
|
+
visible={showReorder}
|
|
175
|
+
onVisibleChange={setShowReorder}
|
|
176
|
+
title={t('pages.orders.reorder')}
|
|
177
|
+
subTitle={t('pages.orders.reorder_confirmation')}
|
|
178
|
+
iconStyle="success"
|
|
179
|
+
onConfirm={handleReorder}
|
|
180
|
+
busy={reorderState.loading}
|
|
181
|
+
/>
|
|
182
|
+
)}
|
|
183
|
+
{cancellable && (
|
|
184
|
+
<ConfirmModal
|
|
185
|
+
visible={showCancel}
|
|
186
|
+
onVisibleChange={setShowCancel}
|
|
187
|
+
title={t('common.elements.warning')}
|
|
188
|
+
subTitle={t('pages.orders.cancel_confirmation')}
|
|
189
|
+
iconStyle="error"
|
|
190
|
+
confirmColor="danger"
|
|
191
|
+
onConfirm={handleCancel}
|
|
192
|
+
busy={cancelState.loading}
|
|
193
|
+
/>
|
|
194
|
+
)}
|
|
195
|
+
</>
|
|
196
|
+
);
|
|
197
|
+
}
|