@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,152 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import React, { useState, useEffect } from "react"
|
|
4
|
+
import { listProducts } from "@core/data/products"
|
|
5
|
+
import { getRegion } from "@core/data/regions"
|
|
6
|
+
import { HttpTypes } from "@medusajs/types"
|
|
7
|
+
import ProductCard from "@registry/components/product-card"
|
|
8
|
+
|
|
9
|
+
type RelatedProductsProps = {
|
|
10
|
+
product: HttpTypes.StoreProduct
|
|
11
|
+
countryCode: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default function RelatedProducts({
|
|
15
|
+
product,
|
|
16
|
+
countryCode,
|
|
17
|
+
}: RelatedProductsProps) {
|
|
18
|
+
const [region, setRegion] = useState<HttpTypes.StoreRegion | null>(null)
|
|
19
|
+
const [allProducts, setAllProducts] = useState<HttpTypes.StoreProduct[]>([])
|
|
20
|
+
const [currentIndex, setCurrentIndex] = useState(0)
|
|
21
|
+
|
|
22
|
+
// Fetch data on client side
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
async function fetchData() {
|
|
25
|
+
const fetchedRegion = await getRegion(countryCode)
|
|
26
|
+
if (!fetchedRegion) {
|
|
27
|
+
return
|
|
28
|
+
}
|
|
29
|
+
setRegion(fetchedRegion)
|
|
30
|
+
|
|
31
|
+
const queryParams: HttpTypes.StoreProductListParams = {
|
|
32
|
+
limit: 20, // Fetch more products for carousel
|
|
33
|
+
is_giftcard: false,
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (fetchedRegion?.id) {
|
|
37
|
+
queryParams.region_id = fetchedRegion.id
|
|
38
|
+
}
|
|
39
|
+
if (product.collection_id) {
|
|
40
|
+
queryParams.collection_id = [product.collection_id]
|
|
41
|
+
}
|
|
42
|
+
if (product.tags) {
|
|
43
|
+
queryParams.tag_id = product.tags
|
|
44
|
+
.map((t) => t.id)
|
|
45
|
+
.filter(Boolean) as string[]
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const result = await listProducts({
|
|
49
|
+
queryParams,
|
|
50
|
+
countryCode,
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
if (result && result.response) {
|
|
54
|
+
setAllProducts(
|
|
55
|
+
result.response.products.filter(
|
|
56
|
+
(responseProduct) => responseProduct.id !== product.id
|
|
57
|
+
)
|
|
58
|
+
)
|
|
59
|
+
} else {
|
|
60
|
+
setAllProducts([])
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
fetchData()
|
|
64
|
+
}, [product, countryCode])
|
|
65
|
+
|
|
66
|
+
// Get current 4 products to display
|
|
67
|
+
const currentProducts = allProducts.slice(currentIndex, currentIndex + 4)
|
|
68
|
+
const maxIndex = Math.max(0, allProducts.length - 4)
|
|
69
|
+
|
|
70
|
+
const handlePrevious = () => {
|
|
71
|
+
setCurrentIndex((prev) => Math.max(0, prev - 4))
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const handleNext = () => {
|
|
75
|
+
setCurrentIndex((prev) => Math.min(maxIndex, prev + 4))
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (!region || !allProducts.length) {
|
|
79
|
+
return null
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const canGoPrevious = currentIndex > 0
|
|
83
|
+
const canGoNext = currentIndex < maxIndex
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<>
|
|
87
|
+
<div className="mt-16 pt-8">
|
|
88
|
+
<div className="flex items-center justify-between mb-8">
|
|
89
|
+
<h2 className="text-2xl font-bold text-gray-900">
|
|
90
|
+
You May Also Like
|
|
91
|
+
</h2>
|
|
92
|
+
<div className="flex items-center gap-2">
|
|
93
|
+
<button
|
|
94
|
+
onClick={handlePrevious}
|
|
95
|
+
disabled={!canGoPrevious}
|
|
96
|
+
className={`w-10 h-10 rounded-full bg-white border border-gray-300 flex items-center justify-center transition-colors ${canGoPrevious
|
|
97
|
+
? 'hover:bg-gray-50 cursor-pointer'
|
|
98
|
+
: 'opacity-50 cursor-not-allowed'
|
|
99
|
+
}`}
|
|
100
|
+
aria-label="Previous products"
|
|
101
|
+
>
|
|
102
|
+
<svg
|
|
103
|
+
width="16"
|
|
104
|
+
height="16"
|
|
105
|
+
viewBox="0 0 24 24"
|
|
106
|
+
fill="none"
|
|
107
|
+
stroke="black"
|
|
108
|
+
strokeWidth="2"
|
|
109
|
+
strokeLinecap="round"
|
|
110
|
+
strokeLinejoin="round"
|
|
111
|
+
>
|
|
112
|
+
<polyline points="15 18 9 12 15 6"></polyline>
|
|
113
|
+
</svg>
|
|
114
|
+
</button>
|
|
115
|
+
<button
|
|
116
|
+
onClick={handleNext}
|
|
117
|
+
disabled={!canGoNext}
|
|
118
|
+
className={`w-10 h-10 rounded-full bg-[#8B5AB1] flex items-center justify-center transition-colors ${canGoNext
|
|
119
|
+
? 'hover:bg-[#7a4a9a] cursor-pointer'
|
|
120
|
+
: 'opacity-50 cursor-not-allowed'
|
|
121
|
+
}`}
|
|
122
|
+
aria-label="Next products"
|
|
123
|
+
>
|
|
124
|
+
<svg
|
|
125
|
+
width="16"
|
|
126
|
+
height="16"
|
|
127
|
+
viewBox="0 0 24 24"
|
|
128
|
+
fill="none"
|
|
129
|
+
stroke="white"
|
|
130
|
+
strokeWidth="2"
|
|
131
|
+
strokeLinecap="round"
|
|
132
|
+
strokeLinejoin="round"
|
|
133
|
+
>
|
|
134
|
+
<polyline points="9 18 15 12 9 6"></polyline>
|
|
135
|
+
</svg>
|
|
136
|
+
</button>
|
|
137
|
+
</div>
|
|
138
|
+
</div>
|
|
139
|
+
|
|
140
|
+
<div className="related-products-container">
|
|
141
|
+
<ul className="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-3 sm:gap-4 md:gap-5 lg:gap-6 justify-items-center">
|
|
142
|
+
{currentProducts.map((product) => (
|
|
143
|
+
<li key={product.id} className="w-full flex justify-center">
|
|
144
|
+
<ProductCard region={region} product={product} />
|
|
145
|
+
</li>
|
|
146
|
+
))}
|
|
147
|
+
</ul>
|
|
148
|
+
</div>
|
|
149
|
+
</div>
|
|
150
|
+
</>
|
|
151
|
+
)
|
|
152
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@modules/common/components/product/review-modal"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@modules/common/components/product/share-button"
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Container, clx } from "@medusajs/ui"
|
|
2
|
+
import Image from "next/image"
|
|
3
|
+
import React from "react"
|
|
4
|
+
|
|
5
|
+
import PlaceholderImage from "@modules/common/icons/placeholder-image"
|
|
6
|
+
|
|
7
|
+
type ThumbnailProps = {
|
|
8
|
+
thumbnail?: string | null
|
|
9
|
+
// TODO: Fix image typings
|
|
10
|
+
images?: any[] | null
|
|
11
|
+
variantImages?: any[] | null // Variant-specific images (highest priority)
|
|
12
|
+
size?: "small" | "medium" | "large" | "full" | "square"
|
|
13
|
+
isFeatured?: boolean
|
|
14
|
+
className?: string
|
|
15
|
+
"data-testid"?: string
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Function to get the first variant image (prioritize variant images)
|
|
19
|
+
const getFilteredVariantImage = (
|
|
20
|
+
variantImages: any[] | null | undefined,
|
|
21
|
+
thumbnail: string | null | undefined,
|
|
22
|
+
productImages: any[] | null | undefined
|
|
23
|
+
): string | null => {
|
|
24
|
+
if (!variantImages || variantImages.length === 0) {
|
|
25
|
+
return null
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// If variant images exist, always use the first variant image
|
|
29
|
+
// This ensures the correct variant image is shown even if it matches product images
|
|
30
|
+
// The variant image is what the user selected, so it should be prioritized
|
|
31
|
+
return variantImages[0]?.url || null
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const Thumbnail: React.FC<ThumbnailProps> = ({
|
|
35
|
+
thumbnail,
|
|
36
|
+
images,
|
|
37
|
+
variantImages,
|
|
38
|
+
size = "small",
|
|
39
|
+
isFeatured,
|
|
40
|
+
className,
|
|
41
|
+
"data-testid": dataTestid,
|
|
42
|
+
}) => {
|
|
43
|
+
// Priority: filtered variantImages (first image) > thumbnail > images
|
|
44
|
+
// Filter out common images from variant images
|
|
45
|
+
const filteredVariantImage = getFilteredVariantImage(variantImages, thumbnail, images)
|
|
46
|
+
const initialImage = filteredVariantImage || thumbnail || images?.[0]?.url
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<Container
|
|
50
|
+
className={clx(
|
|
51
|
+
"relative w-full overflow-hidden p-4 bg-ui-bg-subtle shadow-elevation-card-rest rounded-large group-hover:shadow-elevation-card-hover transition-shadow ease-in-out duration-150",
|
|
52
|
+
className,
|
|
53
|
+
{
|
|
54
|
+
"aspect-[11/14]": isFeatured,
|
|
55
|
+
"aspect-[9/16]": !isFeatured && size !== "square",
|
|
56
|
+
"aspect-[1/1]": size === "square",
|
|
57
|
+
"w-[180px]": size === "small",
|
|
58
|
+
"w-[290px]": size === "medium",
|
|
59
|
+
"w-[440px]": size === "large",
|
|
60
|
+
"w-full": size === "full",
|
|
61
|
+
}
|
|
62
|
+
)}
|
|
63
|
+
data-testid={dataTestid}
|
|
64
|
+
>
|
|
65
|
+
<ImageOrPlaceholder image={initialImage} size={size} />
|
|
66
|
+
</Container>
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const ImageOrPlaceholder = ({
|
|
71
|
+
image,
|
|
72
|
+
size,
|
|
73
|
+
}: Pick<ThumbnailProps, "size"> & { image?: string }) => {
|
|
74
|
+
return image ? (
|
|
75
|
+
<Image
|
|
76
|
+
src={image}
|
|
77
|
+
alt="Thumbnail"
|
|
78
|
+
className="absolute inset-0 object-cover object-center"
|
|
79
|
+
draggable={false}
|
|
80
|
+
quality={50}
|
|
81
|
+
sizes="(max-width: 576px) 280px, (max-width: 768px) 360px, (max-width: 992px) 480px, 800px"
|
|
82
|
+
fill
|
|
83
|
+
/>
|
|
84
|
+
) : (
|
|
85
|
+
<div className="w-full h-full absolute inset-0 flex items-center justify-center">
|
|
86
|
+
<PlaceholderImage size={size === "small" ? 16 : 24} />
|
|
87
|
+
</div>
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export default Thumbnail
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@modules/common/components/product/wishlist-icon"
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import React, { createContext, useContext, useState, useEffect } from "react"
|
|
4
|
+
import { useSearchParams } from "next/navigation"
|
|
5
|
+
|
|
6
|
+
interface ProductContextType {
|
|
7
|
+
selectedVariantId: string | undefined
|
|
8
|
+
selectedOptions: Record<string, string | undefined>
|
|
9
|
+
setSelectedVariantId: (id: string | undefined) => void
|
|
10
|
+
setSelectedOptions: (options: Record<string, string | undefined>) => void
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const ProductContext = createContext<ProductContextType | undefined>(undefined)
|
|
14
|
+
|
|
15
|
+
export const ProductProvider = ({ children }: { children: React.ReactNode }) => {
|
|
16
|
+
const searchParams = useSearchParams()
|
|
17
|
+
const initialVariantId = searchParams.get("v_id") || undefined
|
|
18
|
+
const [selectedVariantId, setSelectedVariantId] = useState<string | undefined>(
|
|
19
|
+
initialVariantId
|
|
20
|
+
)
|
|
21
|
+
const [selectedOptions, setSelectedOptions] = useState<
|
|
22
|
+
Record<string, string | undefined>
|
|
23
|
+
>({})
|
|
24
|
+
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
const vId = searchParams.get("v_id")
|
|
27
|
+
if (vId) {
|
|
28
|
+
setSelectedVariantId(vId)
|
|
29
|
+
}
|
|
30
|
+
}, [searchParams])
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<ProductContext.Provider
|
|
34
|
+
value={{
|
|
35
|
+
selectedVariantId,
|
|
36
|
+
selectedOptions,
|
|
37
|
+
setSelectedVariantId,
|
|
38
|
+
setSelectedOptions,
|
|
39
|
+
}}
|
|
40
|
+
>
|
|
41
|
+
{children}
|
|
42
|
+
</ProductContext.Provider>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const useProductContext = () => {
|
|
47
|
+
const context = useContext(ProductContext)
|
|
48
|
+
if (context === undefined) {
|
|
49
|
+
throw new Error("useProductContext must be used within a ProductProvider")
|
|
50
|
+
}
|
|
51
|
+
return context
|
|
52
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ProductPage } from "@controllers/product/product-page"
|
|
2
|
+
import { HttpTypes } from "@medusajs/types"
|
|
3
|
+
|
|
4
|
+
type ProductTemplateProps = {
|
|
5
|
+
product: HttpTypes.StoreProduct
|
|
6
|
+
region: HttpTypes.StoreRegion
|
|
7
|
+
countryCode: string
|
|
8
|
+
images: HttpTypes.StoreProductImage[]
|
|
9
|
+
selectedVariantId?: string | null
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default async function ProductTemplate({
|
|
13
|
+
product,
|
|
14
|
+
region,
|
|
15
|
+
countryCode,
|
|
16
|
+
images,
|
|
17
|
+
}: ProductTemplateProps) {
|
|
18
|
+
return (
|
|
19
|
+
<ProductPage
|
|
20
|
+
product={product}
|
|
21
|
+
region={region}
|
|
22
|
+
countryCode={countryCode}
|
|
23
|
+
images={images}
|
|
24
|
+
/>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@controllers/product/product-actions-wrapper"
|
package/templates/storefront/src/modules/shipping/components/free-shipping-price-nudge/index.tsx
ADDED
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { convertToLocale } from "@core/util/money"
|
|
4
|
+
import { CheckCircleSolid, XMark } from "@medusajs/icons"
|
|
5
|
+
import {
|
|
6
|
+
HttpTypes,
|
|
7
|
+
StoreCart,
|
|
8
|
+
StoreCartShippingOption,
|
|
9
|
+
StorePrice,
|
|
10
|
+
} from "@medusajs/types"
|
|
11
|
+
import { Button, clx } from "@medusajs/ui"
|
|
12
|
+
import LocalizedClientLink from "@modules/common/components/localized-client-link"
|
|
13
|
+
import { useState } from "react"
|
|
14
|
+
import { StoreFreeShippingPrice } from "types/global"
|
|
15
|
+
|
|
16
|
+
const computeTarget = (
|
|
17
|
+
cart: HttpTypes.StoreCart,
|
|
18
|
+
price: HttpTypes.StorePrice
|
|
19
|
+
) => {
|
|
20
|
+
const priceRule = (price.price_rules || []).find(
|
|
21
|
+
(pr) => pr.attribute === "item_total"
|
|
22
|
+
)!
|
|
23
|
+
|
|
24
|
+
const currentAmount = cart.item_total
|
|
25
|
+
const targetAmount = parseFloat(priceRule.value)
|
|
26
|
+
|
|
27
|
+
if (priceRule.operator === "gt") {
|
|
28
|
+
return {
|
|
29
|
+
current_amount: currentAmount,
|
|
30
|
+
target_amount: targetAmount,
|
|
31
|
+
target_reached: currentAmount > targetAmount,
|
|
32
|
+
target_remaining:
|
|
33
|
+
currentAmount > targetAmount ? 0 : targetAmount + 1 - currentAmount,
|
|
34
|
+
remaining_percentage: (currentAmount / targetAmount) * 100,
|
|
35
|
+
}
|
|
36
|
+
} else if (priceRule.operator === "gte") {
|
|
37
|
+
return {
|
|
38
|
+
current_amount: currentAmount,
|
|
39
|
+
target_amount: targetAmount,
|
|
40
|
+
target_reached: currentAmount > targetAmount,
|
|
41
|
+
target_remaining:
|
|
42
|
+
currentAmount > targetAmount ? 0 : targetAmount - currentAmount,
|
|
43
|
+
remaining_percentage: (currentAmount / targetAmount) * 100,
|
|
44
|
+
}
|
|
45
|
+
} else if (priceRule.operator === "lt") {
|
|
46
|
+
return {
|
|
47
|
+
current_amount: currentAmount,
|
|
48
|
+
target_amount: targetAmount,
|
|
49
|
+
target_reached: targetAmount > currentAmount,
|
|
50
|
+
target_remaining:
|
|
51
|
+
targetAmount > currentAmount ? 0 : currentAmount + 1 - targetAmount,
|
|
52
|
+
remaining_percentage: (currentAmount / targetAmount) * 100,
|
|
53
|
+
}
|
|
54
|
+
} else if (priceRule.operator === "lte") {
|
|
55
|
+
return {
|
|
56
|
+
current_amount: currentAmount,
|
|
57
|
+
target_amount: targetAmount,
|
|
58
|
+
target_reached: targetAmount > currentAmount,
|
|
59
|
+
target_remaining:
|
|
60
|
+
targetAmount > currentAmount ? 0 : currentAmount - targetAmount,
|
|
61
|
+
remaining_percentage: (currentAmount / targetAmount) * 100,
|
|
62
|
+
}
|
|
63
|
+
} else {
|
|
64
|
+
return {
|
|
65
|
+
current_amount: currentAmount,
|
|
66
|
+
target_amount: targetAmount,
|
|
67
|
+
target_reached: currentAmount === targetAmount,
|
|
68
|
+
target_remaining:
|
|
69
|
+
targetAmount > currentAmount ? 0 : targetAmount - currentAmount,
|
|
70
|
+
remaining_percentage: (currentAmount / targetAmount) * 100,
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export default function ShippingPriceNudge({
|
|
76
|
+
variant = "inline",
|
|
77
|
+
cart,
|
|
78
|
+
shippingOptions,
|
|
79
|
+
}: {
|
|
80
|
+
variant?: "popup" | "inline"
|
|
81
|
+
cart: StoreCart
|
|
82
|
+
shippingOptions: StoreCartShippingOption[]
|
|
83
|
+
}) {
|
|
84
|
+
if (!cart || !shippingOptions?.length) {
|
|
85
|
+
return
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Check if any shipping options have a conditional price based on item_total
|
|
89
|
+
const freeShippingPrice = shippingOptions
|
|
90
|
+
.map((shippingOption) => {
|
|
91
|
+
const calculatedPrice = shippingOption.calculated_price
|
|
92
|
+
|
|
93
|
+
if (!calculatedPrice) {
|
|
94
|
+
return
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Get all prices that are:
|
|
98
|
+
// 1. Currency code is same as the cart's
|
|
99
|
+
// 2. Have a rule that is set on item_total
|
|
100
|
+
const validCurrencyPrices = shippingOption.prices.filter(
|
|
101
|
+
(price) =>
|
|
102
|
+
price.currency_code === cart.currency_code &&
|
|
103
|
+
(price.price_rules || []).some(
|
|
104
|
+
(priceRule) => priceRule.attribute === "item_total"
|
|
105
|
+
)
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
return validCurrencyPrices.map((price) => {
|
|
109
|
+
return {
|
|
110
|
+
...price,
|
|
111
|
+
shipping_option_id: shippingOption.id,
|
|
112
|
+
...computeTarget(cart, price),
|
|
113
|
+
}
|
|
114
|
+
})
|
|
115
|
+
})
|
|
116
|
+
.flat(1)
|
|
117
|
+
.filter(Boolean)
|
|
118
|
+
// We focus here entirely on free shipping, but this can be edited to handle multiple layers
|
|
119
|
+
// of reduced shipping prices.
|
|
120
|
+
.find((price) => price?.amount === 0)
|
|
121
|
+
|
|
122
|
+
if (!freeShippingPrice) {
|
|
123
|
+
return
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (variant === "popup") {
|
|
127
|
+
return <FreeShippingPopup cart={cart} price={freeShippingPrice} />
|
|
128
|
+
} else {
|
|
129
|
+
return <FreeShippingInline cart={cart} price={freeShippingPrice} />
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function FreeShippingInline({
|
|
134
|
+
cart,
|
|
135
|
+
price,
|
|
136
|
+
}: {
|
|
137
|
+
cart: StoreCart
|
|
138
|
+
price: StorePrice & {
|
|
139
|
+
target_reached: boolean
|
|
140
|
+
target_remaining: number
|
|
141
|
+
remaining_percentage: number
|
|
142
|
+
}
|
|
143
|
+
}) {
|
|
144
|
+
return (
|
|
145
|
+
<div className="bg-neutral-100 p-2 rounded-lg border">
|
|
146
|
+
<div className="space-y-1.5">
|
|
147
|
+
<div className="flex justify-between text-xs text-neutral-600">
|
|
148
|
+
<div>
|
|
149
|
+
{price.target_reached ? (
|
|
150
|
+
<div className="flex items-center gap-1.5">
|
|
151
|
+
<CheckCircleSolid className="text-green-500 inline-block" />{" "}
|
|
152
|
+
Free Shipping unlocked!
|
|
153
|
+
</div>
|
|
154
|
+
) : (
|
|
155
|
+
`Unlock Free Shipping`
|
|
156
|
+
)}
|
|
157
|
+
</div>
|
|
158
|
+
|
|
159
|
+
<div
|
|
160
|
+
className={clx("visible", {
|
|
161
|
+
"opacity-0 invisible": price.target_reached,
|
|
162
|
+
})}
|
|
163
|
+
>
|
|
164
|
+
Only{" "}
|
|
165
|
+
<span className="text-neutral-950">
|
|
166
|
+
{convertToLocale({
|
|
167
|
+
amount: price.target_remaining,
|
|
168
|
+
currency_code: cart.currency_code,
|
|
169
|
+
})}
|
|
170
|
+
</span>{" "}
|
|
171
|
+
away
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
174
|
+
<div className="flex justify-between gap-1">
|
|
175
|
+
<div
|
|
176
|
+
className={clx(
|
|
177
|
+
"bg-gradient-to-r from-zinc-400 to-zinc-500 h-1 rounded-full max-w-full duration-500 ease-in-out",
|
|
178
|
+
{
|
|
179
|
+
"from-green-400 to-green-500": price.target_reached,
|
|
180
|
+
}
|
|
181
|
+
)}
|
|
182
|
+
style={{ width: `${price.remaining_percentage}%` }}
|
|
183
|
+
></div>
|
|
184
|
+
<div className="bg-neutral-300 h-1 rounded-full w-fit flex-grow"></div>
|
|
185
|
+
</div>
|
|
186
|
+
</div>
|
|
187
|
+
</div>
|
|
188
|
+
)
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function FreeShippingPopup({
|
|
192
|
+
cart,
|
|
193
|
+
price,
|
|
194
|
+
}: {
|
|
195
|
+
cart: StoreCart
|
|
196
|
+
price: StoreFreeShippingPrice
|
|
197
|
+
}) {
|
|
198
|
+
const [isClosed, setIsClosed] = useState(false)
|
|
199
|
+
|
|
200
|
+
return (
|
|
201
|
+
<div
|
|
202
|
+
className={clx(
|
|
203
|
+
"fixed bottom-5 right-5 flex flex-col items-end gap-2 transition-all duration-500 ease-in-out z-10",
|
|
204
|
+
{
|
|
205
|
+
"opacity-0 invisible delay-1000": price.target_reached,
|
|
206
|
+
"opacity-0 invisible": isClosed,
|
|
207
|
+
"opacity-100 visible": !price.target_reached && !isClosed,
|
|
208
|
+
}
|
|
209
|
+
)}
|
|
210
|
+
>
|
|
211
|
+
<div>
|
|
212
|
+
<Button
|
|
213
|
+
className="rounded-full bg-neutral-900 shadow-none outline-none border-none text-[15px] p-2"
|
|
214
|
+
onClick={() => setIsClosed(true)}
|
|
215
|
+
>
|
|
216
|
+
<XMark />
|
|
217
|
+
</Button>
|
|
218
|
+
</div>
|
|
219
|
+
|
|
220
|
+
<div className="w-[400px] bg-black text-white p-6 rounded-lg ">
|
|
221
|
+
<div className="pb-4">
|
|
222
|
+
<div className="space-y-3">
|
|
223
|
+
<div className="flex justify-between text-[15px] text-neutral-400">
|
|
224
|
+
<div>
|
|
225
|
+
{price.target_reached ? (
|
|
226
|
+
<div className="flex items-center gap-1.5">
|
|
227
|
+
<CheckCircleSolid className="text-green-500 inline-block" />{" "}
|
|
228
|
+
Free Shipping unlocked!
|
|
229
|
+
</div>
|
|
230
|
+
) : (
|
|
231
|
+
`Unlock Free Shipping`
|
|
232
|
+
)}
|
|
233
|
+
</div>
|
|
234
|
+
|
|
235
|
+
<div
|
|
236
|
+
className={clx("visible", {
|
|
237
|
+
"opacity-0 invisible": price.target_reached,
|
|
238
|
+
})}
|
|
239
|
+
>
|
|
240
|
+
Only{" "}
|
|
241
|
+
<span className="text-white">
|
|
242
|
+
{convertToLocale({
|
|
243
|
+
amount: price.target_remaining,
|
|
244
|
+
currency_code: cart.currency_code,
|
|
245
|
+
})}
|
|
246
|
+
</span>{" "}
|
|
247
|
+
away
|
|
248
|
+
</div>
|
|
249
|
+
</div>
|
|
250
|
+
<div className="flex justify-between gap-1">
|
|
251
|
+
<div
|
|
252
|
+
className={clx(
|
|
253
|
+
"bg-gradient-to-r from-zinc-400 to-zinc-500 h-1.5 rounded-full max-w-full duration-500 ease-in-out",
|
|
254
|
+
{
|
|
255
|
+
"from-green-400 to-green-500": price.target_reached,
|
|
256
|
+
}
|
|
257
|
+
)}
|
|
258
|
+
style={{ width: `${price.remaining_percentage}%` }}
|
|
259
|
+
></div>
|
|
260
|
+
<div className="bg-zinc-600 h-1.5 rounded-full w-fit flex-grow"></div>
|
|
261
|
+
</div>
|
|
262
|
+
</div>
|
|
263
|
+
</div>
|
|
264
|
+
|
|
265
|
+
<div className="flex gap-3">
|
|
266
|
+
<LocalizedClientLink
|
|
267
|
+
className="rounded-2xl bg-transparent shadow-none outline-none border-[1px] border-white text-[15px] py-2.5 px-4"
|
|
268
|
+
href="/cart"
|
|
269
|
+
>
|
|
270
|
+
View cart
|
|
271
|
+
</LocalizedClientLink>
|
|
272
|
+
|
|
273
|
+
<LocalizedClientLink
|
|
274
|
+
className="flex-grow rounded-2xl bg-white text-neutral-950 shadow-none outline-none border-[1px] border-white text-[15px] py-2.5 px-4 text-center"
|
|
275
|
+
href="/store"
|
|
276
|
+
>
|
|
277
|
+
View products
|
|
278
|
+
</LocalizedClientLink>
|
|
279
|
+
</div>
|
|
280
|
+
</div>
|
|
281
|
+
</div>
|
|
282
|
+
)
|
|
283
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const SkeletonCardDetails = () => {
|
|
2
|
+
return (
|
|
3
|
+
<div className="flex flex-col gap-1 my-4 transition-all duration-150 ease-in-out">
|
|
4
|
+
<div className="h-4 bg-ui-bg-component-pressed rounded-md w-1/4 animate-pulse mb-1"></div>
|
|
5
|
+
<div className="pt-3 pb-1 block w-full h-11 px-4 mt-0 bg-ui-bg-field border rounded-md appearance-none border-ui-border-base animate-pulse" />
|
|
6
|
+
</div>
|
|
7
|
+
)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default SkeletonCardDetails
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Table } from "@medusajs/ui"
|
|
2
|
+
|
|
3
|
+
const SkeletonCartItem = () => {
|
|
4
|
+
return (
|
|
5
|
+
<Table.Row className="w-full m-4">
|
|
6
|
+
<Table.Cell className="!pl-0 p-4 w-24">
|
|
7
|
+
<div className="flex w-24 h-24 p-4 bg-gray-200 rounded-large animate-pulse" />
|
|
8
|
+
</Table.Cell>
|
|
9
|
+
<Table.Cell className="text-left">
|
|
10
|
+
<div className="flex flex-col gap-y-2">
|
|
11
|
+
<div className="w-32 h-4 bg-gray-200 animate-pulse" />
|
|
12
|
+
<div className="w-24 h-4 bg-gray-200 animate-pulse" />
|
|
13
|
+
</div>
|
|
14
|
+
</Table.Cell>
|
|
15
|
+
<Table.Cell>
|
|
16
|
+
<div className="flex gap-2 items-center">
|
|
17
|
+
<div className="w-6 h-8 bg-gray-200 animate-pulse" />
|
|
18
|
+
<div className="w-14 h-10 bg-gray-200 animate-pulse" />
|
|
19
|
+
</div>
|
|
20
|
+
</Table.Cell>
|
|
21
|
+
<Table.Cell>
|
|
22
|
+
<div className="flex gap-2">
|
|
23
|
+
<div className="w-12 h-6 bg-gray-200 animate-pulse" />
|
|
24
|
+
</div>
|
|
25
|
+
</Table.Cell>
|
|
26
|
+
<Table.Cell className="!pr-0 text-right">
|
|
27
|
+
<div className="flex gap-2 justify-end">
|
|
28
|
+
<div className="w-12 h-6 bg-gray-200 animate-pulse" />
|
|
29
|
+
</div>
|
|
30
|
+
</Table.Cell>
|
|
31
|
+
</Table.Row>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default SkeletonCartItem
|