@pradip1995/create-storefront 1.0.1
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/bin/create-storefront.js +239 -0
- package/lib/kit-next-config.js +84 -0
- package/package.json +32 -0
- package/templates/storefront/.eslintrc.json +3 -0
- package/templates/storefront/README.md +35 -0
- package/templates/storefront/check-env-variables.js +51 -0
- package/templates/storefront/kit-next-config.js +71 -0
- package/templates/storefront/next-env.d.ts +5 -0
- package/templates/storefront/next.config.js +25 -0
- package/templates/storefront/package.json +56 -0
- package/templates/storefront/postcss.config.js +6 -0
- package/templates/storefront/public/favicon.png +0 -0
- package/templates/storefront/src/app/[countryCode]/(checkout)/checkout/page.tsx +23 -0
- package/templates/storefront/src/app/[countryCode]/(checkout)/checkout/payment/page.tsx +47 -0
- package/templates/storefront/src/app/[countryCode]/(checkout)/layout.tsx +31 -0
- package/templates/storefront/src/app/[countryCode]/(checkout)/not-found.tsx +19 -0
- package/templates/storefront/src/app/[countryCode]/(main)/account/@dashboard/addresses/page.tsx +31 -0
- package/templates/storefront/src/app/[countryCode]/(main)/account/@dashboard/loading.tsx +9 -0
- package/templates/storefront/src/app/[countryCode]/(main)/account/@dashboard/orders/details/[id]/page.tsx +35 -0
- package/templates/storefront/src/app/[countryCode]/(main)/account/@dashboard/orders/exchange/[id]/page.tsx +47 -0
- package/templates/storefront/src/app/[countryCode]/(main)/account/@dashboard/orders/page.tsx +28 -0
- package/templates/storefront/src/app/[countryCode]/(main)/account/@dashboard/orders/return/[id]/page.tsx +66 -0
- package/templates/storefront/src/app/[countryCode]/(main)/account/@dashboard/page.tsx +22 -0
- package/templates/storefront/src/app/[countryCode]/(main)/account/@dashboard/payment-methods/page.tsx +23 -0
- package/templates/storefront/src/app/[countryCode]/(main)/account/@dashboard/profile/page.tsx +43 -0
- package/templates/storefront/src/app/[countryCode]/(main)/account/@login/default.tsx +11 -0
- package/templates/storefront/src/app/[countryCode]/(main)/account/@login/page.tsx +18 -0
- package/templates/storefront/src/app/[countryCode]/(main)/account/guest-orders/page.tsx +13 -0
- package/templates/storefront/src/app/[countryCode]/(main)/account/layout.tsx +22 -0
- package/templates/storefront/src/app/[countryCode]/(main)/account/loading.tsx +9 -0
- package/templates/storefront/src/app/[countryCode]/(main)/cart/loading.tsx +5 -0
- package/templates/storefront/src/app/[countryCode]/(main)/cart/not-found.tsx +21 -0
- package/templates/storefront/src/app/[countryCode]/(main)/cart/page.tsx +23 -0
- package/templates/storefront/src/app/[countryCode]/(main)/categories/[...category]/page.tsx +11 -0
- package/templates/storefront/src/app/[countryCode]/(main)/collections/[handle]/page.tsx +11 -0
- package/templates/storefront/src/app/[countryCode]/(main)/contact/page.tsx +21 -0
- package/templates/storefront/src/app/[countryCode]/(main)/guest-orders/page.tsx +12 -0
- package/templates/storefront/src/app/[countryCode]/(main)/help/page.tsx +28 -0
- package/templates/storefront/src/app/[countryCode]/(main)/layout.tsx +21 -0
- package/templates/storefront/src/app/[countryCode]/(main)/not-found.tsx +20 -0
- package/templates/storefront/src/app/[countryCode]/(main)/order/[id]/confirmed/loading.tsx +5 -0
- package/templates/storefront/src/app/[countryCode]/(main)/order/[id]/confirmed/page.tsx +23 -0
- package/templates/storefront/src/app/[countryCode]/(main)/order/[id]/transfer/[token]/accept/page.tsx +41 -0
- package/templates/storefront/src/app/[countryCode]/(main)/order/[id]/transfer/[token]/decline/page.tsx +41 -0
- package/templates/storefront/src/app/[countryCode]/(main)/order/[id]/transfer/[token]/page.tsx +38 -0
- package/templates/storefront/src/app/[countryCode]/(main)/order/exchange/[id]/page.tsx +47 -0
- package/templates/storefront/src/app/[countryCode]/(main)/order/return/[id]/page.tsx +61 -0
- package/templates/storefront/src/app/[countryCode]/(main)/orders/[id]/page.tsx +33 -0
- package/templates/storefront/src/app/[countryCode]/(main)/page.tsx +24 -0
- package/templates/storefront/src/app/[countryCode]/(main)/privacy-policy/page.tsx +173 -0
- package/templates/storefront/src/app/[countryCode]/(main)/products/[handle]/page.tsx +193 -0
- package/templates/storefront/src/app/[countryCode]/(main)/reset-password/page.tsx +192 -0
- package/templates/storefront/src/app/[countryCode]/(main)/store/page.tsx +72 -0
- package/templates/storefront/src/app/[countryCode]/(main)/terms-of-use/page.tsx +179 -0
- package/templates/storefront/src/app/[countryCode]/(main)/wishlist/page.tsx +19 -0
- package/templates/storefront/src/app/api/meta/event/route.ts +63 -0
- package/templates/storefront/src/app/auth/customer/google/callback/page.tsx +126 -0
- package/templates/storefront/src/app/layout.tsx +104 -0
- package/templates/storefront/src/app/not-found.tsx +30 -0
- package/templates/storefront/src/app/opengraph-image.jpg +0 -0
- package/templates/storefront/src/app/robots.ts +15 -0
- package/templates/storefront/src/app/sitemap.ts +65 -0
- package/templates/storefront/src/app/twitter-image.jpg +0 -0
- package/templates/storefront/src/modules/account/components/account-deletion/index.tsx +160 -0
- package/templates/storefront/src/modules/account/components/account-info/index.tsx +145 -0
- package/templates/storefront/src/modules/account/components/account-nav/icons.tsx +43 -0
- package/templates/storefront/src/modules/account/components/account-nav/index.tsx +318 -0
- package/templates/storefront/src/modules/account/components/account-nav/logout-modal.tsx +92 -0
- package/templates/storefront/src/modules/account/components/account-nav/payment-methods-icon.tsx +9 -0
- package/templates/storefront/src/modules/account/components/address-book/index.tsx +47 -0
- package/templates/storefront/src/modules/account/components/address-card/add-address.tsx +377 -0
- package/templates/storefront/src/modules/account/components/address-card/edit-address-modal.tsx +468 -0
- package/templates/storefront/src/modules/account/components/deletion-pending-modal/index.tsx +213 -0
- package/templates/storefront/src/modules/account/components/forgot-password/index.tsx +1 -0
- package/templates/storefront/src/modules/account/components/login/index.tsx +1 -0
- package/templates/storefront/src/modules/account/components/order-card/index.tsx +221 -0
- package/templates/storefront/src/modules/account/components/order-overview/index.tsx +159 -0
- package/templates/storefront/src/modules/account/components/overview/index.tsx +189 -0
- package/templates/storefront/src/modules/account/components/profile-billing-address/index.tsx +447 -0
- package/templates/storefront/src/modules/account/components/profile-email/index.tsx +75 -0
- package/templates/storefront/src/modules/account/components/profile-form/index.tsx +416 -0
- package/templates/storefront/src/modules/account/components/profile-name/index.tsx +76 -0
- package/templates/storefront/src/modules/account/components/profile-password/index.tsx +70 -0
- package/templates/storefront/src/modules/account/components/profile-phone/index.tsx +185 -0
- package/templates/storefront/src/modules/account/components/register/index.tsx +1 -0
- package/templates/storefront/src/modules/account/components/return-item-selector/index.tsx +187 -0
- package/templates/storefront/src/modules/account/components/return-shipping-selector/index.tsx +118 -0
- package/templates/storefront/src/modules/account/components/transfer-request-form/index.tsx +81 -0
- package/templates/storefront/src/modules/account/templates/account-layout.tsx +38 -0
- package/templates/storefront/src/modules/account/templates/exchange-request-template.tsx +389 -0
- package/templates/storefront/src/modules/account/templates/guest-orders-template.tsx +123 -0
- package/templates/storefront/src/modules/account/templates/login-template.tsx +44 -0
- package/templates/storefront/src/modules/account/templates/payment-methods-template.tsx +478 -0
- package/templates/storefront/src/modules/account/templates/return-request-template.tsx +300 -0
- package/templates/storefront/src/modules/cart/components/abandoned-carts/ScrollToPendingOrdersButton.tsx +21 -0
- package/templates/storefront/src/modules/cart/components/abandoned-carts/index.tsx +335 -0
- package/templates/storefront/src/modules/cart/components/applied-promotions/index.tsx +121 -0
- package/templates/storefront/src/modules/cart/components/cart-delivery-selection/index.tsx +203 -0
- package/templates/storefront/src/modules/cart/components/cart-item-card/index.tsx +476 -0
- package/templates/storefront/src/modules/cart/components/cart-item-select/index.tsx +73 -0
- package/templates/storefront/src/modules/cart/components/cart-view-tracker/index.tsx +44 -0
- package/templates/storefront/src/modules/cart/components/delivery-information/index.tsx +89 -0
- package/templates/storefront/src/modules/cart/components/empty-cart-message/index.tsx +38 -0
- package/templates/storefront/src/modules/cart/components/item/index.tsx +150 -0
- package/templates/storefront/src/modules/cart/components/pincode-checker/index.tsx +174 -0
- package/templates/storefront/src/modules/cart/components/sign-in-prompt/index.tsx +26 -0
- package/templates/storefront/src/modules/cart/components/you-may-also-like/index.tsx +137 -0
- package/templates/storefront/src/modules/cart/templates/index.tsx +88 -0
- package/templates/storefront/src/modules/cart/templates/items.tsx +49 -0
- package/templates/storefront/src/modules/cart/templates/preview.tsx +51 -0
- package/templates/storefront/src/modules/cart/templates/summary.tsx +29 -0
- package/templates/storefront/src/modules/checkout/components/add-address-modal/index.tsx +390 -0
- package/templates/storefront/src/modules/checkout/components/address-card/index.tsx +135 -0
- package/templates/storefront/src/modules/checkout/components/address-select/index.tsx +116 -0
- package/templates/storefront/src/modules/checkout/components/addresses/index.tsx +605 -0
- package/templates/storefront/src/modules/checkout/components/back-link/index.tsx +32 -0
- package/templates/storefront/src/modules/checkout/components/billing_address/index.tsx +301 -0
- package/templates/storefront/src/modules/checkout/components/checkout-begin-tracker/index.tsx +45 -0
- package/templates/storefront/src/modules/checkout/components/checkout-leave-guard/index.tsx +109 -0
- package/templates/storefront/src/modules/checkout/components/checkout-shipping-tracker/index.tsx +45 -0
- package/templates/storefront/src/modules/checkout/components/country-select/index.tsx +50 -0
- package/templates/storefront/src/modules/checkout/components/discount-code/index.tsx +220 -0
- package/templates/storefront/src/modules/checkout/components/error-message/index.tsx +13 -0
- package/templates/storefront/src/modules/checkout/components/payment/index.tsx +572 -0
- package/templates/storefront/src/modules/checkout/components/payment-button/index.tsx +257 -0
- package/templates/storefront/src/modules/checkout/components/payment-button/razorpay-payment-button.tsx +136 -0
- package/templates/storefront/src/modules/checkout/components/payment-container/index.tsx +129 -0
- package/templates/storefront/src/modules/checkout/components/payment-test/index.tsx +12 -0
- package/templates/storefront/src/modules/checkout/components/payment-wrapper/index.tsx +50 -0
- package/templates/storefront/src/modules/checkout/components/payment-wrapper/stripe-wrapper.tsx +54 -0
- package/templates/storefront/src/modules/checkout/components/processing-overlay/index.tsx +83 -0
- package/templates/storefront/src/modules/checkout/components/review/index.tsx +60 -0
- package/templates/storefront/src/modules/checkout/components/select-address-modal/index.tsx +103 -0
- package/templates/storefront/src/modules/checkout/components/shipping/index.tsx +533 -0
- package/templates/storefront/src/modules/checkout/components/shipping-address/index.tsx +521 -0
- package/templates/storefront/src/modules/checkout/components/submit-button/index.tsx +32 -0
- package/templates/storefront/src/modules/checkout/templates/checkout-form/index.tsx +38 -0
- package/templates/storefront/src/modules/checkout/templates/checkout-summary/index.tsx +274 -0
- package/templates/storefront/src/modules/common/components/breadcrumb/index.tsx +43 -0
- package/templates/storefront/src/modules/common/components/cart-totals/index.tsx +473 -0
- package/templates/storefront/src/modules/common/components/checkbox/index.tsx +98 -0
- package/templates/storefront/src/modules/common/components/delete-button/index.tsx +156 -0
- package/templates/storefront/src/modules/common/components/divider/index.tsx +9 -0
- package/templates/storefront/src/modules/common/components/filter-checkbox-group/index.tsx +134 -0
- package/templates/storefront/src/modules/common/components/filter-radio-group/index.tsx +62 -0
- package/templates/storefront/src/modules/common/components/input/index.tsx +79 -0
- package/templates/storefront/src/modules/common/components/interactive-link/index.tsx +33 -0
- package/templates/storefront/src/modules/common/components/line-item-options/index.tsx +26 -0
- package/templates/storefront/src/modules/common/components/line-item-price/index.tsx +64 -0
- package/templates/storefront/src/modules/common/components/line-item-unit-price/index.tsx +61 -0
- package/templates/storefront/src/modules/common/components/localized-client-link/index.tsx +32 -0
- package/templates/storefront/src/modules/common/components/login-popup/index.tsx +78 -0
- package/templates/storefront/src/modules/common/components/modal/index.tsx +123 -0
- package/templates/storefront/src/modules/common/components/native-select/index.tsx +75 -0
- package/templates/storefront/src/modules/common/components/obfuscated-email/index.tsx +30 -0
- package/templates/storefront/src/modules/common/components/product/product-rating/index.tsx +172 -0
- package/templates/storefront/src/modules/common/components/product/review-modal/index.tsx +333 -0
- package/templates/storefront/src/modules/common/components/product/share-button/index.tsx +227 -0
- package/templates/storefront/src/modules/common/components/product/wishlist-icon/index.tsx +46 -0
- package/templates/storefront/src/modules/common/components/radio/index.tsx +27 -0
- package/templates/storefront/src/modules/common/components/select/index.tsx +164 -0
- package/templates/storefront/src/modules/common/components/side-panel/index.tsx +65 -0
- package/templates/storefront/src/modules/common/icons/arrow-left.tsx +36 -0
- package/templates/storefront/src/modules/common/icons/back.tsx +37 -0
- package/templates/storefront/src/modules/common/icons/bancontact.tsx +26 -0
- package/templates/storefront/src/modules/common/icons/chevron-down.tsx +30 -0
- package/templates/storefront/src/modules/common/icons/delivered.tsx +29 -0
- package/templates/storefront/src/modules/common/icons/envelope.tsx +27 -0
- package/templates/storefront/src/modules/common/icons/eye-off.tsx +37 -0
- package/templates/storefront/src/modules/common/icons/eye.tsx +37 -0
- package/templates/storefront/src/modules/common/icons/fast-delivery.tsx +65 -0
- package/templates/storefront/src/modules/common/icons/ideal.tsx +26 -0
- package/templates/storefront/src/modules/common/icons/lock.tsx +31 -0
- package/templates/storefront/src/modules/common/icons/map-pin.tsx +37 -0
- package/templates/storefront/src/modules/common/icons/medusa.tsx +27 -0
- package/templates/storefront/src/modules/common/icons/menu.tsx +45 -0
- package/templates/storefront/src/modules/common/icons/nextjs.tsx +27 -0
- package/templates/storefront/src/modules/common/icons/package.tsx +44 -0
- package/templates/storefront/src/modules/common/icons/paypal.tsx +30 -0
- package/templates/storefront/src/modules/common/icons/phone.tsx +30 -0
- package/templates/storefront/src/modules/common/icons/placeholder-image.tsx +44 -0
- package/templates/storefront/src/modules/common/icons/refresh.tsx +51 -0
- package/templates/storefront/src/modules/common/icons/spinner.tsx +37 -0
- package/templates/storefront/src/modules/common/icons/trash.tsx +51 -0
- package/templates/storefront/src/modules/common/icons/user.tsx +37 -0
- package/templates/storefront/src/modules/common/icons/x.tsx +37 -0
- package/templates/storefront/src/modules/contact/templates/index.tsx +272 -0
- package/templates/storefront/src/modules/help/templates/index.tsx +629 -0
- package/templates/storefront/src/modules/home/components/dynamic-banner/index.tsx +190 -0
- package/templates/storefront/src/modules/home/components/featured-products/index.tsx +16 -0
- package/templates/storefront/src/modules/home/components/featured-products/product-rail/index.tsx +51 -0
- package/templates/storefront/src/modules/home/components/features/index.tsx +1 -0
- package/templates/storefront/src/modules/home/components/hero/index.tsx +1 -0
- package/templates/storefront/src/modules/home/components/loved-by-moms/index.tsx +1 -0
- package/templates/storefront/src/modules/home/components/new-arrivals/index.tsx +1 -0
- package/templates/storefront/src/modules/home/components/shop-by-age/index.tsx +1 -0
- package/templates/storefront/src/modules/home/components/shop-by-category/index.tsx +1 -0
- package/templates/storefront/src/modules/home/components/testimonials/index.tsx +1 -0
- package/templates/storefront/src/modules/home/components/why-choose-us/dynamic-features.tsx +93 -0
- package/templates/storefront/src/modules/home/components/why-choose-us/index.tsx +1 -0
- package/templates/storefront/src/modules/layout/components/account-dropdown/index.tsx +56 -0
- package/templates/storefront/src/modules/layout/components/cart-button/index.tsx +8 -0
- package/templates/storefront/src/modules/layout/components/cart-dropdown/index.tsx +424 -0
- package/templates/storefront/src/modules/layout/components/cart-mismatch-banner/index.tsx +57 -0
- package/templates/storefront/src/modules/layout/components/cookie-consent/index.tsx +116 -0
- package/templates/storefront/src/modules/layout/components/country-select/index.tsx +135 -0
- package/templates/storefront/src/modules/layout/components/desktop-search/index.tsx +148 -0
- package/templates/storefront/src/modules/layout/components/dynamic-logo/index.tsx +27 -0
- package/templates/storefront/src/modules/layout/components/footer-categories/index.tsx +34 -0
- package/templates/storefront/src/modules/layout/components/footer-contact/index.tsx +87 -0
- package/templates/storefront/src/modules/layout/components/footer-description/index.tsx +12 -0
- package/templates/storefront/src/modules/layout/components/footer-logo/index.tsx +22 -0
- package/templates/storefront/src/modules/layout/components/footer-newsletter/index.tsx +100 -0
- package/templates/storefront/src/modules/layout/components/language-select/index.tsx +192 -0
- package/templates/storefront/src/modules/layout/components/medusa-cta/index.tsx +21 -0
- package/templates/storefront/src/modules/layout/components/mobile-menu/index.tsx +296 -0
- package/templates/storefront/src/modules/layout/components/nav-links/index.tsx +66 -0
- package/templates/storefront/src/modules/layout/components/nav-wrapper/index.tsx +14 -0
- package/templates/storefront/src/modules/layout/components/promo-bar/index.tsx +7 -0
- package/templates/storefront/src/modules/layout/components/promo-bar/promo-bar-content.tsx +174 -0
- package/templates/storefront/src/modules/layout/components/push-notification-manager/index.tsx +191 -0
- package/templates/storefront/src/modules/layout/components/search-panel/index.tsx +136 -0
- package/templates/storefront/src/modules/layout/components/side-menu/index.tsx +144 -0
- package/templates/storefront/src/modules/layout/components/verification-banner/index.tsx +217 -0
- package/templates/storefront/src/modules/layout/components/wishlist-counter/index.tsx +17 -0
- package/templates/storefront/src/modules/layout/templates/footer/index.tsx +7 -0
- package/templates/storefront/src/modules/layout/templates/nav/index.tsx +14 -0
- package/templates/storefront/src/modules/order/components/cancel-order-modal/index.tsx +168 -0
- package/templates/storefront/src/modules/order/components/help/index.tsx +25 -0
- package/templates/storefront/src/modules/order/components/item/index.tsx +62 -0
- package/templates/storefront/src/modules/order/components/items/index.tsx +44 -0
- package/templates/storefront/src/modules/order/components/onboarding-cta/index.tsx +28 -0
- package/templates/storefront/src/modules/order/components/order-confirmation-back-handler/index.tsx +28 -0
- package/templates/storefront/src/modules/order/components/order-details/index.tsx +63 -0
- package/templates/storefront/src/modules/order/components/order-purchase-tracker/index.tsx +48 -0
- package/templates/storefront/src/modules/order/components/order-redesign/index.tsx +887 -0
- package/templates/storefront/src/modules/order/components/order-summary/index.tsx +60 -0
- package/templates/storefront/src/modules/order/components/payment-details/index.tsx +63 -0
- package/templates/storefront/src/modules/order/components/shipping-details/index.tsx +73 -0
- package/templates/storefront/src/modules/order/components/transfer-actions/index.tsx +81 -0
- package/templates/storefront/src/modules/order/components/transfer-image/index.tsx +275 -0
- package/templates/storefront/src/modules/order/templates/order-completed-template.tsx +233 -0
- package/templates/storefront/src/modules/order/templates/order-details-template.tsx +128 -0
- package/templates/storefront/src/modules/products/components/image-gallery/index.tsx +297 -0
- package/templates/storefront/src/modules/products/components/product-actions/index.tsx +1400 -0
- package/templates/storefront/src/modules/products/components/product-actions/mobile-actions.tsx +217 -0
- package/templates/storefront/src/modules/products/components/product-actions/option-select.tsx +62 -0
- package/templates/storefront/src/modules/products/components/product-onboarding-cta/index.tsx +30 -0
- package/templates/storefront/src/modules/products/components/product-preview/index.tsx +5 -0
- package/templates/storefront/src/modules/products/components/product-preview/price.tsx +29 -0
- package/templates/storefront/src/modules/products/components/product-price/index.tsx +58 -0
- package/templates/storefront/src/modules/products/components/product-rating/index.tsx +1 -0
- package/templates/storefront/src/modules/products/components/product-tabs/accordion.tsx +100 -0
- package/templates/storefront/src/modules/products/components/product-tabs/index.tsx +127 -0
- package/templates/storefront/src/modules/products/components/product-tabs/ratings-tab.tsx +598 -0
- package/templates/storefront/src/modules/products/components/product-view-tracker/index.tsx +53 -0
- package/templates/storefront/src/modules/products/components/related-products/index.tsx +152 -0
- package/templates/storefront/src/modules/products/components/review-modal/index.tsx +1 -0
- package/templates/storefront/src/modules/products/components/share-button/index.tsx +1 -0
- package/templates/storefront/src/modules/products/components/thumbnail/index.tsx +91 -0
- package/templates/storefront/src/modules/products/components/wishlist-icon/index.tsx +1 -0
- package/templates/storefront/src/modules/products/context/product-context.tsx +52 -0
- package/templates/storefront/src/modules/products/templates/index.tsx +26 -0
- package/templates/storefront/src/modules/products/templates/product-actions-wrapper/index.tsx +1 -0
- package/templates/storefront/src/modules/products/templates/product-info/index.tsx +2 -0
- package/templates/storefront/src/modules/shipping/components/free-shipping-price-nudge/index.tsx +283 -0
- package/templates/storefront/src/modules/skeletons/components/skeleton-button/index.tsx +5 -0
- package/templates/storefront/src/modules/skeletons/components/skeleton-card-details/index.tsx +10 -0
- package/templates/storefront/src/modules/skeletons/components/skeleton-cart-item/index.tsx +35 -0
- package/templates/storefront/src/modules/skeletons/components/skeleton-cart-totals/index.tsx +30 -0
- package/templates/storefront/src/modules/skeletons/components/skeleton-code-form/index.tsx +13 -0
- package/templates/storefront/src/modules/skeletons/components/skeleton-line-item/index.tsx +35 -0
- package/templates/storefront/src/modules/skeletons/components/skeleton-order-confirmed-header/index.tsx +14 -0
- package/templates/storefront/src/modules/skeletons/components/skeleton-order-information/index.tsx +36 -0
- package/templates/storefront/src/modules/skeletons/components/skeleton-order-items/index.tsx +43 -0
- package/templates/storefront/src/modules/skeletons/components/skeleton-order-summary/index.tsx +15 -0
- package/templates/storefront/src/modules/skeletons/components/skeleton-product-preview/index.tsx +15 -0
- package/templates/storefront/src/modules/skeletons/templates/skeleton-cart-page/index.tsx +65 -0
- package/templates/storefront/src/modules/skeletons/templates/skeleton-order-confirmed/index.tsx +21 -0
- package/templates/storefront/src/modules/skeletons/templates/skeleton-product-grid/index.tsx +23 -0
- package/templates/storefront/src/modules/skeletons/templates/skeleton-related-products/index.tsx +25 -0
- package/templates/storefront/src/modules/store/components/client-paginated-products.tsx +108 -0
- package/templates/storefront/src/modules/store/components/mobile-filters/index.tsx +135 -0
- package/templates/storefront/src/modules/store/components/pagination/index.tsx +118 -0
- package/templates/storefront/src/modules/store/components/product-list-view-tracker/index.tsx +43 -0
- package/templates/storefront/src/modules/store/components/refinement-list/index.tsx +299 -0
- package/templates/storefront/src/modules/store/components/refinement-list/sort-products/index.tsx +120 -0
- package/templates/storefront/src/modules/store/components/store-header/index.tsx +67 -0
- package/templates/storefront/src/modules/store/templates/index.tsx +1 -0
- package/templates/storefront/src/modules/store/templates/paginated-products.tsx +175 -0
- package/templates/storefront/src/modules/wishlist/components/wishlist-item/index.tsx +797 -0
- package/templates/storefront/src/modules/wishlist/templates/index.tsx +176 -0
- package/templates/storefront/src/storefront.config.ts +12 -0
- package/templates/storefront/src/styles/globals.css +326 -0
- package/templates/storefront/src/theme/valero/blocks/home/Features/index.tsx +61 -0
- package/templates/storefront/src/theme/valero/blocks/home/Hero/index.tsx +102 -0
- package/templates/storefront/src/theme/valero/blocks/home/LovedByMoms/index.tsx +407 -0
- package/templates/storefront/src/theme/valero/blocks/home/NewArrivals/index.tsx +48 -0
- package/templates/storefront/src/theme/valero/blocks/home/ShopByAge/index.tsx +128 -0
- package/templates/storefront/src/theme/valero/blocks/home/ShopByCategory/index.tsx +409 -0
- package/templates/storefront/src/theme/valero/blocks/home/Testimonials/index.tsx +697 -0
- package/templates/storefront/src/theme/valero/blocks/home/WhyChooseUs/index.tsx +62 -0
- package/templates/storefront/src/theme/valero/layouts/MainLayoutShell.tsx +14 -0
- package/templates/storefront/src/theme/valero/primitives/Button.tsx +28 -0
- package/templates/storefront/src/theme/valero/primitives/Card.tsx +32 -0
- package/templates/storefront/src/theme/valero/primitives/index.ts +2 -0
- package/templates/storefront/src/theme/valero/slots/account/ForgotPassword/index.tsx +1 -0
- package/templates/storefront/src/theme/valero/slots/account/Login/index.tsx +1 -0
- package/templates/storefront/src/theme/valero/slots/account/LoginTemplate/index.tsx +44 -0
- package/templates/storefront/src/theme/valero/slots/account/Register/index.tsx +1 -0
- package/templates/storefront/src/theme/valero/slots/cart/CartItem/index.tsx +11 -0
- package/templates/storefront/src/theme/valero/slots/cart/CartSummary/index.tsx +13 -0
- package/templates/storefront/src/theme/valero/slots/checkout/CheckoutForm/index.tsx +1 -0
- package/templates/storefront/src/theme/valero/slots/checkout/CheckoutSummary/index.tsx +1 -0
- package/templates/storefront/src/theme/valero/slots/layout/Footer/index.tsx +104 -0
- package/templates/storefront/src/theme/valero/slots/layout/Nav/index.tsx +97 -0
- package/templates/storefront/src/theme/valero/slots/layout/PromoBar/index.tsx +19 -0
- package/templates/storefront/src/theme/valero/slots/layout/PromoBar/promo-bar-content.tsx +174 -0
- package/templates/storefront/src/theme/valero/slots/order/OrderDetails/index.tsx +12 -0
- package/templates/storefront/src/theme/valero/slots/product/ProductActions/ProductCTASection.tsx +191 -0
- package/templates/storefront/src/theme/valero/slots/product/ProductActions/ProductDetailsSection.tsx +137 -0
- package/templates/storefront/src/theme/valero/slots/product/ProductActions/ProductFeaturePanel.tsx +245 -0
- package/templates/storefront/src/theme/valero/slots/product/ProductActions/ProductHighlightsSection.tsx +98 -0
- package/templates/storefront/src/theme/valero/slots/product/ProductActions/ProductOptionsSection.tsx +233 -0
- package/templates/storefront/src/theme/valero/slots/product/ProductActions/ProductPriceSection.tsx +53 -0
- package/templates/storefront/src/theme/valero/slots/product/ProductActions/ProductTrustSection.tsx +84 -0
- package/templates/storefront/src/theme/valero/slots/product/ProductActions/index.tsx +161 -0
- package/templates/storefront/src/theme/valero/slots/product/ProductCard/index.tsx +132 -0
- package/templates/storefront/src/theme/valero/slots/product/ProductInfo/index.tsx +40 -0
- package/templates/storefront/src/theme/valero/templates/StorePage/index.tsx +154 -0
- package/templates/storefront/src/theme/valero/tokens/colors.js +16 -0
- package/templates/storefront/src/theme/valero/tokens/colors.ts +21 -0
- package/templates/storefront/src/theme/valero/tokens/fonts.ts +13 -0
- package/templates/storefront/src/theme/valero/tokens/index.ts +3 -0
- package/templates/storefront/src/theme/valero/tokens/spacing.ts +9 -0
- package/templates/storefront/src/theme/valero/tokens/theme.css +91 -0
- package/templates/storefront/tailwind.config.js +221 -0
- package/templates/storefront/tsconfig.json +30 -0
|
@@ -0,0 +1,533 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { Radio, RadioGroup } from "@headlessui/react"
|
|
4
|
+
import { setShippingMethod } from "@core/data/cart"
|
|
5
|
+
import { calculatePriceForShippingOption } from "@core/data/fulfillment"
|
|
6
|
+
import { convertToLocale } from "@core/util/money"
|
|
7
|
+
import { CheckCircleSolid, Loader } from "@medusajs/icons"
|
|
8
|
+
import { HttpTypes } from "@medusajs/types"
|
|
9
|
+
import { clx, Heading, Text } from "@medusajs/ui"
|
|
10
|
+
import ErrorMessage from "@modules/checkout/components/error-message"
|
|
11
|
+
import Divider from "@modules/common/components/divider"
|
|
12
|
+
import { usePathname, useRouter, useSearchParams } from "next/navigation"
|
|
13
|
+
import { useEffect, useState } from "react"
|
|
14
|
+
|
|
15
|
+
const PICKUP_OPTION_ON = "__PICKUP_ON"
|
|
16
|
+
const PICKUP_OPTION_OFF = "__PICKUP_OFF"
|
|
17
|
+
|
|
18
|
+
type ShippingProps = {
|
|
19
|
+
cart: HttpTypes.StoreCart
|
|
20
|
+
availableShippingMethods: HttpTypes.StoreCartShippingOption[] | null
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function formatAddress(address: HttpTypes.StoreCartAddress) {
|
|
24
|
+
if (!address) {
|
|
25
|
+
return ""
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
let ret = ""
|
|
29
|
+
|
|
30
|
+
if (address.address_1) {
|
|
31
|
+
ret += ` ${address.address_1}`
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (address.address_2) {
|
|
35
|
+
ret += `, ${address.address_2}`
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (address.postal_code) {
|
|
39
|
+
ret += `, ${address.postal_code} ${address.city}`
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (address.country_code) {
|
|
43
|
+
ret += `, ${address.country_code.toUpperCase()}`
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return ret
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const Shipping: React.FC<ShippingProps> = ({
|
|
50
|
+
cart,
|
|
51
|
+
availableShippingMethods,
|
|
52
|
+
}) => {
|
|
53
|
+
const [isLoading, setIsLoading] = useState(false)
|
|
54
|
+
const [isLoadingPrices, setIsLoadingPrices] = useState(true)
|
|
55
|
+
|
|
56
|
+
const [showPickupOptions, setShowPickupOptions] =
|
|
57
|
+
useState<string>(PICKUP_OPTION_OFF)
|
|
58
|
+
const [calculatedPricesMap, setCalculatedPricesMap] = useState<
|
|
59
|
+
Record<string, number>
|
|
60
|
+
>({})
|
|
61
|
+
const [error, setError] = useState<string | null>(null)
|
|
62
|
+
const [shippingMethodId, setShippingMethodId] = useState<string | null>(
|
|
63
|
+
cart.shipping_methods?.at(-1)?.shipping_option_id || null
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
const searchParams = useSearchParams()
|
|
67
|
+
const router = useRouter()
|
|
68
|
+
const pathname = usePathname()
|
|
69
|
+
|
|
70
|
+
const isOpen = searchParams.get("step") === "delivery"
|
|
71
|
+
|
|
72
|
+
const _shippingMethods = availableShippingMethods?.filter(
|
|
73
|
+
(sm) => (sm as any).service_zone?.fulfillment_set?.type !== "pickup"
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
const _pickupMethods = availableShippingMethods?.filter(
|
|
77
|
+
(sm) => (sm as any).service_zone?.fulfillment_set?.type === "pickup"
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
const hasPickupOptions = !!_pickupMethods?.length
|
|
81
|
+
|
|
82
|
+
const handleEdit = () => {
|
|
83
|
+
router.push(pathname + "?step=delivery", { scroll: false })
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const handleSubmit = () => {
|
|
87
|
+
router.push(pathname + "?step=payment", { scroll: false })
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const handleSetShippingMethod = async (
|
|
91
|
+
id: string,
|
|
92
|
+
variant: "shipping" | "pickup"
|
|
93
|
+
) => {
|
|
94
|
+
setError(null)
|
|
95
|
+
|
|
96
|
+
if (variant === "pickup") {
|
|
97
|
+
setShowPickupOptions(PICKUP_OPTION_ON)
|
|
98
|
+
} else {
|
|
99
|
+
setShowPickupOptions(PICKUP_OPTION_OFF)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
let currentId: string | null = null
|
|
103
|
+
setIsLoading(true)
|
|
104
|
+
setShippingMethodId((prev) => {
|
|
105
|
+
currentId = prev
|
|
106
|
+
return id
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
await setShippingMethod({ cartId: cart.id, shippingMethodId: id })
|
|
110
|
+
.catch((err) => {
|
|
111
|
+
setShippingMethodId(currentId)
|
|
112
|
+
|
|
113
|
+
setError(err.message)
|
|
114
|
+
})
|
|
115
|
+
.finally(() => {
|
|
116
|
+
setIsLoading(false)
|
|
117
|
+
})
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Track last calculation parameters to avoid redundant calculations
|
|
121
|
+
const [lastCalcParams, setLastCalcParams] = useState({ postalCode: "", totalWeight: 0 })
|
|
122
|
+
|
|
123
|
+
useEffect(() => {
|
|
124
|
+
const fetchPrices = async () => {
|
|
125
|
+
const postalCode = cart.shipping_address?.postal_code || ""
|
|
126
|
+
const totalWeight = cart.items?.reduce((acc, item) => acc + ((item.variant as any)?.weight || 500) * item.quantity, 0) || 0
|
|
127
|
+
|
|
128
|
+
if (!postalCode || _shippingMethods?.length === 0) {
|
|
129
|
+
setIsLoadingPrices(false)
|
|
130
|
+
return
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Don't re-calculate if pincode and weight haven't changed
|
|
134
|
+
if (postalCode === lastCalcParams.postalCode && totalWeight === lastCalcParams.totalWeight) {
|
|
135
|
+
setIsLoadingPrices(false)
|
|
136
|
+
return
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
setIsLoadingPrices(true)
|
|
140
|
+
const promises = _shippingMethods!
|
|
141
|
+
.filter((sm) => sm.price_type === "calculated")
|
|
142
|
+
.map((sm) => calculatePriceForShippingOption(sm.id, cart.id))
|
|
143
|
+
|
|
144
|
+
if (promises.length) {
|
|
145
|
+
const res = await Promise.allSettled(promises)
|
|
146
|
+
const pricesMap: Record<string, number> = {}
|
|
147
|
+
res.forEach((p: any) => {
|
|
148
|
+
if (p.status === "fulfilled" && p.value) {
|
|
149
|
+
pricesMap[(p.value as any).id || ""] = (p.value as any).amount!
|
|
150
|
+
}
|
|
151
|
+
})
|
|
152
|
+
setCalculatedPricesMap(pricesMap)
|
|
153
|
+
setLastCalcParams({ postalCode, totalWeight })
|
|
154
|
+
}
|
|
155
|
+
setIsLoadingPrices(false)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
fetchPrices()
|
|
159
|
+
|
|
160
|
+
if (_pickupMethods?.find((m) => m.id === shippingMethodId)) {
|
|
161
|
+
setShowPickupOptions(PICKUP_OPTION_ON)
|
|
162
|
+
}
|
|
163
|
+
}, [availableShippingMethods, cart.shipping_address?.postal_code, cart.items])
|
|
164
|
+
|
|
165
|
+
useEffect(() => {
|
|
166
|
+
// Process single option selection in background BUT DO NOT AUTO-SUBMIT/REDIRECT
|
|
167
|
+
const autoSelect = async () => {
|
|
168
|
+
if (isOpen && availableShippingMethods?.length === 1) {
|
|
169
|
+
const singleOption = availableShippingMethods[0]
|
|
170
|
+
const methodType = (singleOption as any).service_zone?.fulfillment_set?.type === "pickup" ? "pickup" : "shipping"
|
|
171
|
+
|
|
172
|
+
// If not selected, select it silently
|
|
173
|
+
if (shippingMethodId !== singleOption.id) {
|
|
174
|
+
setError(null)
|
|
175
|
+
setShippingMethodId(singleOption.id)
|
|
176
|
+
|
|
177
|
+
const { setShippingMethodSilently } = await import("@core/data/cart")
|
|
178
|
+
await setShippingMethodSilently({ cartId: cart.id, shippingMethodId: singleOption.id })
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
autoSelect()
|
|
184
|
+
}, [availableShippingMethods, isOpen, shippingMethodId, cart.id])
|
|
185
|
+
|
|
186
|
+
useEffect(() => {
|
|
187
|
+
setError(null)
|
|
188
|
+
}, [isOpen])
|
|
189
|
+
|
|
190
|
+
if (!isOpen && (cart.shipping_methods?.length ?? 0) === 0) {
|
|
191
|
+
return null
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
if (availableShippingMethods?.length === 1) {
|
|
195
|
+
return null
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return (
|
|
199
|
+
<div className="bg-page-bg">
|
|
200
|
+
<div className="flex flex-row items-center justify-between mb-6">
|
|
201
|
+
<Heading
|
|
202
|
+
level="h2"
|
|
203
|
+
className={clx(
|
|
204
|
+
"flex flex-row text-2xl font-bold text-heading gap-x-2 items-baseline",
|
|
205
|
+
{
|
|
206
|
+
"opacity-50 pointer-events-none select-none":
|
|
207
|
+
!isOpen && cart.shipping_methods?.length === 0,
|
|
208
|
+
"hidden": availableShippingMethods?.length === 1,
|
|
209
|
+
}
|
|
210
|
+
)}
|
|
211
|
+
>
|
|
212
|
+
DELIVERY
|
|
213
|
+
{!isOpen && (cart.shipping_methods?.length ?? 0) > 0 && (
|
|
214
|
+
<CheckCircleSolid />
|
|
215
|
+
)}
|
|
216
|
+
</Heading>
|
|
217
|
+
{availableShippingMethods?.length !== 1 && !isOpen &&
|
|
218
|
+
cart?.shipping_address &&
|
|
219
|
+
cart?.billing_address &&
|
|
220
|
+
cart?.email && (
|
|
221
|
+
<Text>
|
|
222
|
+
<button
|
|
223
|
+
onClick={handleEdit}
|
|
224
|
+
className="text-ui-fg-interactive hover:text-ui-fg-interactive-hover"
|
|
225
|
+
data-testid="edit-delivery-button"
|
|
226
|
+
>
|
|
227
|
+
Edit
|
|
228
|
+
</button>
|
|
229
|
+
</Text>
|
|
230
|
+
)}
|
|
231
|
+
</div>
|
|
232
|
+
{isOpen ? (
|
|
233
|
+
<>
|
|
234
|
+
{availableShippingMethods?.length === 1 ? (
|
|
235
|
+
<div className="hidden" />
|
|
236
|
+
) : (
|
|
237
|
+
<>
|
|
238
|
+
{/* White Card Container */}
|
|
239
|
+
<div className="bg-page-bg rounded-xl border p-6 shadow-sm" style={{ borderColor: 'var(--color-border)' }}>
|
|
240
|
+
<div className="mb-6">
|
|
241
|
+
<span className="font-bold text-base text-heading block mb-1">
|
|
242
|
+
Shipping Method
|
|
243
|
+
</span>
|
|
244
|
+
<span className="text-sm text-gray-500">
|
|
245
|
+
How would you like your order delivered
|
|
246
|
+
</span>
|
|
247
|
+
</div>
|
|
248
|
+
|
|
249
|
+
<div data-testid="delivery-options-container" className="space-y-2">
|
|
250
|
+
{hasPickupOptions && (
|
|
251
|
+
<RadioGroup
|
|
252
|
+
value={showPickupOptions}
|
|
253
|
+
onChange={(value) => {
|
|
254
|
+
const id = _pickupMethods.find(
|
|
255
|
+
(option) => !option.insufficient_inventory
|
|
256
|
+
)?.id
|
|
257
|
+
|
|
258
|
+
if (id) {
|
|
259
|
+
handleSetShippingMethod(id, "pickup")
|
|
260
|
+
}
|
|
261
|
+
}}
|
|
262
|
+
>
|
|
263
|
+
<Radio
|
|
264
|
+
value={PICKUP_OPTION_ON}
|
|
265
|
+
data-testid="delivery-option-radio"
|
|
266
|
+
className={clx(
|
|
267
|
+
"flex items-center justify-between cursor-pointer py-4 px-4 rounded-lg transition-all border-2",
|
|
268
|
+
{
|
|
269
|
+
"bg-brand-accent-muted":
|
|
270
|
+
showPickupOptions === PICKUP_OPTION_ON,
|
|
271
|
+
"bg-white border":
|
|
272
|
+
showPickupOptions !== PICKUP_OPTION_ON,
|
|
273
|
+
}
|
|
274
|
+
)}
|
|
275
|
+
style={{ borderColor: 'var(--color-border)' }}
|
|
276
|
+
>
|
|
277
|
+
<div className="flex items-center gap-x-4">
|
|
278
|
+
<div
|
|
279
|
+
className={clx(
|
|
280
|
+
"w-5 h-5 rounded-full border-2 flex items-center justify-center transition-all",
|
|
281
|
+
{
|
|
282
|
+
"bg-white": showPickupOptions !== PICKUP_OPTION_ON,
|
|
283
|
+
}
|
|
284
|
+
)}
|
|
285
|
+
style={showPickupOptions === PICKUP_OPTION_ON ? { backgroundColor: 'var(--color-brand-accent)', borderColor: 'var(--color-brand-accent)' } : { borderColor: 'var(--color-border)' }}
|
|
286
|
+
>
|
|
287
|
+
{showPickupOptions === PICKUP_OPTION_ON && (
|
|
288
|
+
<div className="w-2 h-2 rounded-full bg-white" />
|
|
289
|
+
)}
|
|
290
|
+
</div>
|
|
291
|
+
<span className="text-base font-medium text-heading">
|
|
292
|
+
Pick up your order
|
|
293
|
+
</span>
|
|
294
|
+
</div>
|
|
295
|
+
<span className="text-base font-medium text-gray-500">
|
|
296
|
+
-
|
|
297
|
+
</span>
|
|
298
|
+
</Radio>
|
|
299
|
+
</RadioGroup>
|
|
300
|
+
)}
|
|
301
|
+
|
|
302
|
+
<RadioGroup
|
|
303
|
+
value={shippingMethodId}
|
|
304
|
+
onChange={(v) => {
|
|
305
|
+
if (v) {
|
|
306
|
+
return handleSetShippingMethod(v, "shipping")
|
|
307
|
+
}
|
|
308
|
+
}}
|
|
309
|
+
className="space-y-2"
|
|
310
|
+
>
|
|
311
|
+
{_shippingMethods?.map((option) => {
|
|
312
|
+
const isDisabled =
|
|
313
|
+
option.price_type === "calculated" &&
|
|
314
|
+
!isLoadingPrices &&
|
|
315
|
+
typeof calculatedPricesMap[option.id] !== "number"
|
|
316
|
+
|
|
317
|
+
const isSelected = option.id === shippingMethodId
|
|
318
|
+
const price = option.price_type === "flat"
|
|
319
|
+
? convertToLocale({
|
|
320
|
+
amount: option.amount!,
|
|
321
|
+
currency_code: cart?.currency_code,
|
|
322
|
+
})
|
|
323
|
+
: calculatedPricesMap[option.id]
|
|
324
|
+
? convertToLocale({
|
|
325
|
+
amount: calculatedPricesMap[option.id],
|
|
326
|
+
currency_code: cart?.currency_code,
|
|
327
|
+
})
|
|
328
|
+
: isLoadingPrices
|
|
329
|
+
? null
|
|
330
|
+
: "-"
|
|
331
|
+
|
|
332
|
+
return (
|
|
333
|
+
<Radio
|
|
334
|
+
key={option.id}
|
|
335
|
+
value={option.id}
|
|
336
|
+
data-testid="delivery-option-radio"
|
|
337
|
+
disabled={isDisabled}
|
|
338
|
+
className={clx(
|
|
339
|
+
"flex items-center justify-between cursor-pointer py-4 px-4 rounded-lg transition-all border-2",
|
|
340
|
+
{
|
|
341
|
+
"bg-brand-accent-muted": isSelected && !isDisabled,
|
|
342
|
+
"bg-page-bg border": !isSelected && !isDisabled,
|
|
343
|
+
"bg-gray-50 border cursor-not-allowed opacity-50": isDisabled,
|
|
344
|
+
}
|
|
345
|
+
)}
|
|
346
|
+
style={{ borderColor: 'var(--color-border)' }}
|
|
347
|
+
>
|
|
348
|
+
<div className="flex items-center gap-x-4">
|
|
349
|
+
<div
|
|
350
|
+
className={clx(
|
|
351
|
+
"w-5 h-5 rounded-full border-2 flex items-center justify-center transition-all",
|
|
352
|
+
{
|
|
353
|
+
"bg-white": !isSelected && !isDisabled,
|
|
354
|
+
"bg-gray-100": isDisabled,
|
|
355
|
+
}
|
|
356
|
+
)}
|
|
357
|
+
style={isSelected && !isDisabled ? { backgroundColor: 'var(--color-brand-accent)', borderColor: 'var(--color-brand-accent)' } : { borderColor: 'var(--color-border)' }}
|
|
358
|
+
>
|
|
359
|
+
{isSelected && !isDisabled && (
|
|
360
|
+
<div className="w-2 h-2 rounded-full bg-white" />
|
|
361
|
+
)}
|
|
362
|
+
</div>
|
|
363
|
+
<span className={clx(
|
|
364
|
+
"text-base font-medium",
|
|
365
|
+
{
|
|
366
|
+
"text-heading": !isDisabled,
|
|
367
|
+
"text-gray-400": isDisabled,
|
|
368
|
+
}
|
|
369
|
+
)}>
|
|
370
|
+
{option.name}
|
|
371
|
+
</span>
|
|
372
|
+
</div>
|
|
373
|
+
<span className={clx(
|
|
374
|
+
"text-base font-medium",
|
|
375
|
+
{
|
|
376
|
+
"text-heading": !isDisabled && isSelected,
|
|
377
|
+
"text-gray-600": !isDisabled && !isSelected,
|
|
378
|
+
"text-gray-400": isDisabled,
|
|
379
|
+
}
|
|
380
|
+
)}>
|
|
381
|
+
{(isLoadingPrices || isLoading) && !price ? <Loader className="w-4 h-4 animate-spin" /> : price}
|
|
382
|
+
{isLoading && isSelected && price && (
|
|
383
|
+
<Loader className="w-4 h-4 animate-spin ml-2 inline-block" />
|
|
384
|
+
)}
|
|
385
|
+
</span>
|
|
386
|
+
</Radio>
|
|
387
|
+
)
|
|
388
|
+
})}
|
|
389
|
+
</RadioGroup>
|
|
390
|
+
</div>
|
|
391
|
+
</div>
|
|
392
|
+
|
|
393
|
+
{showPickupOptions === PICKUP_OPTION_ON && (
|
|
394
|
+
<div className="bg-page-bg rounded-xl border p-6 shadow-sm mt-4" style={{ borderColor: 'var(--color-border)' }}>
|
|
395
|
+
<div className="mb-6">
|
|
396
|
+
<span className="font-bold text-base text-heading block mb-1">
|
|
397
|
+
Store
|
|
398
|
+
</span>
|
|
399
|
+
<span className="text-sm text-gray-500">
|
|
400
|
+
Choose a store near you
|
|
401
|
+
</span>
|
|
402
|
+
</div>
|
|
403
|
+
<div data-testid="delivery-options-container" className="space-y-2">
|
|
404
|
+
<RadioGroup
|
|
405
|
+
value={shippingMethodId}
|
|
406
|
+
onChange={(v) => {
|
|
407
|
+
if (v) {
|
|
408
|
+
return handleSetShippingMethod(v, "pickup")
|
|
409
|
+
}
|
|
410
|
+
}}
|
|
411
|
+
>
|
|
412
|
+
{_pickupMethods?.map((option) => {
|
|
413
|
+
const isSelected = option.id === shippingMethodId
|
|
414
|
+
return (
|
|
415
|
+
<Radio
|
|
416
|
+
key={option.id}
|
|
417
|
+
value={option.id}
|
|
418
|
+
disabled={option.insufficient_inventory}
|
|
419
|
+
data-testid="delivery-option-radio"
|
|
420
|
+
className={clx(
|
|
421
|
+
"flex items-center justify-between cursor-pointer py-4 px-4 rounded-lg transition-all border-2",
|
|
422
|
+
{
|
|
423
|
+
"bg-brand-accent-muted": isSelected && !option.insufficient_inventory,
|
|
424
|
+
"bg-white border": !isSelected && !option.insufficient_inventory,
|
|
425
|
+
"bg-gray-50 border cursor-not-allowed opacity-50": option.insufficient_inventory,
|
|
426
|
+
}
|
|
427
|
+
)}
|
|
428
|
+
style={{ borderColor: 'var(--color-border)' }}
|
|
429
|
+
>
|
|
430
|
+
<div className="flex items-start gap-x-4 flex-1">
|
|
431
|
+
<div
|
|
432
|
+
className={clx(
|
|
433
|
+
"w-5 h-5 rounded-full border-2 flex items-center justify-center transition-all mt-0.5 flex-shrink-0",
|
|
434
|
+
{
|
|
435
|
+
"bg-white": !isSelected && !option.insufficient_inventory,
|
|
436
|
+
"bg-gray-100": option.insufficient_inventory,
|
|
437
|
+
}
|
|
438
|
+
)}
|
|
439
|
+
style={isSelected && !option.insufficient_inventory ? { backgroundColor: 'var(--color-brand-accent)', borderColor: 'var(--color-brand-accent)' } : { borderColor: 'var(--color-border)' }}
|
|
440
|
+
>
|
|
441
|
+
{isSelected && !option.insufficient_inventory && (
|
|
442
|
+
<div className="w-2 h-2 rounded-full bg-white" />
|
|
443
|
+
)}
|
|
444
|
+
</div>
|
|
445
|
+
<div className="flex flex-col">
|
|
446
|
+
<span className={clx(
|
|
447
|
+
"text-base font-medium",
|
|
448
|
+
{
|
|
449
|
+
"text-heading": !option.insufficient_inventory,
|
|
450
|
+
"text-gray-400": option.insufficient_inventory,
|
|
451
|
+
}
|
|
452
|
+
)}>
|
|
453
|
+
{option.name}
|
|
454
|
+
</span>
|
|
455
|
+
<span className={clx(
|
|
456
|
+
"text-sm mt-1",
|
|
457
|
+
{
|
|
458
|
+
"text-gray-500": !option.insufficient_inventory,
|
|
459
|
+
"text-gray-400": option.insufficient_inventory,
|
|
460
|
+
}
|
|
461
|
+
)}>
|
|
462
|
+
{formatAddress(
|
|
463
|
+
(option as any).service_zone?.fulfillment_set?.location
|
|
464
|
+
?.address
|
|
465
|
+
)}
|
|
466
|
+
</span>
|
|
467
|
+
</div>
|
|
468
|
+
</div>
|
|
469
|
+
<span className={clx(
|
|
470
|
+
"text-base font-medium ml-4",
|
|
471
|
+
{
|
|
472
|
+
"text-heading": !option.insufficient_inventory && isSelected,
|
|
473
|
+
"text-gray-600": !option.insufficient_inventory && !isSelected,
|
|
474
|
+
"text-gray-400": option.insufficient_inventory,
|
|
475
|
+
}
|
|
476
|
+
)}>
|
|
477
|
+
{convertToLocale({
|
|
478
|
+
amount: option.amount!,
|
|
479
|
+
currency_code: cart?.currency_code,
|
|
480
|
+
})}
|
|
481
|
+
</span>
|
|
482
|
+
</Radio>
|
|
483
|
+
)
|
|
484
|
+
})}
|
|
485
|
+
</RadioGroup>
|
|
486
|
+
</div>
|
|
487
|
+
</div>
|
|
488
|
+
)}
|
|
489
|
+
|
|
490
|
+
<div className="mt-6">
|
|
491
|
+
<ErrorMessage
|
|
492
|
+
error={error}
|
|
493
|
+
data-testid="delivery-option-error-message"
|
|
494
|
+
/>
|
|
495
|
+
</div>
|
|
496
|
+
</>
|
|
497
|
+
)}
|
|
498
|
+
</>
|
|
499
|
+
) : (
|
|
500
|
+
<div>
|
|
501
|
+
{cart && (cart.shipping_methods?.length ?? 0) > 0 && availableShippingMethods?.length !== 1 && (
|
|
502
|
+
<div className="bg-white rounded-xl border p-6 shadow-sm" style={{ borderColor: 'var(--color-border)' }}>
|
|
503
|
+
<div className="flex items-center justify-between">
|
|
504
|
+
<div className="flex items-center gap-x-4">
|
|
505
|
+
<div
|
|
506
|
+
className="w-5 h-5 rounded-full border-2 flex items-center justify-center"
|
|
507
|
+
style={{ backgroundColor: 'var(--color-brand-accent)', borderColor: 'var(--color-brand-accent)' }}
|
|
508
|
+
>
|
|
509
|
+
<div className="w-2 h-2 rounded-full bg-white" />
|
|
510
|
+
</div>
|
|
511
|
+
<div>
|
|
512
|
+
<Text className="text-base font-medium text-heading mb-1">
|
|
513
|
+
{cart.shipping_methods!.at(-1)!.name}
|
|
514
|
+
</Text>
|
|
515
|
+
<Text className="text-sm text-gray-500">
|
|
516
|
+
{convertToLocale({
|
|
517
|
+
amount: cart.shipping_methods!.at(-1)!.amount!,
|
|
518
|
+
currency_code: cart?.currency_code,
|
|
519
|
+
})}
|
|
520
|
+
</Text>
|
|
521
|
+
</div>
|
|
522
|
+
</div>
|
|
523
|
+
</div>
|
|
524
|
+
</div>
|
|
525
|
+
)}
|
|
526
|
+
</div>
|
|
527
|
+
)}
|
|
528
|
+
{availableShippingMethods?.length !== 1 && <Divider className="mt-8" />}
|
|
529
|
+
</div>
|
|
530
|
+
)
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
export default Shipping
|