@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,521 @@
|
|
|
1
|
+
import { HttpTypes } from "@medusajs/types"
|
|
2
|
+
import { Container } from "@medusajs/ui"
|
|
3
|
+
import Checkbox from "@modules/common/components/checkbox"
|
|
4
|
+
import Input from "@modules/common/components/input"
|
|
5
|
+
import { mapKeys } from "lodash"
|
|
6
|
+
import React, { useEffect, useMemo, useState } from "react"
|
|
7
|
+
import AddressSelect from "../address-select"
|
|
8
|
+
import CountrySelect from "../country-select"
|
|
9
|
+
import PhoneInput from "react-phone-input-2"
|
|
10
|
+
import "react-phone-input-2/lib/style.css"
|
|
11
|
+
import { State, City } from "country-state-city"
|
|
12
|
+
import Select from "@modules/common/components/select"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
// Normalize phone — default to India (+91) if no country code present
|
|
16
|
+
const normalizePhone = (phone?: string | null): string => {
|
|
17
|
+
if (!phone) return ""
|
|
18
|
+
const digits = phone.replace(/\D/g, "")
|
|
19
|
+
if (digits.length === 10) return `+91${digits}`
|
|
20
|
+
return `+${digits}`
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const ShippingAddress = ({
|
|
24
|
+
customer,
|
|
25
|
+
cart,
|
|
26
|
+
checked,
|
|
27
|
+
onChange,
|
|
28
|
+
clearForm = false,
|
|
29
|
+
}: {
|
|
30
|
+
customer: HttpTypes.StoreCustomer | null
|
|
31
|
+
cart: HttpTypes.StoreCart | null
|
|
32
|
+
checked: boolean
|
|
33
|
+
onChange: () => void
|
|
34
|
+
clearForm?: boolean
|
|
35
|
+
}) => {
|
|
36
|
+
const [formData, setFormData] = useState<Record<string, any>>({
|
|
37
|
+
"shipping_address.full_name": clearForm ? "" : (cart?.shipping_address?.first_name ? `${cart.shipping_address.first_name} ${cart.shipping_address.last_name === "." ? "" : cart.shipping_address.last_name}`.trim() : ""),
|
|
38
|
+
"shipping_address.first_name": clearForm ? "" : (cart?.shipping_address?.first_name || ""),
|
|
39
|
+
"shipping_address.last_name": clearForm ? "" : (cart?.shipping_address?.last_name || ""),
|
|
40
|
+
"shipping_address.address_1": clearForm ? "" : (cart?.shipping_address?.address_1 || ""),
|
|
41
|
+
"shipping_address.company": clearForm ? "" : (cart?.shipping_address?.company || ""),
|
|
42
|
+
"shipping_address.postal_code": clearForm ? "" : (cart?.shipping_address?.postal_code || ""),
|
|
43
|
+
"shipping_address.city": clearForm ? "" : (cart?.shipping_address?.city || ""),
|
|
44
|
+
"shipping_address.country_code": clearForm ? "" : (cart?.shipping_address?.country_code || ""),
|
|
45
|
+
"shipping_address.province": clearForm ? "" : (cart?.shipping_address?.province || ""),
|
|
46
|
+
"shipping_address.phone": clearForm ? "" : normalizePhone(cart?.shipping_address?.phone),
|
|
47
|
+
email: clearForm ? "" : (cart?.email || ""),
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
const countryCodeUpper = (formData["shipping_address.country_code"] || "").toUpperCase()
|
|
51
|
+
|
|
52
|
+
const stateOptions = useMemo(() => {
|
|
53
|
+
if (!countryCodeUpper) return []
|
|
54
|
+
try {
|
|
55
|
+
return State.getStatesOfCountry(countryCodeUpper).map((s) => ({
|
|
56
|
+
value: s.name,
|
|
57
|
+
label: s.name,
|
|
58
|
+
isoCode: s.isoCode,
|
|
59
|
+
}))
|
|
60
|
+
} catch (e) {
|
|
61
|
+
return []
|
|
62
|
+
}
|
|
63
|
+
}, [countryCodeUpper])
|
|
64
|
+
|
|
65
|
+
const cityOptions = useMemo(() => {
|
|
66
|
+
if (!countryCodeUpper || !formData["shipping_address.province"]) return []
|
|
67
|
+
try {
|
|
68
|
+
const selectedStateObj = stateOptions.find(
|
|
69
|
+
(s) => s.value === formData["shipping_address.province"]
|
|
70
|
+
)
|
|
71
|
+
if (!selectedStateObj) return []
|
|
72
|
+
const cities = City.getCitiesOfState(countryCodeUpper, selectedStateObj.isoCode)
|
|
73
|
+
const uniqueNames = Array.from(new Set(cities.map((c) => c.name)))
|
|
74
|
+
return uniqueNames.map((name) => ({
|
|
75
|
+
value: name,
|
|
76
|
+
label: name,
|
|
77
|
+
}))
|
|
78
|
+
} catch (e) {
|
|
79
|
+
return []
|
|
80
|
+
}
|
|
81
|
+
}, [countryCodeUpper, formData["shipping_address.province"], stateOptions])
|
|
82
|
+
|
|
83
|
+
const countriesInRegion = useMemo(
|
|
84
|
+
() => cart?.region?.countries?.map((c) => c.iso_2),
|
|
85
|
+
[cart?.region]
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
// check if customer has saved addresses that are in the current region
|
|
89
|
+
const addressesInRegion = useMemo(
|
|
90
|
+
() =>
|
|
91
|
+
customer?.addresses.filter(
|
|
92
|
+
(a) => a.country_code && countriesInRegion?.includes(a.country_code)
|
|
93
|
+
),
|
|
94
|
+
[customer?.addresses, countriesInRegion]
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
const setFormAddress = (
|
|
98
|
+
address?: HttpTypes.StoreCartAddress,
|
|
99
|
+
email?: string
|
|
100
|
+
) => {
|
|
101
|
+
address &&
|
|
102
|
+
setFormData((prevState: Record<string, any>) => ({
|
|
103
|
+
...prevState,
|
|
104
|
+
"shipping_address.full_name": address?.first_name ? `${address.first_name} ${address.last_name === "." ? "" : address.last_name}`.trim() : "",
|
|
105
|
+
"shipping_address.first_name": address?.first_name || "",
|
|
106
|
+
"shipping_address.last_name": address?.last_name || "",
|
|
107
|
+
"shipping_address.address_1": address?.address_1 || "",
|
|
108
|
+
"shipping_address.company": address?.company || "",
|
|
109
|
+
"shipping_address.postal_code": address?.postal_code || "",
|
|
110
|
+
"shipping_address.city": address?.city || "",
|
|
111
|
+
"shipping_address.country_code": address?.country_code || "",
|
|
112
|
+
"shipping_address.province": address?.province || "",
|
|
113
|
+
"shipping_address.phone": normalizePhone(address?.phone),
|
|
114
|
+
}))
|
|
115
|
+
|
|
116
|
+
email &&
|
|
117
|
+
setFormData((prevState: Record<string, any>) => ({
|
|
118
|
+
...prevState,
|
|
119
|
+
email: email,
|
|
120
|
+
}))
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Unified Sync Watcher: Handles clean-form, cart-sync, and customer-sync with local priority
|
|
124
|
+
useEffect(() => {
|
|
125
|
+
if (clearForm) {
|
|
126
|
+
setFormData({
|
|
127
|
+
"shipping_address.full_name": "",
|
|
128
|
+
"shipping_address.first_name": "",
|
|
129
|
+
"shipping_address.last_name": "",
|
|
130
|
+
"shipping_address.address_1": "",
|
|
131
|
+
"shipping_address.company": "",
|
|
132
|
+
"shipping_address.postal_code": "",
|
|
133
|
+
"shipping_address.city": "",
|
|
134
|
+
"shipping_address.country_code": "",
|
|
135
|
+
"shipping_address.province": "",
|
|
136
|
+
"shipping_address.phone": "",
|
|
137
|
+
email: "",
|
|
138
|
+
})
|
|
139
|
+
return
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (cart && cart.shipping_address) {
|
|
143
|
+
const shipping = cart.shipping_address
|
|
144
|
+
setFormData((prev: any) => ({
|
|
145
|
+
...prev,
|
|
146
|
+
email: prev.email || cart.email || "",
|
|
147
|
+
"shipping_address.full_name": prev["shipping_address.full_name"] || (shipping.first_name ? `${shipping.first_name} ${shipping.last_name === "." ? "" : shipping.last_name}`.trim() : ""),
|
|
148
|
+
"shipping_address.first_name": prev["shipping_address.first_name"] || shipping.first_name || "",
|
|
149
|
+
"shipping_address.last_name": prev["shipping_address.last_name"] || shipping.last_name || "",
|
|
150
|
+
"shipping_address.address_1": prev["shipping_address.address_1"] || shipping.address_1 || "",
|
|
151
|
+
"shipping_address.company": prev["shipping_address.company"] || shipping.company || "",
|
|
152
|
+
"shipping_address.postal_code": prev["shipping_address.postal_code"] || shipping.postal_code || "",
|
|
153
|
+
"shipping_address.city": prev["shipping_address.city"] || shipping.city || "",
|
|
154
|
+
"shipping_address.province": prev["shipping_address.province"] || shipping.province || "",
|
|
155
|
+
"shipping_address.phone": prev["shipping_address.phone"] || normalizePhone(shipping.phone),
|
|
156
|
+
"shipping_address.country_code": prev["shipping_address.country_code"] || shipping.country_code || "",
|
|
157
|
+
}))
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (customer && !formData.email && !formData["shipping_address.first_name"]) {
|
|
161
|
+
setFormData((prev) => ({
|
|
162
|
+
...prev,
|
|
163
|
+
"shipping_address.full_name": prev["shipping_address.full_name"] || (customer.first_name ? `${customer.first_name} ${customer.last_name === "." ? "" : customer.last_name}`.trim() : ""),
|
|
164
|
+
"shipping_address.first_name": prev["shipping_address.first_name"] || customer.first_name || "",
|
|
165
|
+
"shipping_address.last_name": prev["shipping_address.last_name"] || customer.last_name || "",
|
|
166
|
+
"shipping_address.phone": prev["shipping_address.phone"] || normalizePhone(customer.phone),
|
|
167
|
+
email: prev.email || customer.email || "",
|
|
168
|
+
}))
|
|
169
|
+
}
|
|
170
|
+
}, [cart?.id, cart?.shipping_address?.id, clearForm, customer])
|
|
171
|
+
|
|
172
|
+
// Triple Lock Watcher: Automatically trigger shipping calculation when all 3 fields are ready
|
|
173
|
+
useEffect(() => {
|
|
174
|
+
const pincode = formData["shipping_address.postal_code"]
|
|
175
|
+
const email = formData.email
|
|
176
|
+
const phone = formData["shipping_address.phone"]
|
|
177
|
+
const cleanedPhone = phone ? phone.replace(/\D/g, "") : ""
|
|
178
|
+
|
|
179
|
+
if (pincode?.length === 6 && email?.includes("@") && email?.includes(".") && cleanedPhone.length >= 12) {
|
|
180
|
+
if ((window as any).triggerTimeout) clearTimeout((window as any).triggerTimeout);
|
|
181
|
+
// Check if data has actually changed compared to the cart to prevent redundant updates
|
|
182
|
+
const currentShipping = (cart as any)?.shipping_address
|
|
183
|
+
const hasChanged =
|
|
184
|
+
(pincode?.trim() || "") !== ((currentShipping?.postal_code as string)?.trim() || "") ||
|
|
185
|
+
(email?.trim().toLowerCase() || "") !== ((cart?.email as string)?.trim().toLowerCase() || "") ||
|
|
186
|
+
(formData["shipping_address.city"]?.trim().toLowerCase() || "") !== ((currentShipping?.city as string)?.trim().toLowerCase() || "") ||
|
|
187
|
+
(formData["shipping_address.province"]?.trim().toLowerCase() || "") !== ((currentShipping?.province as string)?.trim().toLowerCase() || "") ||
|
|
188
|
+
(formData["shipping_address.phone"]?.replace(/\D/g, "") !== currentShipping?.phone?.replace(/\D/g, ""))
|
|
189
|
+
|
|
190
|
+
if (!hasChanged) return;
|
|
191
|
+
|
|
192
|
+
(window as any).triggerTimeout = setTimeout(() => {
|
|
193
|
+
window.dispatchEvent(new CustomEvent('postal-code-updated', {
|
|
194
|
+
detail: {
|
|
195
|
+
postal_code: pincode,
|
|
196
|
+
city: formData["shipping_address.city"],
|
|
197
|
+
province: formData["shipping_address.province"],
|
|
198
|
+
email: email,
|
|
199
|
+
phone: formData["shipping_address.phone"],
|
|
200
|
+
first_name: formData["shipping_address.first_name"],
|
|
201
|
+
last_name: formData["shipping_address.last_name"],
|
|
202
|
+
address_1: formData["shipping_address.address_1"],
|
|
203
|
+
company: formData["shipping_address.company"]
|
|
204
|
+
}
|
|
205
|
+
}))
|
|
206
|
+
}, 400)
|
|
207
|
+
}
|
|
208
|
+
}, [
|
|
209
|
+
formData["shipping_address.postal_code"],
|
|
210
|
+
formData.email,
|
|
211
|
+
formData["shipping_address.phone"],
|
|
212
|
+
formData["shipping_address.city"],
|
|
213
|
+
formData["shipping_address.province"]
|
|
214
|
+
])
|
|
215
|
+
|
|
216
|
+
const handleChange = (e: React.ChangeEvent<HTMLInputElement | HTMLSelectElement>) => {
|
|
217
|
+
const { name, value } = e.target
|
|
218
|
+
let sanitizedValue = value
|
|
219
|
+
|
|
220
|
+
// Handle full name specifically
|
|
221
|
+
if (name === "shipping_address.full_name") {
|
|
222
|
+
const [first, ...rest] = value.split(" ")
|
|
223
|
+
const last = rest.join(" ") || "."
|
|
224
|
+
setFormData((prev) => ({
|
|
225
|
+
...prev,
|
|
226
|
+
[name]: value,
|
|
227
|
+
"shipping_address.first_name": first || "",
|
|
228
|
+
"shipping_address.last_name": last,
|
|
229
|
+
}))
|
|
230
|
+
return
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// Reset province/city when country changes
|
|
234
|
+
if (name === "shipping_address.country_code") {
|
|
235
|
+
setFormData((prev) => ({
|
|
236
|
+
...prev,
|
|
237
|
+
[name]: sanitizedValue,
|
|
238
|
+
"shipping_address.province": "",
|
|
239
|
+
"shipping_address.city": "",
|
|
240
|
+
}))
|
|
241
|
+
return
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// Reset city when province changes
|
|
245
|
+
if (name === "shipping_address.province") {
|
|
246
|
+
setFormData((prev) => ({
|
|
247
|
+
...prev,
|
|
248
|
+
[name]: sanitizedValue,
|
|
249
|
+
"shipping_address.city": "",
|
|
250
|
+
}))
|
|
251
|
+
return
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// 1. Sanitize names and locations
|
|
255
|
+
if (name.includes("first_name") || name.includes("last_name") || name.includes("city") || name.includes("province")) {
|
|
256
|
+
sanitizedValue = value.replace(/[^A-Za-z\s]/g, "")
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// 2. Sanitize pincode
|
|
260
|
+
if (name.includes("postal_code")) {
|
|
261
|
+
sanitizedValue = value.replace(/\D/g, "").slice(0, 6)
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
setFormData((prev) => ({
|
|
265
|
+
...prev,
|
|
266
|
+
[name]: sanitizedValue,
|
|
267
|
+
}))
|
|
268
|
+
|
|
269
|
+
// 3. Immediate City/State fetch for Pincode
|
|
270
|
+
if (name === "shipping_address.postal_code" && sanitizedValue.length === 6) {
|
|
271
|
+
const fetchLocation = async () => {
|
|
272
|
+
try {
|
|
273
|
+
const response = await fetch(`https://api.postalpincode.in/pincode/${sanitizedValue}`)
|
|
274
|
+
const data = await response.json()
|
|
275
|
+
if (data[0].Status === "Success") {
|
|
276
|
+
const postOffice = data[0].PostOffice[0]
|
|
277
|
+
setFormData((prev) => ({
|
|
278
|
+
...prev,
|
|
279
|
+
"shipping_address.city": postOffice.District,
|
|
280
|
+
"shipping_address.province": postOffice.State,
|
|
281
|
+
}))
|
|
282
|
+
}
|
|
283
|
+
} catch (e) {}
|
|
284
|
+
}
|
|
285
|
+
fetchLocation()
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
const [phoneError, setPhoneError] = useState(false)
|
|
290
|
+
|
|
291
|
+
useEffect(() => {
|
|
292
|
+
const handleTrigger = () => {
|
|
293
|
+
const phoneValue = formData["shipping_address.phone"] || ""
|
|
294
|
+
const digits = phoneValue.replace(/\D/g, "")
|
|
295
|
+
// For India (+91), expect at least 12 digits (2 for 91, 10 for local)
|
|
296
|
+
if (digits.length < 12) {
|
|
297
|
+
setPhoneError(true)
|
|
298
|
+
} else {
|
|
299
|
+
setPhoneError(false)
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
window.addEventListener('trigger-checkout-step', handleTrigger)
|
|
303
|
+
return () => window.removeEventListener('trigger-checkout-step', handleTrigger)
|
|
304
|
+
}, [formData["shipping_address.phone"]])
|
|
305
|
+
|
|
306
|
+
return (
|
|
307
|
+
<>
|
|
308
|
+
{customer && (addressesInRegion?.length || 0) > 0 && (
|
|
309
|
+
<Container className="mb-6 flex flex-col gap-y-4 p-5">
|
|
310
|
+
<p className="text-small-regular">
|
|
311
|
+
{`Hi ${customer.first_name}, do you want to use one of your saved addresses?`}
|
|
312
|
+
</p>
|
|
313
|
+
<AddressSelect
|
|
314
|
+
addresses={customer.addresses}
|
|
315
|
+
addressInput={
|
|
316
|
+
mapKeys(formData, (_, key) =>
|
|
317
|
+
key.replace("shipping_address.", "")
|
|
318
|
+
) as HttpTypes.StoreCartAddress
|
|
319
|
+
}
|
|
320
|
+
onSelect={setFormAddress}
|
|
321
|
+
/>
|
|
322
|
+
</Container>
|
|
323
|
+
)}
|
|
324
|
+
{/* Full Name */}
|
|
325
|
+
<div className="mb-4">
|
|
326
|
+
<Input
|
|
327
|
+
label="Full name"
|
|
328
|
+
name="shipping_address.full_name"
|
|
329
|
+
id="shipping_full_name_field"
|
|
330
|
+
autoComplete="name"
|
|
331
|
+
value={formData["shipping_address.full_name"]}
|
|
332
|
+
onChange={handleChange}
|
|
333
|
+
required
|
|
334
|
+
maxLength={60}
|
|
335
|
+
data-testid="shipping-full-name-input"
|
|
336
|
+
/>
|
|
337
|
+
{/* Hidden inputs to feed Medusa's first/last name fields */}
|
|
338
|
+
<input type="hidden" name="shipping_address.first_name" value={formData["shipping_address.first_name"]} />
|
|
339
|
+
<input type="hidden" name="shipping_address.last_name" value={formData["shipping_address.last_name"]} />
|
|
340
|
+
</div>
|
|
341
|
+
|
|
342
|
+
{/* Address */}
|
|
343
|
+
<div className="mb-4">
|
|
344
|
+
<Input
|
|
345
|
+
label="Address"
|
|
346
|
+
name="shipping_address.address_1"
|
|
347
|
+
id="shipping_address_1_field"
|
|
348
|
+
autoComplete="off"
|
|
349
|
+
value={formData["shipping_address.address_1"]}
|
|
350
|
+
onChange={handleChange}
|
|
351
|
+
required
|
|
352
|
+
data-testid="shipping-address-input"
|
|
353
|
+
/>
|
|
354
|
+
</div>
|
|
355
|
+
|
|
356
|
+
{/* Postal, City, State Flattened Grid */}
|
|
357
|
+
<div className="grid grid-cols-1 min-[550px]:grid-cols-3 gap-4 mb-4">
|
|
358
|
+
<Input
|
|
359
|
+
label="Postal code*"
|
|
360
|
+
name="shipping_address.postal_code"
|
|
361
|
+
id="shipping_postal_code_field"
|
|
362
|
+
autoComplete="off"
|
|
363
|
+
value={formData["shipping_address.postal_code"]}
|
|
364
|
+
onChange={handleChange}
|
|
365
|
+
required
|
|
366
|
+
maxLength={formData["shipping_address.country_code"] === "in" ? 6 : 10}
|
|
367
|
+
data-testid="shipping-postal-code-input"
|
|
368
|
+
/>
|
|
369
|
+
{cityOptions.length > 0 ? (
|
|
370
|
+
<Select
|
|
371
|
+
label="City*"
|
|
372
|
+
name="shipping_address.city"
|
|
373
|
+
id="shipping_city_field"
|
|
374
|
+
value={formData["shipping_address.city"]}
|
|
375
|
+
onChange={handleChange}
|
|
376
|
+
required
|
|
377
|
+
options={cityOptions}
|
|
378
|
+
data-testid="shipping-city-input"
|
|
379
|
+
/>
|
|
380
|
+
) : (
|
|
381
|
+
<Input
|
|
382
|
+
label="City*"
|
|
383
|
+
name="shipping_address.city"
|
|
384
|
+
id="shipping_city_field"
|
|
385
|
+
autoComplete="off"
|
|
386
|
+
value={formData["shipping_address.city"]}
|
|
387
|
+
onChange={handleChange}
|
|
388
|
+
required
|
|
389
|
+
data-testid="shipping-city-input"
|
|
390
|
+
/>
|
|
391
|
+
)}
|
|
392
|
+
{stateOptions.length > 0 ? (
|
|
393
|
+
<Select
|
|
394
|
+
label="State / Province*"
|
|
395
|
+
name="shipping_address.province"
|
|
396
|
+
id="shipping_province_field"
|
|
397
|
+
value={formData["shipping_address.province"]}
|
|
398
|
+
onChange={handleChange}
|
|
399
|
+
required
|
|
400
|
+
options={stateOptions}
|
|
401
|
+
data-testid="shipping-province-input"
|
|
402
|
+
/>
|
|
403
|
+
) : (
|
|
404
|
+
<Input
|
|
405
|
+
label="State / Province*"
|
|
406
|
+
name="shipping_address.province"
|
|
407
|
+
id="shipping_province_field"
|
|
408
|
+
autoComplete="off"
|
|
409
|
+
value={formData["shipping_address.province"]}
|
|
410
|
+
onChange={handleChange}
|
|
411
|
+
maxLength={30}
|
|
412
|
+
data-testid="shipping-province-input"
|
|
413
|
+
/>
|
|
414
|
+
)}
|
|
415
|
+
</div>
|
|
416
|
+
|
|
417
|
+
{/* Country Select */}
|
|
418
|
+
<div className="mb-4">
|
|
419
|
+
<CountrySelect
|
|
420
|
+
name="shipping_address.country_code"
|
|
421
|
+
id="shipping_country_code_field"
|
|
422
|
+
autoComplete="off"
|
|
423
|
+
region={cart?.region}
|
|
424
|
+
value={formData["shipping_address.country_code"]}
|
|
425
|
+
onChange={handleChange}
|
|
426
|
+
required
|
|
427
|
+
data-testid="shipping-country-select"
|
|
428
|
+
/>
|
|
429
|
+
</div>
|
|
430
|
+
<div className="my-6 min-[550px]:my-8">
|
|
431
|
+
<Checkbox
|
|
432
|
+
label="Billing address same as shipping address"
|
|
433
|
+
name="same_as_billing"
|
|
434
|
+
checked={checked}
|
|
435
|
+
onChange={onChange}
|
|
436
|
+
data-testid="billing-address-checkbox"
|
|
437
|
+
/>
|
|
438
|
+
</div>
|
|
439
|
+
{/* Email and Phone at bottom left - Single column for 340px-550px */}
|
|
440
|
+
<div className="grid grid-cols-1 min-[550px]:grid-cols-2 gap-4 mb-4 mt-4">
|
|
441
|
+
<Input
|
|
442
|
+
label="Email"
|
|
443
|
+
name="email"
|
|
444
|
+
id="shipping_email_field"
|
|
445
|
+
type="email"
|
|
446
|
+
title="Enter a valid email address."
|
|
447
|
+
autoComplete="off"
|
|
448
|
+
value={formData.email}
|
|
449
|
+
onChange={handleChange}
|
|
450
|
+
required
|
|
451
|
+
data-testid="shipping-email-input"
|
|
452
|
+
/>
|
|
453
|
+
<div className="relative w-full" suppressHydrationWarning>
|
|
454
|
+
<div className="relative w-full h-12">
|
|
455
|
+
<label
|
|
456
|
+
htmlFor="phone_hidden_input"
|
|
457
|
+
className="absolute left-[58px] top-1.5 z-[20] text-[11px] font-medium text-ui-fg-subtle pointer-events-none"
|
|
458
|
+
>
|
|
459
|
+
Phone<span className="text-red-500">*</span>
|
|
460
|
+
</label>
|
|
461
|
+
<PhoneInput
|
|
462
|
+
country={"in"}
|
|
463
|
+
value={formData["shipping_address.phone"]}
|
|
464
|
+
onChange={(value) => {
|
|
465
|
+
setFormData((prev) => ({
|
|
466
|
+
...prev,
|
|
467
|
+
"shipping_address.phone": value,
|
|
468
|
+
}))
|
|
469
|
+
// Clear error when user changes value and it's valid
|
|
470
|
+
if (value.replace(/\D/g, "").length >= 12) {
|
|
471
|
+
setPhoneError(false)
|
|
472
|
+
}
|
|
473
|
+
}}
|
|
474
|
+
inputProps={{
|
|
475
|
+
name: "shipping_address_phone_input",
|
|
476
|
+
id: "shipping_phone_field"
|
|
477
|
+
}}
|
|
478
|
+
inputStyle={{
|
|
479
|
+
width: "100%",
|
|
480
|
+
height: "48px",
|
|
481
|
+
fontSize: "14px",
|
|
482
|
+
paddingLeft: "58px",
|
|
483
|
+
paddingTop: "22px",
|
|
484
|
+
borderRadius: "6px",
|
|
485
|
+
border: phoneError ? "1px solid #EF4444" : "1px solid #C0C0C0",
|
|
486
|
+
backgroundColor: "var(--color-surface)",
|
|
487
|
+
fontFamily: "inherit",
|
|
488
|
+
color: "#000"
|
|
489
|
+
}}
|
|
490
|
+
containerStyle={{
|
|
491
|
+
width: "100%",
|
|
492
|
+
height: "48px"
|
|
493
|
+
}}
|
|
494
|
+
buttonStyle={{
|
|
495
|
+
border: phoneError ? "1px solid #EF4444" : "1px solid #C0C0C0",
|
|
496
|
+
borderRight: "none",
|
|
497
|
+
backgroundColor: "var(--color-surface)",
|
|
498
|
+
borderRadius: "6px 0 0 6px",
|
|
499
|
+
width: "48px",
|
|
500
|
+
height: "48px",
|
|
501
|
+
zIndex: 11
|
|
502
|
+
}}
|
|
503
|
+
dropdownStyle={{
|
|
504
|
+
width: "280px",
|
|
505
|
+
zIndex: 1000
|
|
506
|
+
}}
|
|
507
|
+
/>
|
|
508
|
+
<input type="hidden" id="shipping_phone_field_internal" name="shipping_address.phone" value={formData["shipping_address.phone"]} />
|
|
509
|
+
</div>
|
|
510
|
+
{phoneError && (
|
|
511
|
+
<p className="text-red-500 text-[11px] mt-1 font-medium italic">
|
|
512
|
+
Enter 10 digit valid phone number.
|
|
513
|
+
</p>
|
|
514
|
+
)}
|
|
515
|
+
</div>
|
|
516
|
+
</div>
|
|
517
|
+
</>
|
|
518
|
+
)
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
export default ShippingAddress
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { Button } from "@medusajs/ui"
|
|
4
|
+
import React from "react"
|
|
5
|
+
import { useFormStatus } from "react-dom"
|
|
6
|
+
|
|
7
|
+
export function SubmitButton({
|
|
8
|
+
children,
|
|
9
|
+
variant = "primary",
|
|
10
|
+
className,
|
|
11
|
+
"data-testid": dataTestId,
|
|
12
|
+
}: {
|
|
13
|
+
children: React.ReactNode
|
|
14
|
+
variant?: "primary" | "secondary" | "transparent" | "danger" | null
|
|
15
|
+
className?: string
|
|
16
|
+
"data-testid"?: string
|
|
17
|
+
}) {
|
|
18
|
+
const { pending } = useFormStatus()
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<Button
|
|
22
|
+
size="large"
|
|
23
|
+
className={className ?? "checkout-btn-primary border-0"}
|
|
24
|
+
type="submit"
|
|
25
|
+
isLoading={pending}
|
|
26
|
+
variant={variant || "primary"}
|
|
27
|
+
data-testid={dataTestId}
|
|
28
|
+
>
|
|
29
|
+
{children}
|
|
30
|
+
</Button>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { listCartShippingMethods } from "@core/data/fulfillment"
|
|
2
|
+
import { HttpTypes } from "@medusajs/types"
|
|
3
|
+
import Addresses from "@modules/checkout/components/addresses"
|
|
4
|
+
import Shipping from "@modules/checkout/components/shipping"
|
|
5
|
+
import Payment from "@modules/checkout/components/payment"
|
|
6
|
+
import Review from "@modules/checkout/components/review"
|
|
7
|
+
|
|
8
|
+
export default async function CheckoutForm({
|
|
9
|
+
cart,
|
|
10
|
+
customer,
|
|
11
|
+
}: {
|
|
12
|
+
cart: HttpTypes.StoreCart | null
|
|
13
|
+
customer: HttpTypes.StoreCustomer | null
|
|
14
|
+
}) {
|
|
15
|
+
if (!cart) {
|
|
16
|
+
return null
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const shippingMethods = await listCartShippingMethods(cart.id)
|
|
20
|
+
const paymentMethods = cart.region?.payment_providers || []
|
|
21
|
+
|
|
22
|
+
if (!shippingMethods) {
|
|
23
|
+
return null
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<div className="w-full grid grid-cols-1 gap-y-6 min-[550px]:gap-y-8">
|
|
28
|
+
<Addresses cart={cart} customer={customer} />
|
|
29
|
+
|
|
30
|
+
<Shipping cart={cart} availableShippingMethods={shippingMethods} />
|
|
31
|
+
|
|
32
|
+
{/* Payment and Review components are shown on /checkout/payment page */}
|
|
33
|
+
<Payment cart={cart} availablePaymentMethods={paymentMethods} />
|
|
34
|
+
|
|
35
|
+
{/* <Review cart={cart} /> */}
|
|
36
|
+
</div>
|
|
37
|
+
)
|
|
38
|
+
}
|