@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,185 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import React, { useEffect, useState } from "react";
|
|
4
|
+
import { Badge, Button, Input, Text } from "@medusajs/ui";
|
|
5
|
+
import { HttpTypes } from "@medusajs/types";
|
|
6
|
+
import { updateCustomer } from "@core/data/customer";
|
|
7
|
+
import { sendCustomerOTP, verifyCustomerOTP } from "@core/data/customer-registration";
|
|
8
|
+
import AccountInfo from "../account-info";
|
|
9
|
+
import useToggleState from "@core/hooks/use-toggle-state";
|
|
10
|
+
|
|
11
|
+
type MyInformationProps = {
|
|
12
|
+
customer: HttpTypes.StoreCustomer
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const ProfilePhone: React.FC<MyInformationProps> = ({ customer }) => {
|
|
16
|
+
const [successState, setSuccessState] = useState(false)
|
|
17
|
+
const [error, setError] = useState<string | null>(null)
|
|
18
|
+
const [isSendingOtp, setIsSendingOtp] = useState(false)
|
|
19
|
+
const [isVerifying, setIsVerifying] = useState(false)
|
|
20
|
+
const [otpToken, setOtpToken] = useState<string | null>(null)
|
|
21
|
+
const [otpCode, setOtpCode] = useState("")
|
|
22
|
+
const [showOtpInput, setShowOtpInput] = useState(false)
|
|
23
|
+
const [isPhoneVerified, setIsPhoneVerified] = useState(
|
|
24
|
+
!!(customer.metadata?.phone_verified)
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
const handleSendOtp = async () => {
|
|
28
|
+
if (!customer.phone) {
|
|
29
|
+
setError("Please add a phone number first.")
|
|
30
|
+
return
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
setIsSendingOtp(true)
|
|
34
|
+
setError(null)
|
|
35
|
+
try {
|
|
36
|
+
const result = await sendCustomerOTP(customer.id, "phone_verification")
|
|
37
|
+
if (result.success && result.token) {
|
|
38
|
+
setOtpToken(result.token)
|
|
39
|
+
setShowOtpInput(true)
|
|
40
|
+
} else {
|
|
41
|
+
setError(result.error || "Failed to send OTP")
|
|
42
|
+
}
|
|
43
|
+
} catch (err: any) {
|
|
44
|
+
setError(err.message || "An error occurred")
|
|
45
|
+
} finally {
|
|
46
|
+
setIsSendingOtp(false)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const handleVerifyOtp = async () => {
|
|
51
|
+
if (!otpToken || !otpCode) return
|
|
52
|
+
|
|
53
|
+
setIsVerifying(true)
|
|
54
|
+
setError(null)
|
|
55
|
+
try {
|
|
56
|
+
const result = await verifyCustomerOTP(otpToken, otpCode)
|
|
57
|
+
if (result.success) {
|
|
58
|
+
setIsPhoneVerified(true)
|
|
59
|
+
setShowOtpInput(false)
|
|
60
|
+
setSuccessState(true)
|
|
61
|
+
} else {
|
|
62
|
+
setError(result.error || "Invalid OTP")
|
|
63
|
+
}
|
|
64
|
+
} catch (err: any) {
|
|
65
|
+
setError(err.message || "An error occurred")
|
|
66
|
+
} finally {
|
|
67
|
+
setIsVerifying(false)
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const updateCustomerPhone = async (e: React.FormEvent<HTMLFormElement>) => {
|
|
72
|
+
e.preventDefault()
|
|
73
|
+
const formData = new FormData(e.currentTarget)
|
|
74
|
+
const phone = formData.get("phone") as string
|
|
75
|
+
|
|
76
|
+
try {
|
|
77
|
+
await updateCustomer({ phone })
|
|
78
|
+
setSuccessState(true)
|
|
79
|
+
setError(null)
|
|
80
|
+
// If phone is updated, current verification is void
|
|
81
|
+
if (phone !== customer.phone) {
|
|
82
|
+
setIsPhoneVerified(false)
|
|
83
|
+
}
|
|
84
|
+
} catch (err: any) {
|
|
85
|
+
setError(err.toString())
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const clearState = () => {
|
|
90
|
+
setSuccessState(false)
|
|
91
|
+
setError(null)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return (
|
|
95
|
+
<div className="w-full">
|
|
96
|
+
<AccountInfo
|
|
97
|
+
label="Phone"
|
|
98
|
+
currentInfo={
|
|
99
|
+
<div className="flex items-center gap-x-2">
|
|
100
|
+
<span className="font-semibold">{customer.phone ?? "No phone number added"}</span>
|
|
101
|
+
{isPhoneVerified ? (
|
|
102
|
+
<Badge color="green">Verified</Badge>
|
|
103
|
+
) : customer.phone ? (
|
|
104
|
+
<Badge color="orange">Unverified</Badge>
|
|
105
|
+
) : null}
|
|
106
|
+
</div>
|
|
107
|
+
}
|
|
108
|
+
isSuccess={successState}
|
|
109
|
+
isError={!!error}
|
|
110
|
+
errorMessage={error || undefined}
|
|
111
|
+
clearState={clearState}
|
|
112
|
+
data-testid="account-phone-editor"
|
|
113
|
+
>
|
|
114
|
+
<form onSubmit={updateCustomerPhone} className="grid grid-cols-1 gap-y-2">
|
|
115
|
+
<Input
|
|
116
|
+
name="phone"
|
|
117
|
+
type="phone"
|
|
118
|
+
maxLength={13}
|
|
119
|
+
autoComplete="phone"
|
|
120
|
+
required
|
|
121
|
+
defaultValue={customer.phone ?? ""}
|
|
122
|
+
onInput={(e) => {
|
|
123
|
+
e.currentTarget.value = e.currentTarget.value.replace(/[^0-9+]/g, '');
|
|
124
|
+
}}
|
|
125
|
+
data-testid="phone-input"
|
|
126
|
+
/>
|
|
127
|
+
<div className="flex justify-end mt-2">
|
|
128
|
+
<Button type="submit" variant="secondary">Save Changes</Button>
|
|
129
|
+
</div>
|
|
130
|
+
</form>
|
|
131
|
+
|
|
132
|
+
{!isPhoneVerified && customer.phone && !showOtpInput && (
|
|
133
|
+
<div className="mt-4 pt-4 border-t border-gray-100 flex items-center justify-between">
|
|
134
|
+
<Text className="text-ui-fg-subtle text-small-regular">
|
|
135
|
+
Verify your phone number to secure your account.
|
|
136
|
+
</Text>
|
|
137
|
+
<Button
|
|
138
|
+
onClick={handleSendOtp}
|
|
139
|
+
isLoading={isSendingOtp}
|
|
140
|
+
variant="secondary"
|
|
141
|
+
className="px-4"
|
|
142
|
+
>
|
|
143
|
+
Verify Phone
|
|
144
|
+
</Button>
|
|
145
|
+
</div>
|
|
146
|
+
)}
|
|
147
|
+
|
|
148
|
+
{showOtpInput && (
|
|
149
|
+
<div className="mt-4 pt-4 border-t border-gray-100 space-y-4">
|
|
150
|
+
<div className="flex flex-col gap-y-1">
|
|
151
|
+
<Text className="text-ui-fg-base font-semibold">Enter OTP</Text>
|
|
152
|
+
<Text className="text-ui-fg-subtle text-small-regular">
|
|
153
|
+
We've sent a code to {customer.phone}
|
|
154
|
+
</Text>
|
|
155
|
+
</div>
|
|
156
|
+
<div className="flex gap-x-2">
|
|
157
|
+
<Input
|
|
158
|
+
placeholder="6-digit code"
|
|
159
|
+
value={otpCode}
|
|
160
|
+
onChange={(e) => setOtpCode(e.target.value.replace(/[^0-9]/g, ''))}
|
|
161
|
+
className="flex-1"
|
|
162
|
+
maxLength={6}
|
|
163
|
+
/>
|
|
164
|
+
<Button
|
|
165
|
+
onClick={handleVerifyOtp}
|
|
166
|
+
isLoading={isVerifying}
|
|
167
|
+
disabled={otpCode.length < 4}
|
|
168
|
+
>
|
|
169
|
+
Confirm Code
|
|
170
|
+
</Button>
|
|
171
|
+
</div>
|
|
172
|
+
<button
|
|
173
|
+
onClick={() => setShowOtpInput(false)}
|
|
174
|
+
className="text-ui-fg-interactive hover:text-ui-fg-interactive-hover text-small-regular"
|
|
175
|
+
>
|
|
176
|
+
Cancel
|
|
177
|
+
</button>
|
|
178
|
+
</div>
|
|
179
|
+
)}
|
|
180
|
+
</AccountInfo>
|
|
181
|
+
</div>
|
|
182
|
+
)
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export default ProfilePhone
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@pradip1995/commerce-auth/components/register"
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { HttpTypes } from "@medusajs/types"
|
|
4
|
+
import { ItemWithDeliveryStatus } from "@core/util/returns"
|
|
5
|
+
import { Select, Text, clx } from "@medusajs/ui"
|
|
6
|
+
import { Minus, Plus } from "@medusajs/icons"
|
|
7
|
+
import Thumbnail from "@modules/products/components/thumbnail"
|
|
8
|
+
import { convertToLocale } from "@core/util/money"
|
|
9
|
+
|
|
10
|
+
type ReturnItemSelectorProps = {
|
|
11
|
+
items: ItemWithDeliveryStatus[]
|
|
12
|
+
returnReasons: HttpTypes.StoreReturnReason[]
|
|
13
|
+
selectedItems: Array<{
|
|
14
|
+
id: string
|
|
15
|
+
quantity: number
|
|
16
|
+
return_reason_id?: string
|
|
17
|
+
}>
|
|
18
|
+
onItemSelectionChange: (
|
|
19
|
+
items: Array<{
|
|
20
|
+
id: string
|
|
21
|
+
quantity: number
|
|
22
|
+
return_reason_id?: string
|
|
23
|
+
}>
|
|
24
|
+
) => void
|
|
25
|
+
currencyCode: string
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const ReturnItemSelector = ({
|
|
29
|
+
items,
|
|
30
|
+
returnReasons,
|
|
31
|
+
selectedItems,
|
|
32
|
+
onItemSelectionChange,
|
|
33
|
+
currencyCode,
|
|
34
|
+
}: ReturnItemSelectorProps) => {
|
|
35
|
+
const handleQuantityChange = (itemId: string, quantity: number) => {
|
|
36
|
+
const existingItemIndex = selectedItems.findIndex((i) => i.id === itemId)
|
|
37
|
+
|
|
38
|
+
if (quantity === 0) {
|
|
39
|
+
if (existingItemIndex > -1) {
|
|
40
|
+
const newItems = [...selectedItems]
|
|
41
|
+
newItems.splice(existingItemIndex, 1)
|
|
42
|
+
onItemSelectionChange(newItems)
|
|
43
|
+
}
|
|
44
|
+
return
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (existingItemIndex > -1) {
|
|
48
|
+
const newItems = [...selectedItems]
|
|
49
|
+
newItems[existingItemIndex] = { ...newItems[existingItemIndex], quantity }
|
|
50
|
+
onItemSelectionChange(newItems)
|
|
51
|
+
} else {
|
|
52
|
+
onItemSelectionChange([...selectedItems, { id: itemId, quantity }])
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
const handleReasonChange = (itemId: string, reasonId: string) => {
|
|
59
|
+
const existingItemIndex = selectedItems.findIndex((i) => i.id === itemId)
|
|
60
|
+
if (existingItemIndex > -1) {
|
|
61
|
+
const newItems = [...selectedItems]
|
|
62
|
+
newItems[existingItemIndex] = { ...newItems[existingItemIndex], return_reason_id: reasonId }
|
|
63
|
+
onItemSelectionChange(newItems)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<div className="space-y-4">
|
|
69
|
+
{items.map((item) => {
|
|
70
|
+
const isReturnable = item.returnable_quantity > 0
|
|
71
|
+
const selected = selectedItems.find((i) => i.id === item.id)
|
|
72
|
+
const currentQty = selected?.quantity || 0
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<div
|
|
76
|
+
key={item.id}
|
|
77
|
+
className={clx(
|
|
78
|
+
"group border rounded-3xl p-4 sm:p-5 transition-all duration-300 relative",
|
|
79
|
+
selected
|
|
80
|
+
? "border-brand-accent shadow-lg bg-white"
|
|
81
|
+
: isReturnable
|
|
82
|
+
? "border-gray-200 hover:border-gray-300 bg-white"
|
|
83
|
+
: "border-gray-100 opacity-50 bg-gray-50/50 grayscale pointer-events-none"
|
|
84
|
+
)}
|
|
85
|
+
>
|
|
86
|
+
<div className="flex gap-4 sm:gap-6">
|
|
87
|
+
{/* Left: Thumbnail & Checkbox */}
|
|
88
|
+
<div className="relative shrink-0">
|
|
89
|
+
<div
|
|
90
|
+
className="w-20 h-24 sm:w-24 sm:h-32 bg-gray-50 rounded-2xl overflow-hidden border border-gray-100 cursor-pointer"
|
|
91
|
+
onClick={() => isReturnable && handleQuantityChange(item.id, selected ? 0 : 1)}
|
|
92
|
+
>
|
|
93
|
+
<Thumbnail thumbnail={item.thumbnail} size="full" className="object-cover w-full h-full" />
|
|
94
|
+
</div>
|
|
95
|
+
<div
|
|
96
|
+
className={clx(
|
|
97
|
+
"absolute -top-2 -left-2 w-8 h-8 rounded-full border-2 flex items-center justify-center transition-all duration-300 cursor-pointer shadow-sm z-20",
|
|
98
|
+
selected ? "bg-brand-accent border-white scale-110" : "bg-white border-gray-200"
|
|
99
|
+
)}
|
|
100
|
+
onClick={() => isReturnable && handleQuantityChange(item.id, selected ? 0 : 1)}
|
|
101
|
+
>
|
|
102
|
+
{selected && <svg width="12" height="12" viewBox="0 0 12 12" fill="none"><path d="M10 3L4.5 8.5L2 6" stroke="white" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round" /></svg>}
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
|
|
106
|
+
{/* Middle: Info */}
|
|
107
|
+
<div className="flex-1 flex flex-col justify-between py-1 min-w-0">
|
|
108
|
+
<div className="space-y-1">
|
|
109
|
+
<h3 className="text-sm sm:text-base font-bold text-heading line-clamp-1">{item.title}</h3>
|
|
110
|
+
<p className="text-xs font-medium text-gray-500">{item.variant?.title}</p>
|
|
111
|
+
<div className="mt-1">
|
|
112
|
+
<span className="text-brand-accent font-bold text-sm">
|
|
113
|
+
{convertToLocale({
|
|
114
|
+
amount: item.unit_price,
|
|
115
|
+
currency_code: currencyCode,
|
|
116
|
+
})}
|
|
117
|
+
</span>
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
120
|
+
|
|
121
|
+
{selected && (
|
|
122
|
+
<div className="flex items-center gap-3">
|
|
123
|
+
<div className="flex items-center bg-gray-50 rounded-xl border border-gray-100 p-1">
|
|
124
|
+
<button
|
|
125
|
+
type="button"
|
|
126
|
+
onClick={() => handleQuantityChange(item.id, currentQty - 1)}
|
|
127
|
+
className="w-7 h-7 flex items-center justify-center rounded-lg hover:bg-white text-gray-400 hover:text-heading transition-all shadow-sm"
|
|
128
|
+
>
|
|
129
|
+
<Minus className="w-3 h-3" />
|
|
130
|
+
</button>
|
|
131
|
+
<span className="w-8 text-center text-xs font-bold tabular-nums">{currentQty}</span>
|
|
132
|
+
<button
|
|
133
|
+
type="button"
|
|
134
|
+
onClick={() => handleQuantityChange(item.id, currentQty + 1)}
|
|
135
|
+
disabled={currentQty >= item.returnable_quantity}
|
|
136
|
+
className="w-7 h-7 flex items-center justify-center rounded-lg hover:bg-white text-gray-400 hover:text-heading transition-all shadow-sm disabled:opacity-50"
|
|
137
|
+
>
|
|
138
|
+
<Plus className="w-3 h-3" />
|
|
139
|
+
</button>
|
|
140
|
+
</div>
|
|
141
|
+
<span className="text-[10px] font-bold text-gray-400 uppercase">Qty to return</span>
|
|
142
|
+
</div>
|
|
143
|
+
)}
|
|
144
|
+
</div>
|
|
145
|
+
</div>
|
|
146
|
+
|
|
147
|
+
{/* Bottom: Return Reason Selector */}
|
|
148
|
+
<div
|
|
149
|
+
className={clx(
|
|
150
|
+
"grid transition-all duration-300 ease-in-out",
|
|
151
|
+
selected ? "grid-rows-[1fr] opacity-100 mt-4 pt-4 border-t border-gray-50" : "grid-rows-[0fr] opacity-0 overflow-hidden"
|
|
152
|
+
)}
|
|
153
|
+
>
|
|
154
|
+
<div className="min-h-0 pb-4">
|
|
155
|
+
<div className="flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-4">
|
|
156
|
+
<label className="text-[10px] font-bold text-gray-400 uppercase tracking-wider shrink-0">Reason for return:</label>
|
|
157
|
+
<div className="w-full sm:w-64">
|
|
158
|
+
<Select
|
|
159
|
+
value={selected?.return_reason_id || ""}
|
|
160
|
+
onValueChange={(value) => handleReasonChange(item.id, value)}
|
|
161
|
+
>
|
|
162
|
+
<Select.Trigger className={clx(
|
|
163
|
+
"rounded-xl h-10 transition-all text-xs font-medium border-gray-100",
|
|
164
|
+
selected?.return_reason_id ? "bg-brand-accent-muted/50 text-brand-accent border-brand-accent/20" : "bg-gray-50/50 text-gray-500"
|
|
165
|
+
)}>
|
|
166
|
+
<Select.Value placeholder="Please select a reason" />
|
|
167
|
+
</Select.Trigger>
|
|
168
|
+
<Select.Content className="z-[9999]" position="popper">
|
|
169
|
+
{returnReasons.map((reason) => (
|
|
170
|
+
<Select.Item key={reason.id} value={reason.id} className="text-xs font-medium">
|
|
171
|
+
{reason.label}
|
|
172
|
+
</Select.Item>
|
|
173
|
+
))}
|
|
174
|
+
</Select.Content>
|
|
175
|
+
</Select>
|
|
176
|
+
</div>
|
|
177
|
+
</div>
|
|
178
|
+
</div>
|
|
179
|
+
</div>
|
|
180
|
+
</div>
|
|
181
|
+
)
|
|
182
|
+
})}
|
|
183
|
+
</div>
|
|
184
|
+
)
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export default ReturnItemSelector
|
package/templates/storefront/src/modules/account/components/return-shipping-selector/index.tsx
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { clx, Text } from "@medusajs/ui"
|
|
4
|
+
import { HttpTypes } from "@medusajs/types"
|
|
5
|
+
import { convertToLocale } from "@core/util/money"
|
|
6
|
+
import { useEffect, useState } from "react"
|
|
7
|
+
import { sdk } from "@core/config"
|
|
8
|
+
|
|
9
|
+
type ReturnShippingSelectorProps = {
|
|
10
|
+
shippingOptions: HttpTypes.StoreShippingOption[]
|
|
11
|
+
selectedOption: string | null
|
|
12
|
+
onOptionSelect: (optionId: string) => void
|
|
13
|
+
cartId: string
|
|
14
|
+
currencyCode: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const ReturnShippingSelector = ({
|
|
18
|
+
shippingOptions,
|
|
19
|
+
selectedOption,
|
|
20
|
+
onOptionSelect,
|
|
21
|
+
cartId,
|
|
22
|
+
currencyCode,
|
|
23
|
+
}: ReturnShippingSelectorProps) => {
|
|
24
|
+
const [prices, setPrices] = useState<Record<string, number>>({})
|
|
25
|
+
const [loading, setLoading] = useState<Record<string, boolean>>({})
|
|
26
|
+
|
|
27
|
+
// If we had calculated shipping options, we would fetch prices here
|
|
28
|
+
// For now, we assume flat rate or use the amount present in the option if available
|
|
29
|
+
// But strict doc says "Price calculation for calculated shipping"
|
|
30
|
+
|
|
31
|
+
// Real implementation for calculated shipping:
|
|
32
|
+
// We needs to calculate the price for each option based on the cart (which is tricky without a return cart context in v2 yet,
|
|
33
|
+
// sometimes options serve as preview).
|
|
34
|
+
// Assuming standard options have 'amount' or we display 'Calculated at checkout' or similar.
|
|
35
|
+
// BUT the doc says "Displays flat rate or calculated prices".
|
|
36
|
+
|
|
37
|
+
// For v2 storefront:
|
|
38
|
+
// Usually, return shipping options are flat rate.
|
|
39
|
+
// If calculated, we might need a separate API call or it's implicitly handled.
|
|
40
|
+
// We'll stick to displaying the 'amount' field which is standard.
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<div className="space-y-6 sm:space-y-8">
|
|
44
|
+
<div className="space-y-1 px-1 sm:px-2">
|
|
45
|
+
<h3 className="text-base sm:text-lg font-bold text-heading tracking-tight">Select Return Method</h3>
|
|
46
|
+
<Text className="text-gray-500 text-sm">Choose how you'd like to send the items back.</Text>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
{shippingOptions.length === 0 ? (
|
|
50
|
+
<div className="p-5 bg-amber-50 border border-amber-100 text-amber-800 rounded-2xl text-sm flex gap-3 mx-1">
|
|
51
|
+
<svg className="w-5 h-5 shrink-0 mt-0.5" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" /></svg>
|
|
52
|
+
<div>
|
|
53
|
+
<p className="font-bold mb-1">No return methods available</p>
|
|
54
|
+
<p className="opacity-90">There are no return shipping options for your location. Please contact our support team for assistance.</p>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
) : (
|
|
58
|
+
<div className="grid gap-4">
|
|
59
|
+
{shippingOptions.map((option) => (
|
|
60
|
+
<div
|
|
61
|
+
key={option.id}
|
|
62
|
+
className={clx(
|
|
63
|
+
"group flex items-center justify-between p-5 border rounded-2xl cursor-pointer transition-all duration-300 relative overflow-hidden",
|
|
64
|
+
selectedOption === option.id
|
|
65
|
+
? "border-brand-accent ring-1 ring-brand-accent shadow-lg bg-gradient-to-br from-surface to-brand-accent-muted/30"
|
|
66
|
+
: "border-gray-100 hover:border-gray-200 hover:shadow-sm bg-white"
|
|
67
|
+
)}
|
|
68
|
+
onClick={() => onOptionSelect(option.id)}
|
|
69
|
+
>
|
|
70
|
+
<div className="flex items-center gap-5 relative z-10">
|
|
71
|
+
<div
|
|
72
|
+
className={clx(
|
|
73
|
+
"w-6 h-6 rounded-full border flex items-center justify-center transition-all duration-300 shrink-0",
|
|
74
|
+
selectedOption === option.id
|
|
75
|
+
? "border-brand-accent bg-brand-accent scale-110 shadow-md"
|
|
76
|
+
: "border-gray-200 bg-white group-hover:border-gray-300"
|
|
77
|
+
)}
|
|
78
|
+
>
|
|
79
|
+
{selectedOption === option.id && (
|
|
80
|
+
<div className="w-2.5 h-2.5 rounded-full bg-white animate-in zoom-in duration-200" />
|
|
81
|
+
)}
|
|
82
|
+
</div>
|
|
83
|
+
<div className="space-y-1">
|
|
84
|
+
<span className={clx(
|
|
85
|
+
"font-bold block text-base leading-none transition-colors",
|
|
86
|
+
selectedOption === option.id ? "text-heading" : "text-gray-700"
|
|
87
|
+
)}>
|
|
88
|
+
{option.name}
|
|
89
|
+
</span>
|
|
90
|
+
{option.amount !== undefined && option.amount !== null && (
|
|
91
|
+
<span className="text-xs text-gray-400 font-medium uppercase tracking-wide">Standard Delivery</span>
|
|
92
|
+
)}
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
<div className="text-right shrink-0 relative z-10">
|
|
96
|
+
<span className={clx(
|
|
97
|
+
"font-bold text-base transition-colors",
|
|
98
|
+
selectedOption === option.id ? "text-brand-accent" : "text-heading"
|
|
99
|
+
)}>
|
|
100
|
+
{option.amount !== undefined && option.amount !== null ? (
|
|
101
|
+
option.amount === 0 ? "FREE" : convertToLocale({
|
|
102
|
+
amount: option.amount,
|
|
103
|
+
currency_code: currencyCode
|
|
104
|
+
})
|
|
105
|
+
) : (
|
|
106
|
+
"Calculated"
|
|
107
|
+
)}
|
|
108
|
+
</span>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
))}
|
|
112
|
+
</div>
|
|
113
|
+
)}
|
|
114
|
+
</div>
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export default ReturnShippingSelector
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { useActionState } from "react"
|
|
4
|
+
import { createTransferRequest } from "@core/data/orders"
|
|
5
|
+
import { Text, Heading, Input, Button, IconButton, Toaster } from "@medusajs/ui"
|
|
6
|
+
import { SubmitButton } from "@modules/checkout/components/submit-button"
|
|
7
|
+
import { CheckCircleMiniSolid, XCircleSolid } from "@medusajs/icons"
|
|
8
|
+
import { useEffect, useState } from "react"
|
|
9
|
+
|
|
10
|
+
export default function TransferRequestForm() {
|
|
11
|
+
const [showSuccess, setShowSuccess] = useState(false)
|
|
12
|
+
|
|
13
|
+
const [state, formAction] = useActionState(createTransferRequest, {
|
|
14
|
+
success: false,
|
|
15
|
+
error: null,
|
|
16
|
+
order: null,
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (state.success && state.order) {
|
|
21
|
+
setShowSuccess(true)
|
|
22
|
+
}
|
|
23
|
+
}, [state.success, state.order])
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<div className="flex flex-col gap-y-4 w-full">
|
|
27
|
+
<div className="grid sm:grid-cols-2 items-center gap-x-8 gap-y-4 w-full">
|
|
28
|
+
<div className="flex flex-col gap-y-1">
|
|
29
|
+
<Heading level="h3" className="text-lg text-neutral-950">
|
|
30
|
+
Order transfers
|
|
31
|
+
</Heading>
|
|
32
|
+
<Text className="text-base-regular text-neutral-500">
|
|
33
|
+
Can't find the order you are looking for?
|
|
34
|
+
<br /> Connect an order to your account.
|
|
35
|
+
</Text>
|
|
36
|
+
</div>
|
|
37
|
+
<form
|
|
38
|
+
action={formAction}
|
|
39
|
+
className="flex flex-col gap-y-1 sm:items-end"
|
|
40
|
+
>
|
|
41
|
+
<div className="flex flex-col gap-y-2 w-full">
|
|
42
|
+
<Input className="w-full" name="order_id" placeholder="Order ID" />
|
|
43
|
+
<SubmitButton
|
|
44
|
+
variant="secondary"
|
|
45
|
+
className="w-fit whitespace-nowrap self-end"
|
|
46
|
+
>
|
|
47
|
+
Request transfer
|
|
48
|
+
</SubmitButton>
|
|
49
|
+
</div>
|
|
50
|
+
</form>
|
|
51
|
+
</div>
|
|
52
|
+
{!state.success && state.error && (
|
|
53
|
+
<Text className="text-base-regular text-rose-500 text-right">
|
|
54
|
+
{state.error}
|
|
55
|
+
</Text>
|
|
56
|
+
)}
|
|
57
|
+
{showSuccess && (
|
|
58
|
+
<div className="flex justify-between p-4 bg-neutral-50 shadow-borders-base w-full self-stretch items-center">
|
|
59
|
+
<div className="flex gap-x-2 items-center">
|
|
60
|
+
<CheckCircleMiniSolid className="w-4 h-4 text-emerald-500" />
|
|
61
|
+
<div className="flex flex-col gap-y-1">
|
|
62
|
+
<Text className="text-medim-pl text-neutral-950">
|
|
63
|
+
Transfer for order {state.order?.id} requested
|
|
64
|
+
</Text>
|
|
65
|
+
<Text className="text-base-regular text-neutral-600">
|
|
66
|
+
Transfer request email sent to {state.order?.email}
|
|
67
|
+
</Text>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
<IconButton
|
|
71
|
+
variant="transparent"
|
|
72
|
+
className="h-fit"
|
|
73
|
+
onClick={() => setShowSuccess(false)}
|
|
74
|
+
>
|
|
75
|
+
<XCircleSolid className="w-4 h-4 text-neutral-500" />
|
|
76
|
+
</IconButton>
|
|
77
|
+
</div>
|
|
78
|
+
)}
|
|
79
|
+
</div>
|
|
80
|
+
)
|
|
81
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
|
|
3
|
+
import UnderlineLink from "@modules/common/components/interactive-link"
|
|
4
|
+
|
|
5
|
+
import AccountNav from "../components/account-nav"
|
|
6
|
+
import { HttpTypes } from "@medusajs/types"
|
|
7
|
+
|
|
8
|
+
interface AccountLayoutProps {
|
|
9
|
+
customer: HttpTypes.StoreCustomer | null
|
|
10
|
+
children: React.ReactNode
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const AccountLayout: React.FC<AccountLayoutProps> = ({
|
|
14
|
+
customer,
|
|
15
|
+
children,
|
|
16
|
+
}) => {
|
|
17
|
+
// If no customer, render login page without the account layout constraints
|
|
18
|
+
if (!customer) {
|
|
19
|
+
return <>{children}</>
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<div className="flex-1 small:py-12 bg-page-bg" data-testid="account-page">
|
|
24
|
+
<div className="flex-1 content-container h-full max-w-5xl mx-auto bg-page-bg flex flex-col">
|
|
25
|
+
<div className="w-full flex justify-center py-4">
|
|
26
|
+
<h1 className="text-3xl font-bold text-heading">My Account</h1>
|
|
27
|
+
</div>
|
|
28
|
+
<div className="grid grid-cols-1 small:grid-cols-[300px_1fr] gap-x-12 py-6">
|
|
29
|
+
<div>{customer && <AccountNav customer={customer} />}</div>
|
|
30
|
+
<div className="flex-1">{children}</div>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export default AccountLayout
|