@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
package/templates/storefront/src/modules/account/components/address-card/edit-address-modal.tsx
ADDED
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import React, { useEffect, useState, useActionState, useMemo } from "react"
|
|
4
|
+
import { PencilSquare as Edit, Trash } from "@medusajs/icons"
|
|
5
|
+
import { Button, Heading, Text, clx } from "@medusajs/ui"
|
|
6
|
+
|
|
7
|
+
import useToggleState from "@core/hooks/use-toggle-state"
|
|
8
|
+
import CountrySelect from "@modules/checkout/components/country-select"
|
|
9
|
+
import Input from "@modules/common/components/input"
|
|
10
|
+
import Modal from "@modules/common/components/modal"
|
|
11
|
+
import Spinner from "@modules/common/icons/spinner"
|
|
12
|
+
import { SubmitButton } from "@modules/checkout/components/submit-button"
|
|
13
|
+
import { HttpTypes } from "@medusajs/types"
|
|
14
|
+
import { updateCustomerAddress } from "@core/data/customer"
|
|
15
|
+
import { State, City } from "country-state-city"
|
|
16
|
+
import Select from "@modules/common/components/select"
|
|
17
|
+
import PhoneInput from "react-phone-input-2"
|
|
18
|
+
import "react-phone-input-2/lib/style.css"
|
|
19
|
+
import {
|
|
20
|
+
deleteCustomerAddress,
|
|
21
|
+
setDefaultAddress,
|
|
22
|
+
} from "@core/data/customer"
|
|
23
|
+
|
|
24
|
+
type EditAddressProps = {
|
|
25
|
+
region: HttpTypes.StoreRegion
|
|
26
|
+
address: HttpTypes.StoreCustomerAddress
|
|
27
|
+
isActive?: boolean
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const EditAddress: React.FC<EditAddressProps> = ({
|
|
31
|
+
region,
|
|
32
|
+
address,
|
|
33
|
+
isActive = false,
|
|
34
|
+
}) => {
|
|
35
|
+
const [removing, setRemoving] = useState(false)
|
|
36
|
+
const [settingDefault, setSettingDefault] = useState(false)
|
|
37
|
+
const [successState, setSuccessState] = useState(false)
|
|
38
|
+
const { state, open, close: closeModal } = useToggleState(false)
|
|
39
|
+
|
|
40
|
+
const [fullName, setFullName] = useState(address.first_name ? `${address.first_name} ${address.last_name === "." ? "" : address.last_name}`.trim() : "")
|
|
41
|
+
const [firstName, setFirstName] = useState(address.first_name || "")
|
|
42
|
+
const [lastName, setLastName] = useState(address.last_name || "")
|
|
43
|
+
const [postalCode, setPostalCode] = useState(address.postal_code || "")
|
|
44
|
+
const [city, setCity] = useState(address.city || "")
|
|
45
|
+
const [province, setProvince] = useState(address.province || "")
|
|
46
|
+
const [phone, setPhone] = useState(address.phone || "")
|
|
47
|
+
const [phoneError, setPhoneError] = useState<string | null>(null)
|
|
48
|
+
const [countryCode, setCountryCode] = useState(address.country_code || "")
|
|
49
|
+
|
|
50
|
+
const countryCodeUpper = (countryCode || "").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 || !province) return []
|
|
67
|
+
try {
|
|
68
|
+
const selectedStateObj = stateOptions.find(
|
|
69
|
+
(s) => s.value === 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, province, stateOptions])
|
|
82
|
+
|
|
83
|
+
const [formState, formAction] = useActionState(updateCustomerAddress, {
|
|
84
|
+
success: false,
|
|
85
|
+
error: null,
|
|
86
|
+
addressId: address.id,
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
const handlePincodeChange = async (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
90
|
+
const val = e.target.value.replace(/\D/g, "").slice(0, 6)
|
|
91
|
+
setPostalCode(val)
|
|
92
|
+
|
|
93
|
+
if (val.length === 6) {
|
|
94
|
+
try {
|
|
95
|
+
const response = await fetch(`https://api.postalpincode.in/pincode/${val}`)
|
|
96
|
+
const data = await response.json()
|
|
97
|
+
if (data[0].Status === "Success") {
|
|
98
|
+
const postOffice = data[0].PostOffice[0]
|
|
99
|
+
setCity(postOffice.District)
|
|
100
|
+
setProvince(postOffice.State)
|
|
101
|
+
}
|
|
102
|
+
} catch (error) {
|
|
103
|
+
// Silence error
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const handlePhoneChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
109
|
+
const val = e.target.value.replace(/\D/g, "").slice(0, 10)
|
|
110
|
+
setPhone(val)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const handleTextOnlyChange = (setter: (v: string) => void) => (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
114
|
+
const val = e.target.value.replace(/[^A-Za-z\s]/g, "")
|
|
115
|
+
setter(val)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
|
|
119
|
+
const digits = phone.replace(/\D/g, "")
|
|
120
|
+
if (digits.length < 12) {
|
|
121
|
+
e.preventDefault()
|
|
122
|
+
setPhoneError("Please enter a valid 10-digit phone number.")
|
|
123
|
+
return
|
|
124
|
+
}
|
|
125
|
+
setPhoneError(null)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const close = () => {
|
|
129
|
+
setSuccessState(false)
|
|
130
|
+
closeModal()
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
useEffect(() => {
|
|
134
|
+
if (successState) {
|
|
135
|
+
close()
|
|
136
|
+
}
|
|
137
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
138
|
+
}, [successState])
|
|
139
|
+
|
|
140
|
+
useEffect(() => {
|
|
141
|
+
if (formState.success) {
|
|
142
|
+
setSuccessState(true)
|
|
143
|
+
}
|
|
144
|
+
}, [formState])
|
|
145
|
+
|
|
146
|
+
const removeAddress = async () => {
|
|
147
|
+
setRemoving(true)
|
|
148
|
+
await deleteCustomerAddress(address.id)
|
|
149
|
+
setRemoving(false)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const handleSetDefault = async () => {
|
|
153
|
+
setSettingDefault(true)
|
|
154
|
+
await setDefaultAddress(address.id)
|
|
155
|
+
setSettingDefault(false)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return (
|
|
159
|
+
<>
|
|
160
|
+
<div
|
|
161
|
+
className={clx(
|
|
162
|
+
"bg-white border border-gray-100 rounded-xl p-8 w-full flex flex-col justify-between transition-all hover:shadow-lg",
|
|
163
|
+
{
|
|
164
|
+
"border-gray-900": isActive || address.is_default_shipping,
|
|
165
|
+
}
|
|
166
|
+
)}
|
|
167
|
+
data-testid="address-container"
|
|
168
|
+
>
|
|
169
|
+
<div className="flex flex-col mb-6">
|
|
170
|
+
<div className="flex justify-between items-start mb-4">
|
|
171
|
+
<div className="flex flex-col gap-y-1">
|
|
172
|
+
<Heading
|
|
173
|
+
className="text-left text-xl font-bold text-heading"
|
|
174
|
+
data-testid="address-name"
|
|
175
|
+
>
|
|
176
|
+
{address.first_name} {address.last_name}
|
|
177
|
+
</Heading>
|
|
178
|
+
{address.is_default_shipping && (
|
|
179
|
+
<Text className="text-brand-accent text-xs font-bold uppercase">
|
|
180
|
+
Default Address
|
|
181
|
+
</Text>
|
|
182
|
+
)}
|
|
183
|
+
</div>
|
|
184
|
+
<div className="flex gap-x-2">
|
|
185
|
+
{address.is_default_shipping && (
|
|
186
|
+
<div className="bg-brand-accent text-inverse px-3 py-1 rounded text-[10px] font-bold uppercase tracking-wider">
|
|
187
|
+
Default
|
|
188
|
+
</div>
|
|
189
|
+
)}
|
|
190
|
+
<div className="border border-[#D69EFD] text-[#a855f7] px-3 py-1 rounded text-[10px] font-bold uppercase tracking-wider">
|
|
191
|
+
{String(address.metadata?.address_type || "HOME")}
|
|
192
|
+
</div>
|
|
193
|
+
</div>
|
|
194
|
+
</div>
|
|
195
|
+
|
|
196
|
+
<div className="text-gray-500 text-sm leading-relaxed mb-4">
|
|
197
|
+
<p className="block mb-4">
|
|
198
|
+
{address.address_1}, {address.city}, {address.province ? `${address.province}, ` : ""}{address.postal_code}
|
|
199
|
+
</p>
|
|
200
|
+
<p className="mt-2 text-heading">
|
|
201
|
+
<span className="text-gray-500 mr-2">Mobile:</span>
|
|
202
|
+
<span className="font-bold">{address.phone}</span>
|
|
203
|
+
</p>
|
|
204
|
+
</div>
|
|
205
|
+
</div>
|
|
206
|
+
|
|
207
|
+
<div className="flex flex-wrap items-center gap-3">
|
|
208
|
+
<button
|
|
209
|
+
className="border border-gray-300 rounded-full px-6 py-2 text-sm font-semibold text-gray-700 hover:bg-gray-50 transition-colors flex items-center justify-center min-w-[100px]"
|
|
210
|
+
onClick={removeAddress}
|
|
211
|
+
data-testid="address-delete-button"
|
|
212
|
+
disabled={removing}
|
|
213
|
+
>
|
|
214
|
+
{removing && <Spinner className="animate-spin mr-2" />}
|
|
215
|
+
Remove
|
|
216
|
+
</button>
|
|
217
|
+
|
|
218
|
+
<button
|
|
219
|
+
className="border border-gray-300 rounded-full px-6 py-2 text-sm font-semibold text-gray-700 hover:bg-gray-50 transition-colors flex items-center justify-center min-w-[100px]"
|
|
220
|
+
onClick={open}
|
|
221
|
+
data-testid="address-edit-button"
|
|
222
|
+
>
|
|
223
|
+
Edit
|
|
224
|
+
</button>
|
|
225
|
+
|
|
226
|
+
{!address.is_default_shipping && (
|
|
227
|
+
<button
|
|
228
|
+
className="border border-brand-accent rounded-full px-6 py-2 text-sm font-semibold text-brand-accent hover:bg-brand-accent-muted transition-colors flex items-center justify-center min-w-[120px]"
|
|
229
|
+
onClick={handleSetDefault}
|
|
230
|
+
disabled={settingDefault}
|
|
231
|
+
>
|
|
232
|
+
{settingDefault && <Spinner className="animate-spin mr-2" />}
|
|
233
|
+
Set as Default
|
|
234
|
+
</button>
|
|
235
|
+
)}
|
|
236
|
+
</div>
|
|
237
|
+
</div>
|
|
238
|
+
|
|
239
|
+
<Modal isOpen={state} close={close} data-testid="edit-address-modal" size="small">
|
|
240
|
+
<Modal.Title>Edit Address</Modal.Title>
|
|
241
|
+
<form
|
|
242
|
+
action={formAction}
|
|
243
|
+
onSubmit={handleSubmit}
|
|
244
|
+
className="flex flex-col h-full overflow-hidden"
|
|
245
|
+
>
|
|
246
|
+
<input type="hidden" name="addressId" value={address.id} />
|
|
247
|
+
<Modal.Body>
|
|
248
|
+
<div className="flex flex-col gap-y-4">
|
|
249
|
+
<div>
|
|
250
|
+
<Input
|
|
251
|
+
label="Full name"
|
|
252
|
+
name="full_name"
|
|
253
|
+
required
|
|
254
|
+
autoComplete="name"
|
|
255
|
+
value={fullName}
|
|
256
|
+
onChange={(e) => {
|
|
257
|
+
const val = e.target.value
|
|
258
|
+
setFullName(val)
|
|
259
|
+
const [first, ...rest] = val.split(" ")
|
|
260
|
+
setFirstName(first || "")
|
|
261
|
+
setLastName(rest.join(" ") || ".")
|
|
262
|
+
}}
|
|
263
|
+
data-testid="full-name-input"
|
|
264
|
+
/>
|
|
265
|
+
{/* Hidden fields for backend compatibility */}
|
|
266
|
+
<input type="hidden" name="first_name" value={firstName} />
|
|
267
|
+
<input type="hidden" name="last_name" value={lastName} />
|
|
268
|
+
</div>
|
|
269
|
+
<div>
|
|
270
|
+
<Input
|
|
271
|
+
label="Address"
|
|
272
|
+
name="address_1"
|
|
273
|
+
required
|
|
274
|
+
autoComplete="address-line1"
|
|
275
|
+
defaultValue={address.address_1 || undefined}
|
|
276
|
+
data-testid="address-1-input"
|
|
277
|
+
/>
|
|
278
|
+
</div>
|
|
279
|
+
<div>
|
|
280
|
+
<Input
|
|
281
|
+
label="Postal code"
|
|
282
|
+
name="postal_code"
|
|
283
|
+
required
|
|
284
|
+
autoComplete="postal-code"
|
|
285
|
+
data-testid="postal-code-input"
|
|
286
|
+
value={postalCode}
|
|
287
|
+
onChange={handlePincodeChange}
|
|
288
|
+
/>
|
|
289
|
+
</div>
|
|
290
|
+
<div>
|
|
291
|
+
<CountrySelect
|
|
292
|
+
name="country_code"
|
|
293
|
+
region={region}
|
|
294
|
+
required
|
|
295
|
+
autoComplete="country"
|
|
296
|
+
value={countryCode}
|
|
297
|
+
onChange={(e) => {
|
|
298
|
+
setCountryCode(e.target.value)
|
|
299
|
+
setProvince("")
|
|
300
|
+
setCity("")
|
|
301
|
+
}}
|
|
302
|
+
data-testid="country-select"
|
|
303
|
+
/>
|
|
304
|
+
</div>
|
|
305
|
+
<div>
|
|
306
|
+
{stateOptions.length > 0 ? (
|
|
307
|
+
<Select
|
|
308
|
+
label="Province / State"
|
|
309
|
+
name="province"
|
|
310
|
+
required
|
|
311
|
+
value={province}
|
|
312
|
+
onChange={(e) => {
|
|
313
|
+
setProvince(e.target.value)
|
|
314
|
+
setCity("")
|
|
315
|
+
}}
|
|
316
|
+
options={stateOptions}
|
|
317
|
+
data-testid="state-input"
|
|
318
|
+
/>
|
|
319
|
+
) : (
|
|
320
|
+
<Input
|
|
321
|
+
label="Province / State"
|
|
322
|
+
name="province"
|
|
323
|
+
autoComplete="address-level1"
|
|
324
|
+
data-testid="state-input"
|
|
325
|
+
value={province}
|
|
326
|
+
onChange={handleTextOnlyChange(setProvince)}
|
|
327
|
+
/>
|
|
328
|
+
)}
|
|
329
|
+
</div>
|
|
330
|
+
<div>
|
|
331
|
+
{cityOptions.length > 0 ? (
|
|
332
|
+
<Select
|
|
333
|
+
label="City"
|
|
334
|
+
name="city"
|
|
335
|
+
required
|
|
336
|
+
value={city}
|
|
337
|
+
onChange={(e) => setCity(e.target.value)}
|
|
338
|
+
options={cityOptions}
|
|
339
|
+
data-testid="city-input"
|
|
340
|
+
/>
|
|
341
|
+
) : (
|
|
342
|
+
<Input
|
|
343
|
+
label="City"
|
|
344
|
+
name="city"
|
|
345
|
+
required
|
|
346
|
+
autoComplete="locality"
|
|
347
|
+
data-testid="city-input"
|
|
348
|
+
value={city}
|
|
349
|
+
onChange={handleTextOnlyChange(setCity)}
|
|
350
|
+
/>
|
|
351
|
+
)}
|
|
352
|
+
</div>
|
|
353
|
+
<div className="flex flex-col gap-y-2">
|
|
354
|
+
<Text className="text-sm font-semibold text-gray-700">Phone<span className="text-rose-500">*</span></Text>
|
|
355
|
+
<div className="relative w-full h-12">
|
|
356
|
+
<PhoneInput
|
|
357
|
+
country={"in"}
|
|
358
|
+
value={phone}
|
|
359
|
+
onChange={(value) => {
|
|
360
|
+
setPhone(value)
|
|
361
|
+
if (value.replace(/\D/g, "").length >= 12) {
|
|
362
|
+
setPhoneError(null)
|
|
363
|
+
}
|
|
364
|
+
}}
|
|
365
|
+
inputStyle={{
|
|
366
|
+
width: "100%",
|
|
367
|
+
height: "48px",
|
|
368
|
+
fontSize: "14px",
|
|
369
|
+
paddingLeft: "58px",
|
|
370
|
+
borderRadius: "6px",
|
|
371
|
+
border: phoneError ? "1px solid #EF4444" : "1px solid #C0C0C0",
|
|
372
|
+
backgroundColor: "var(--color-surface)",
|
|
373
|
+
fontFamily: "inherit",
|
|
374
|
+
color: "#000"
|
|
375
|
+
}}
|
|
376
|
+
containerStyle={{
|
|
377
|
+
width: "100%",
|
|
378
|
+
height: "48px"
|
|
379
|
+
}}
|
|
380
|
+
buttonStyle={{
|
|
381
|
+
border: phoneError ? "1px solid #EF4444" : "1px solid #C0C0C0",
|
|
382
|
+
borderRight: "none",
|
|
383
|
+
backgroundColor: "var(--color-surface)",
|
|
384
|
+
borderRadius: "6px 0 0 6px",
|
|
385
|
+
width: "48px",
|
|
386
|
+
height: "48px",
|
|
387
|
+
zIndex: 11
|
|
388
|
+
}}
|
|
389
|
+
dropdownStyle={{
|
|
390
|
+
width: "280px",
|
|
391
|
+
zIndex: 1000
|
|
392
|
+
}}
|
|
393
|
+
/>
|
|
394
|
+
<input type="hidden" name="phone" value={phone} />
|
|
395
|
+
</div>
|
|
396
|
+
{phoneError && (
|
|
397
|
+
<Text className="text-rose-500 text-[11px] font-medium italic mt-1 leading-none">{phoneError}</Text>
|
|
398
|
+
)}
|
|
399
|
+
</div>
|
|
400
|
+
|
|
401
|
+
{/* Address Type Selection */}
|
|
402
|
+
<div className="small:col-span-2 flex flex-col gap-y-2 mt-2">
|
|
403
|
+
<Text className="text-sm font-semibold text-gray-700">Address Type</Text>
|
|
404
|
+
<div className="flex gap-x-6">
|
|
405
|
+
<label className="flex items-center gap-x-2 cursor-pointer group">
|
|
406
|
+
<input
|
|
407
|
+
type="radio"
|
|
408
|
+
name="address_type"
|
|
409
|
+
value="HOME"
|
|
410
|
+
defaultChecked={(address.metadata?.address_type as string) !== "OFFICE"}
|
|
411
|
+
className="peer hidden"
|
|
412
|
+
/>
|
|
413
|
+
<div className="w-5 h-5 rounded-full border-2 border-gray-300 flex items-center justify-center group-hover:border-brand-accent transition-all peer-checked:border-brand-accent peer-checked:[&>div]:scale-100">
|
|
414
|
+
<div className="w-3 h-3 rounded-full bg-brand-accent scale-0 transition-transform"></div>
|
|
415
|
+
</div>
|
|
416
|
+
<span className="text-base font-medium text-gray-600 peer-checked:text-brand-accent transition-colors">Home</span>
|
|
417
|
+
</label>
|
|
418
|
+
|
|
419
|
+
<label className="flex items-center gap-x-2 cursor-pointer group">
|
|
420
|
+
<input
|
|
421
|
+
type="radio"
|
|
422
|
+
name="address_type"
|
|
423
|
+
value="OFFICE"
|
|
424
|
+
defaultChecked={(address.metadata?.address_type as string) === "OFFICE"}
|
|
425
|
+
className="peer hidden"
|
|
426
|
+
/>
|
|
427
|
+
<div className="w-5 h-5 rounded-full border-2 border-gray-300 flex items-center justify-center group-hover:border-brand-accent transition-all peer-checked:border-brand-accent peer-checked:[&>div]:scale-100">
|
|
428
|
+
<div className="w-3 h-3 rounded-full bg-brand-accent scale-0 transition-transform"></div>
|
|
429
|
+
</div>
|
|
430
|
+
<span className="text-base font-medium text-gray-600 peer-checked:text-brand-accent transition-colors">Office</span>
|
|
431
|
+
</label>
|
|
432
|
+
</div>
|
|
433
|
+
</div>
|
|
434
|
+
</div>
|
|
435
|
+
{formState.error && (
|
|
436
|
+
<div
|
|
437
|
+
className="text-rose-500 text-small-regular py-4 mt-2 bg-rose-50 px-4 rounded-lg border border-rose-100"
|
|
438
|
+
data-testid="address-error"
|
|
439
|
+
>
|
|
440
|
+
{formState.error}
|
|
441
|
+
</div>
|
|
442
|
+
)}
|
|
443
|
+
</Modal.Body>
|
|
444
|
+
<Modal.Footer>
|
|
445
|
+
<div className="flex flex-col small:flex-row gap-3 w-full small:w-auto">
|
|
446
|
+
<button
|
|
447
|
+
type="reset"
|
|
448
|
+
onClick={close}
|
|
449
|
+
className="w-full small:w-auto px-8 py-3 rounded-full border border-gray-300 font-bold text-gray-700 hover:bg-gray-50 transition-all text-base order-2 small:order-1"
|
|
450
|
+
data-testid="cancel-button"
|
|
451
|
+
>
|
|
452
|
+
Cancel
|
|
453
|
+
</button>
|
|
454
|
+
<SubmitButton
|
|
455
|
+
data-testid="save-button"
|
|
456
|
+
className="w-full small:w-auto px-8 py-3 rounded-full bg-brand-accent font-bold text-inverse hover:bg-brand-accent-hover transition-all text-base order-1 small:order-2"
|
|
457
|
+
>
|
|
458
|
+
Update Address
|
|
459
|
+
</SubmitButton>
|
|
460
|
+
</div>
|
|
461
|
+
</Modal.Footer>
|
|
462
|
+
</form>
|
|
463
|
+
</Modal>
|
|
464
|
+
</>
|
|
465
|
+
)
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
export default EditAddress
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { useState, useEffect } from "react"
|
|
4
|
+
import { Button, Heading, Text } from "@medusajs/ui"
|
|
5
|
+
import Modal from "@modules/common/components/modal"
|
|
6
|
+
import {
|
|
7
|
+
requestAccountDeletionCancel,
|
|
8
|
+
confirmAccountDeletionCancel
|
|
9
|
+
} from "@core/data/customer-registration"
|
|
10
|
+
import { signout } from "@core/data/customer"
|
|
11
|
+
import Spinner from "@modules/common/icons/spinner"
|
|
12
|
+
|
|
13
|
+
// Re-using common components
|
|
14
|
+
const DeletionPendingModal = ({
|
|
15
|
+
isOpen,
|
|
16
|
+
close,
|
|
17
|
+
email,
|
|
18
|
+
countryCode
|
|
19
|
+
}: {
|
|
20
|
+
isOpen: boolean
|
|
21
|
+
close?: () => void
|
|
22
|
+
email?: string
|
|
23
|
+
countryCode?: string
|
|
24
|
+
}) => {
|
|
25
|
+
const [step, setStep] = useState<"initial" | "otp" | "success">("initial")
|
|
26
|
+
const [token, setToken] = useState("")
|
|
27
|
+
const [otp, setOtp] = useState("")
|
|
28
|
+
const [isLoading, setIsLoading] = useState(false)
|
|
29
|
+
const [error, setError] = useState<string | null>(null)
|
|
30
|
+
const [emailInput, setEmailInput] = useState(email || "")
|
|
31
|
+
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (email) {
|
|
34
|
+
setEmailInput(email)
|
|
35
|
+
} else if (typeof document !== 'undefined' && !emailInput) {
|
|
36
|
+
const getCookie = (name: string) => {
|
|
37
|
+
const value = `; ${document.cookie}`
|
|
38
|
+
const parts = value.split(`; ${name}=`)
|
|
39
|
+
if (parts.length === 2) return decodeURIComponent(parts.pop()?.split(';').shift() || "")
|
|
40
|
+
return null
|
|
41
|
+
}
|
|
42
|
+
const cookieEmail = getCookie("_medusa_customer_email")
|
|
43
|
+
if (cookieEmail) {
|
|
44
|
+
setEmailInput(cookieEmail)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}, [email])
|
|
48
|
+
|
|
49
|
+
const handleRequestCancel = async () => {
|
|
50
|
+
setIsLoading(true)
|
|
51
|
+
setError(null)
|
|
52
|
+
|
|
53
|
+
if (!emailInput || !emailInput.includes("@")) {
|
|
54
|
+
setError("Please enter a valid email address.")
|
|
55
|
+
setIsLoading(false)
|
|
56
|
+
return
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const result = await requestAccountDeletionCancel(emailInput)
|
|
60
|
+
if (result.success && result.token) {
|
|
61
|
+
setToken(result.token)
|
|
62
|
+
setStep("otp")
|
|
63
|
+
} else {
|
|
64
|
+
setError(result.error || "Failed to request cancellation")
|
|
65
|
+
}
|
|
66
|
+
setIsLoading(false)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const handleConfirmCancel = async () => {
|
|
70
|
+
if (!otp || !token) return
|
|
71
|
+
setIsLoading(true)
|
|
72
|
+
setError(null)
|
|
73
|
+
const result = await confirmAccountDeletionCancel(token, otp)
|
|
74
|
+
if (result.success) {
|
|
75
|
+
setStep("success")
|
|
76
|
+
} else {
|
|
77
|
+
setError(result.error || "Invalid verification code")
|
|
78
|
+
}
|
|
79
|
+
setIsLoading(false)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const handleLogout = async () => {
|
|
83
|
+
setIsLoading(true)
|
|
84
|
+
await signout(countryCode || "in")
|
|
85
|
+
close?.()
|
|
86
|
+
window.location.reload()
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<div className={isOpen ? "fixed inset-0 z-[100] flex items-center justify-center bg-black/50" : "hidden"}>
|
|
91
|
+
<div className="bg-white rounded-2xl w-full max-w-md p-8 shadow-2xl animate-in fade-in zoom-in duration-300">
|
|
92
|
+
<div className="flex flex-col gap-y-6 text-center">
|
|
93
|
+
{step === "initial" ? (
|
|
94
|
+
<>
|
|
95
|
+
<div className="w-16 h-16 bg-amber-100 rounded-full flex items-center justify-center mx-auto mb-2">
|
|
96
|
+
<Text className="text-amber-600 text-2xl font-bold">!</Text>
|
|
97
|
+
</div>
|
|
98
|
+
<Heading level="h2" className="text-2xl font-bold text-heading">Account Deletion Pending</Heading>
|
|
99
|
+
<Text className="text-gray-500 font-medium">
|
|
100
|
+
Your account is currently scheduled for deletion. Please confirm your email to withdraw the request.
|
|
101
|
+
</Text>
|
|
102
|
+
<div className="mt-2">
|
|
103
|
+
<input
|
|
104
|
+
type="email"
|
|
105
|
+
placeholder="Enter your email"
|
|
106
|
+
value={emailInput}
|
|
107
|
+
onChange={(e) => setEmailInput(e.target.value)}
|
|
108
|
+
className="w-full px-4 py-3 border border-gray-300 focus:outline-none focus:ring-2 focus:ring-brand-accent text-center text-heading"
|
|
109
|
+
style={{ borderRadius: '30px' }}
|
|
110
|
+
/>
|
|
111
|
+
</div>
|
|
112
|
+
{error && <Text className="text-red-500 text-sm">{error}</Text>}
|
|
113
|
+
<div className="flex flex-col gap-y-3 mt-4">
|
|
114
|
+
<Button
|
|
115
|
+
className="w-full py-3 bg-brand-accent text-inverse font-bold hover:bg-brand-accent-hover"
|
|
116
|
+
style={{ borderRadius: '30px' }}
|
|
117
|
+
onClick={handleRequestCancel}
|
|
118
|
+
disabled={isLoading}
|
|
119
|
+
>
|
|
120
|
+
{isLoading ? <Spinner /> : "Withdraw Deletion Request"}
|
|
121
|
+
</Button>
|
|
122
|
+
<Button
|
|
123
|
+
variant="secondary"
|
|
124
|
+
className="w-full py-3 border border-gray-300 hover:bg-gray-50"
|
|
125
|
+
style={{ borderRadius: '30px' }}
|
|
126
|
+
onClick={handleLogout}
|
|
127
|
+
disabled={isLoading}
|
|
128
|
+
>
|
|
129
|
+
Logout
|
|
130
|
+
</Button>
|
|
131
|
+
</div>
|
|
132
|
+
</>
|
|
133
|
+
) : step === "otp" ? (
|
|
134
|
+
<>
|
|
135
|
+
<Heading level="h2" className="text-2xl font-bold text-heading">Verify Cancellation</Heading>
|
|
136
|
+
<Text className="text-gray-500">
|
|
137
|
+
A verification code has been sent to your email. Please enter it below to confirm cancellation.
|
|
138
|
+
</Text>
|
|
139
|
+
<div className="relative flex justify-center gap-x-3 mt-8">
|
|
140
|
+
{[0, 1, 2, 3, 4, 5].map((index) => (
|
|
141
|
+
<div
|
|
142
|
+
key={index}
|
|
143
|
+
className={`w-12 h-14 flex items-center justify-center border-2 rounded-xl text-2xl font-bold transition-all duration-200 ${otp.length === index
|
|
144
|
+
? "border-brand-accent ring-3 ring-brand-accent/10 bg-white"
|
|
145
|
+
: otp.length > index
|
|
146
|
+
? "border-gray-400 bg-white shadow-sm"
|
|
147
|
+
: "border-gray-200 bg-gray-50/50"
|
|
148
|
+
}`}
|
|
149
|
+
>
|
|
150
|
+
{otp[index] || ""}
|
|
151
|
+
</div>
|
|
152
|
+
))}
|
|
153
|
+
<input
|
|
154
|
+
type="text"
|
|
155
|
+
maxLength={6}
|
|
156
|
+
className="absolute inset-0 opacity-0 cursor-pointer"
|
|
157
|
+
value={otp}
|
|
158
|
+
onChange={(e) => setOtp(e.target.value.replace(/\D/g, "").slice(0, 6))}
|
|
159
|
+
autoFocus
|
|
160
|
+
/>
|
|
161
|
+
</div>
|
|
162
|
+
{error && <Text className="text-red-500 text-sm mt-4">{error}</Text>}
|
|
163
|
+
<div className="flex flex-col gap-y-3 mt-8">
|
|
164
|
+
<Button
|
|
165
|
+
className="w-full py-3 bg-brand-accent text-inverse font-bold"
|
|
166
|
+
style={{ borderRadius: '30px' }}
|
|
167
|
+
onClick={handleConfirmCancel}
|
|
168
|
+
disabled={isLoading || otp.length !== 6}
|
|
169
|
+
>
|
|
170
|
+
{isLoading ? <Spinner /> : "Confirm Cancellation"}
|
|
171
|
+
</Button>
|
|
172
|
+
<Button
|
|
173
|
+
variant="secondary"
|
|
174
|
+
className="w-full py-3"
|
|
175
|
+
style={{ borderRadius: '30px' }}
|
|
176
|
+
onClick={() => setStep("initial")}
|
|
177
|
+
disabled={isLoading}
|
|
178
|
+
>
|
|
179
|
+
Back
|
|
180
|
+
</Button>
|
|
181
|
+
</div>
|
|
182
|
+
</>
|
|
183
|
+
) : (
|
|
184
|
+
<div className="flex flex-col items-center text-center py-6 animate-in zoom-in duration-300">
|
|
185
|
+
<div className="w-20 h-20 bg-green-50 rounded-full flex items-center justify-center mb-6 shadow-sm border border-green-100">
|
|
186
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="#10b981" strokeWidth="3" strokeLinecap="round" strokeLinejoin="round">
|
|
187
|
+
<polyline points="20 6 9 17 4 12"></polyline>
|
|
188
|
+
</svg>
|
|
189
|
+
</div>
|
|
190
|
+
<Heading level="h2" className="text-2xl font-bold text-heading mb-2">Request Withdrawn</Heading>
|
|
191
|
+
<Text className="text-gray-600 max-w-[300px] mx-auto">
|
|
192
|
+
Your account deletion request has been cancelled. You can now use your account normally.
|
|
193
|
+
</Text>
|
|
194
|
+
<Button
|
|
195
|
+
variant="primary"
|
|
196
|
+
className="mt-8 w-full bg-brand-accent text-inverse py-3 font-bold"
|
|
197
|
+
style={{ borderRadius: '30px' }}
|
|
198
|
+
onClick={() => {
|
|
199
|
+
close?.()
|
|
200
|
+
window.location.reload()
|
|
201
|
+
}}
|
|
202
|
+
>
|
|
203
|
+
Continue to Login
|
|
204
|
+
</Button>
|
|
205
|
+
</div>
|
|
206
|
+
)}
|
|
207
|
+
</div>
|
|
208
|
+
</div>
|
|
209
|
+
</div>
|
|
210
|
+
)
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export default DeletionPendingModal
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@pradip1995/commerce-auth/components/forgot-password"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@pradip1995/commerce-auth/components/login"
|