@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.
Files changed (338) hide show
  1. package/bin/create-storefront.js +239 -0
  2. package/lib/kit-next-config.js +84 -0
  3. package/package.json +32 -0
  4. package/templates/storefront/.eslintrc.json +3 -0
  5. package/templates/storefront/README.md +35 -0
  6. package/templates/storefront/check-env-variables.js +51 -0
  7. package/templates/storefront/kit-next-config.js +71 -0
  8. package/templates/storefront/next-env.d.ts +5 -0
  9. package/templates/storefront/next.config.js +25 -0
  10. package/templates/storefront/package.json +56 -0
  11. package/templates/storefront/postcss.config.js +6 -0
  12. package/templates/storefront/public/favicon.png +0 -0
  13. package/templates/storefront/src/app/[countryCode]/(checkout)/checkout/page.tsx +23 -0
  14. package/templates/storefront/src/app/[countryCode]/(checkout)/checkout/payment/page.tsx +47 -0
  15. package/templates/storefront/src/app/[countryCode]/(checkout)/layout.tsx +31 -0
  16. package/templates/storefront/src/app/[countryCode]/(checkout)/not-found.tsx +19 -0
  17. package/templates/storefront/src/app/[countryCode]/(main)/account/@dashboard/addresses/page.tsx +31 -0
  18. package/templates/storefront/src/app/[countryCode]/(main)/account/@dashboard/loading.tsx +9 -0
  19. package/templates/storefront/src/app/[countryCode]/(main)/account/@dashboard/orders/details/[id]/page.tsx +35 -0
  20. package/templates/storefront/src/app/[countryCode]/(main)/account/@dashboard/orders/exchange/[id]/page.tsx +47 -0
  21. package/templates/storefront/src/app/[countryCode]/(main)/account/@dashboard/orders/page.tsx +28 -0
  22. package/templates/storefront/src/app/[countryCode]/(main)/account/@dashboard/orders/return/[id]/page.tsx +66 -0
  23. package/templates/storefront/src/app/[countryCode]/(main)/account/@dashboard/page.tsx +22 -0
  24. package/templates/storefront/src/app/[countryCode]/(main)/account/@dashboard/payment-methods/page.tsx +23 -0
  25. package/templates/storefront/src/app/[countryCode]/(main)/account/@dashboard/profile/page.tsx +43 -0
  26. package/templates/storefront/src/app/[countryCode]/(main)/account/@login/default.tsx +11 -0
  27. package/templates/storefront/src/app/[countryCode]/(main)/account/@login/page.tsx +18 -0
  28. package/templates/storefront/src/app/[countryCode]/(main)/account/guest-orders/page.tsx +13 -0
  29. package/templates/storefront/src/app/[countryCode]/(main)/account/layout.tsx +22 -0
  30. package/templates/storefront/src/app/[countryCode]/(main)/account/loading.tsx +9 -0
  31. package/templates/storefront/src/app/[countryCode]/(main)/cart/loading.tsx +5 -0
  32. package/templates/storefront/src/app/[countryCode]/(main)/cart/not-found.tsx +21 -0
  33. package/templates/storefront/src/app/[countryCode]/(main)/cart/page.tsx +23 -0
  34. package/templates/storefront/src/app/[countryCode]/(main)/categories/[...category]/page.tsx +11 -0
  35. package/templates/storefront/src/app/[countryCode]/(main)/collections/[handle]/page.tsx +11 -0
  36. package/templates/storefront/src/app/[countryCode]/(main)/contact/page.tsx +21 -0
  37. package/templates/storefront/src/app/[countryCode]/(main)/guest-orders/page.tsx +12 -0
  38. package/templates/storefront/src/app/[countryCode]/(main)/help/page.tsx +28 -0
  39. package/templates/storefront/src/app/[countryCode]/(main)/layout.tsx +21 -0
  40. package/templates/storefront/src/app/[countryCode]/(main)/not-found.tsx +20 -0
  41. package/templates/storefront/src/app/[countryCode]/(main)/order/[id]/confirmed/loading.tsx +5 -0
  42. package/templates/storefront/src/app/[countryCode]/(main)/order/[id]/confirmed/page.tsx +23 -0
  43. package/templates/storefront/src/app/[countryCode]/(main)/order/[id]/transfer/[token]/accept/page.tsx +41 -0
  44. package/templates/storefront/src/app/[countryCode]/(main)/order/[id]/transfer/[token]/decline/page.tsx +41 -0
  45. package/templates/storefront/src/app/[countryCode]/(main)/order/[id]/transfer/[token]/page.tsx +38 -0
  46. package/templates/storefront/src/app/[countryCode]/(main)/order/exchange/[id]/page.tsx +47 -0
  47. package/templates/storefront/src/app/[countryCode]/(main)/order/return/[id]/page.tsx +61 -0
  48. package/templates/storefront/src/app/[countryCode]/(main)/orders/[id]/page.tsx +33 -0
  49. package/templates/storefront/src/app/[countryCode]/(main)/page.tsx +24 -0
  50. package/templates/storefront/src/app/[countryCode]/(main)/privacy-policy/page.tsx +173 -0
  51. package/templates/storefront/src/app/[countryCode]/(main)/products/[handle]/page.tsx +193 -0
  52. package/templates/storefront/src/app/[countryCode]/(main)/reset-password/page.tsx +192 -0
  53. package/templates/storefront/src/app/[countryCode]/(main)/store/page.tsx +72 -0
  54. package/templates/storefront/src/app/[countryCode]/(main)/terms-of-use/page.tsx +179 -0
  55. package/templates/storefront/src/app/[countryCode]/(main)/wishlist/page.tsx +19 -0
  56. package/templates/storefront/src/app/api/meta/event/route.ts +63 -0
  57. package/templates/storefront/src/app/auth/customer/google/callback/page.tsx +126 -0
  58. package/templates/storefront/src/app/layout.tsx +104 -0
  59. package/templates/storefront/src/app/not-found.tsx +30 -0
  60. package/templates/storefront/src/app/opengraph-image.jpg +0 -0
  61. package/templates/storefront/src/app/robots.ts +15 -0
  62. package/templates/storefront/src/app/sitemap.ts +65 -0
  63. package/templates/storefront/src/app/twitter-image.jpg +0 -0
  64. package/templates/storefront/src/modules/account/components/account-deletion/index.tsx +160 -0
  65. package/templates/storefront/src/modules/account/components/account-info/index.tsx +145 -0
  66. package/templates/storefront/src/modules/account/components/account-nav/icons.tsx +43 -0
  67. package/templates/storefront/src/modules/account/components/account-nav/index.tsx +318 -0
  68. package/templates/storefront/src/modules/account/components/account-nav/logout-modal.tsx +92 -0
  69. package/templates/storefront/src/modules/account/components/account-nav/payment-methods-icon.tsx +9 -0
  70. package/templates/storefront/src/modules/account/components/address-book/index.tsx +47 -0
  71. package/templates/storefront/src/modules/account/components/address-card/add-address.tsx +377 -0
  72. package/templates/storefront/src/modules/account/components/address-card/edit-address-modal.tsx +468 -0
  73. package/templates/storefront/src/modules/account/components/deletion-pending-modal/index.tsx +213 -0
  74. package/templates/storefront/src/modules/account/components/forgot-password/index.tsx +1 -0
  75. package/templates/storefront/src/modules/account/components/login/index.tsx +1 -0
  76. package/templates/storefront/src/modules/account/components/order-card/index.tsx +221 -0
  77. package/templates/storefront/src/modules/account/components/order-overview/index.tsx +159 -0
  78. package/templates/storefront/src/modules/account/components/overview/index.tsx +189 -0
  79. package/templates/storefront/src/modules/account/components/profile-billing-address/index.tsx +447 -0
  80. package/templates/storefront/src/modules/account/components/profile-email/index.tsx +75 -0
  81. package/templates/storefront/src/modules/account/components/profile-form/index.tsx +416 -0
  82. package/templates/storefront/src/modules/account/components/profile-name/index.tsx +76 -0
  83. package/templates/storefront/src/modules/account/components/profile-password/index.tsx +70 -0
  84. package/templates/storefront/src/modules/account/components/profile-phone/index.tsx +185 -0
  85. package/templates/storefront/src/modules/account/components/register/index.tsx +1 -0
  86. package/templates/storefront/src/modules/account/components/return-item-selector/index.tsx +187 -0
  87. package/templates/storefront/src/modules/account/components/return-shipping-selector/index.tsx +118 -0
  88. package/templates/storefront/src/modules/account/components/transfer-request-form/index.tsx +81 -0
  89. package/templates/storefront/src/modules/account/templates/account-layout.tsx +38 -0
  90. package/templates/storefront/src/modules/account/templates/exchange-request-template.tsx +389 -0
  91. package/templates/storefront/src/modules/account/templates/guest-orders-template.tsx +123 -0
  92. package/templates/storefront/src/modules/account/templates/login-template.tsx +44 -0
  93. package/templates/storefront/src/modules/account/templates/payment-methods-template.tsx +478 -0
  94. package/templates/storefront/src/modules/account/templates/return-request-template.tsx +300 -0
  95. package/templates/storefront/src/modules/cart/components/abandoned-carts/ScrollToPendingOrdersButton.tsx +21 -0
  96. package/templates/storefront/src/modules/cart/components/abandoned-carts/index.tsx +335 -0
  97. package/templates/storefront/src/modules/cart/components/applied-promotions/index.tsx +121 -0
  98. package/templates/storefront/src/modules/cart/components/cart-delivery-selection/index.tsx +203 -0
  99. package/templates/storefront/src/modules/cart/components/cart-item-card/index.tsx +476 -0
  100. package/templates/storefront/src/modules/cart/components/cart-item-select/index.tsx +73 -0
  101. package/templates/storefront/src/modules/cart/components/cart-view-tracker/index.tsx +44 -0
  102. package/templates/storefront/src/modules/cart/components/delivery-information/index.tsx +89 -0
  103. package/templates/storefront/src/modules/cart/components/empty-cart-message/index.tsx +38 -0
  104. package/templates/storefront/src/modules/cart/components/item/index.tsx +150 -0
  105. package/templates/storefront/src/modules/cart/components/pincode-checker/index.tsx +174 -0
  106. package/templates/storefront/src/modules/cart/components/sign-in-prompt/index.tsx +26 -0
  107. package/templates/storefront/src/modules/cart/components/you-may-also-like/index.tsx +137 -0
  108. package/templates/storefront/src/modules/cart/templates/index.tsx +88 -0
  109. package/templates/storefront/src/modules/cart/templates/items.tsx +49 -0
  110. package/templates/storefront/src/modules/cart/templates/preview.tsx +51 -0
  111. package/templates/storefront/src/modules/cart/templates/summary.tsx +29 -0
  112. package/templates/storefront/src/modules/checkout/components/add-address-modal/index.tsx +390 -0
  113. package/templates/storefront/src/modules/checkout/components/address-card/index.tsx +135 -0
  114. package/templates/storefront/src/modules/checkout/components/address-select/index.tsx +116 -0
  115. package/templates/storefront/src/modules/checkout/components/addresses/index.tsx +605 -0
  116. package/templates/storefront/src/modules/checkout/components/back-link/index.tsx +32 -0
  117. package/templates/storefront/src/modules/checkout/components/billing_address/index.tsx +301 -0
  118. package/templates/storefront/src/modules/checkout/components/checkout-begin-tracker/index.tsx +45 -0
  119. package/templates/storefront/src/modules/checkout/components/checkout-leave-guard/index.tsx +109 -0
  120. package/templates/storefront/src/modules/checkout/components/checkout-shipping-tracker/index.tsx +45 -0
  121. package/templates/storefront/src/modules/checkout/components/country-select/index.tsx +50 -0
  122. package/templates/storefront/src/modules/checkout/components/discount-code/index.tsx +220 -0
  123. package/templates/storefront/src/modules/checkout/components/error-message/index.tsx +13 -0
  124. package/templates/storefront/src/modules/checkout/components/payment/index.tsx +572 -0
  125. package/templates/storefront/src/modules/checkout/components/payment-button/index.tsx +257 -0
  126. package/templates/storefront/src/modules/checkout/components/payment-button/razorpay-payment-button.tsx +136 -0
  127. package/templates/storefront/src/modules/checkout/components/payment-container/index.tsx +129 -0
  128. package/templates/storefront/src/modules/checkout/components/payment-test/index.tsx +12 -0
  129. package/templates/storefront/src/modules/checkout/components/payment-wrapper/index.tsx +50 -0
  130. package/templates/storefront/src/modules/checkout/components/payment-wrapper/stripe-wrapper.tsx +54 -0
  131. package/templates/storefront/src/modules/checkout/components/processing-overlay/index.tsx +83 -0
  132. package/templates/storefront/src/modules/checkout/components/review/index.tsx +60 -0
  133. package/templates/storefront/src/modules/checkout/components/select-address-modal/index.tsx +103 -0
  134. package/templates/storefront/src/modules/checkout/components/shipping/index.tsx +533 -0
  135. package/templates/storefront/src/modules/checkout/components/shipping-address/index.tsx +521 -0
  136. package/templates/storefront/src/modules/checkout/components/submit-button/index.tsx +32 -0
  137. package/templates/storefront/src/modules/checkout/templates/checkout-form/index.tsx +38 -0
  138. package/templates/storefront/src/modules/checkout/templates/checkout-summary/index.tsx +274 -0
  139. package/templates/storefront/src/modules/common/components/breadcrumb/index.tsx +43 -0
  140. package/templates/storefront/src/modules/common/components/cart-totals/index.tsx +473 -0
  141. package/templates/storefront/src/modules/common/components/checkbox/index.tsx +98 -0
  142. package/templates/storefront/src/modules/common/components/delete-button/index.tsx +156 -0
  143. package/templates/storefront/src/modules/common/components/divider/index.tsx +9 -0
  144. package/templates/storefront/src/modules/common/components/filter-checkbox-group/index.tsx +134 -0
  145. package/templates/storefront/src/modules/common/components/filter-radio-group/index.tsx +62 -0
  146. package/templates/storefront/src/modules/common/components/input/index.tsx +79 -0
  147. package/templates/storefront/src/modules/common/components/interactive-link/index.tsx +33 -0
  148. package/templates/storefront/src/modules/common/components/line-item-options/index.tsx +26 -0
  149. package/templates/storefront/src/modules/common/components/line-item-price/index.tsx +64 -0
  150. package/templates/storefront/src/modules/common/components/line-item-unit-price/index.tsx +61 -0
  151. package/templates/storefront/src/modules/common/components/localized-client-link/index.tsx +32 -0
  152. package/templates/storefront/src/modules/common/components/login-popup/index.tsx +78 -0
  153. package/templates/storefront/src/modules/common/components/modal/index.tsx +123 -0
  154. package/templates/storefront/src/modules/common/components/native-select/index.tsx +75 -0
  155. package/templates/storefront/src/modules/common/components/obfuscated-email/index.tsx +30 -0
  156. package/templates/storefront/src/modules/common/components/product/product-rating/index.tsx +172 -0
  157. package/templates/storefront/src/modules/common/components/product/review-modal/index.tsx +333 -0
  158. package/templates/storefront/src/modules/common/components/product/share-button/index.tsx +227 -0
  159. package/templates/storefront/src/modules/common/components/product/wishlist-icon/index.tsx +46 -0
  160. package/templates/storefront/src/modules/common/components/radio/index.tsx +27 -0
  161. package/templates/storefront/src/modules/common/components/select/index.tsx +164 -0
  162. package/templates/storefront/src/modules/common/components/side-panel/index.tsx +65 -0
  163. package/templates/storefront/src/modules/common/icons/arrow-left.tsx +36 -0
  164. package/templates/storefront/src/modules/common/icons/back.tsx +37 -0
  165. package/templates/storefront/src/modules/common/icons/bancontact.tsx +26 -0
  166. package/templates/storefront/src/modules/common/icons/chevron-down.tsx +30 -0
  167. package/templates/storefront/src/modules/common/icons/delivered.tsx +29 -0
  168. package/templates/storefront/src/modules/common/icons/envelope.tsx +27 -0
  169. package/templates/storefront/src/modules/common/icons/eye-off.tsx +37 -0
  170. package/templates/storefront/src/modules/common/icons/eye.tsx +37 -0
  171. package/templates/storefront/src/modules/common/icons/fast-delivery.tsx +65 -0
  172. package/templates/storefront/src/modules/common/icons/ideal.tsx +26 -0
  173. package/templates/storefront/src/modules/common/icons/lock.tsx +31 -0
  174. package/templates/storefront/src/modules/common/icons/map-pin.tsx +37 -0
  175. package/templates/storefront/src/modules/common/icons/medusa.tsx +27 -0
  176. package/templates/storefront/src/modules/common/icons/menu.tsx +45 -0
  177. package/templates/storefront/src/modules/common/icons/nextjs.tsx +27 -0
  178. package/templates/storefront/src/modules/common/icons/package.tsx +44 -0
  179. package/templates/storefront/src/modules/common/icons/paypal.tsx +30 -0
  180. package/templates/storefront/src/modules/common/icons/phone.tsx +30 -0
  181. package/templates/storefront/src/modules/common/icons/placeholder-image.tsx +44 -0
  182. package/templates/storefront/src/modules/common/icons/refresh.tsx +51 -0
  183. package/templates/storefront/src/modules/common/icons/spinner.tsx +37 -0
  184. package/templates/storefront/src/modules/common/icons/trash.tsx +51 -0
  185. package/templates/storefront/src/modules/common/icons/user.tsx +37 -0
  186. package/templates/storefront/src/modules/common/icons/x.tsx +37 -0
  187. package/templates/storefront/src/modules/contact/templates/index.tsx +272 -0
  188. package/templates/storefront/src/modules/help/templates/index.tsx +629 -0
  189. package/templates/storefront/src/modules/home/components/dynamic-banner/index.tsx +190 -0
  190. package/templates/storefront/src/modules/home/components/featured-products/index.tsx +16 -0
  191. package/templates/storefront/src/modules/home/components/featured-products/product-rail/index.tsx +51 -0
  192. package/templates/storefront/src/modules/home/components/features/index.tsx +1 -0
  193. package/templates/storefront/src/modules/home/components/hero/index.tsx +1 -0
  194. package/templates/storefront/src/modules/home/components/loved-by-moms/index.tsx +1 -0
  195. package/templates/storefront/src/modules/home/components/new-arrivals/index.tsx +1 -0
  196. package/templates/storefront/src/modules/home/components/shop-by-age/index.tsx +1 -0
  197. package/templates/storefront/src/modules/home/components/shop-by-category/index.tsx +1 -0
  198. package/templates/storefront/src/modules/home/components/testimonials/index.tsx +1 -0
  199. package/templates/storefront/src/modules/home/components/why-choose-us/dynamic-features.tsx +93 -0
  200. package/templates/storefront/src/modules/home/components/why-choose-us/index.tsx +1 -0
  201. package/templates/storefront/src/modules/layout/components/account-dropdown/index.tsx +56 -0
  202. package/templates/storefront/src/modules/layout/components/cart-button/index.tsx +8 -0
  203. package/templates/storefront/src/modules/layout/components/cart-dropdown/index.tsx +424 -0
  204. package/templates/storefront/src/modules/layout/components/cart-mismatch-banner/index.tsx +57 -0
  205. package/templates/storefront/src/modules/layout/components/cookie-consent/index.tsx +116 -0
  206. package/templates/storefront/src/modules/layout/components/country-select/index.tsx +135 -0
  207. package/templates/storefront/src/modules/layout/components/desktop-search/index.tsx +148 -0
  208. package/templates/storefront/src/modules/layout/components/dynamic-logo/index.tsx +27 -0
  209. package/templates/storefront/src/modules/layout/components/footer-categories/index.tsx +34 -0
  210. package/templates/storefront/src/modules/layout/components/footer-contact/index.tsx +87 -0
  211. package/templates/storefront/src/modules/layout/components/footer-description/index.tsx +12 -0
  212. package/templates/storefront/src/modules/layout/components/footer-logo/index.tsx +22 -0
  213. package/templates/storefront/src/modules/layout/components/footer-newsletter/index.tsx +100 -0
  214. package/templates/storefront/src/modules/layout/components/language-select/index.tsx +192 -0
  215. package/templates/storefront/src/modules/layout/components/medusa-cta/index.tsx +21 -0
  216. package/templates/storefront/src/modules/layout/components/mobile-menu/index.tsx +296 -0
  217. package/templates/storefront/src/modules/layout/components/nav-links/index.tsx +66 -0
  218. package/templates/storefront/src/modules/layout/components/nav-wrapper/index.tsx +14 -0
  219. package/templates/storefront/src/modules/layout/components/promo-bar/index.tsx +7 -0
  220. package/templates/storefront/src/modules/layout/components/promo-bar/promo-bar-content.tsx +174 -0
  221. package/templates/storefront/src/modules/layout/components/push-notification-manager/index.tsx +191 -0
  222. package/templates/storefront/src/modules/layout/components/search-panel/index.tsx +136 -0
  223. package/templates/storefront/src/modules/layout/components/side-menu/index.tsx +144 -0
  224. package/templates/storefront/src/modules/layout/components/verification-banner/index.tsx +217 -0
  225. package/templates/storefront/src/modules/layout/components/wishlist-counter/index.tsx +17 -0
  226. package/templates/storefront/src/modules/layout/templates/footer/index.tsx +7 -0
  227. package/templates/storefront/src/modules/layout/templates/nav/index.tsx +14 -0
  228. package/templates/storefront/src/modules/order/components/cancel-order-modal/index.tsx +168 -0
  229. package/templates/storefront/src/modules/order/components/help/index.tsx +25 -0
  230. package/templates/storefront/src/modules/order/components/item/index.tsx +62 -0
  231. package/templates/storefront/src/modules/order/components/items/index.tsx +44 -0
  232. package/templates/storefront/src/modules/order/components/onboarding-cta/index.tsx +28 -0
  233. package/templates/storefront/src/modules/order/components/order-confirmation-back-handler/index.tsx +28 -0
  234. package/templates/storefront/src/modules/order/components/order-details/index.tsx +63 -0
  235. package/templates/storefront/src/modules/order/components/order-purchase-tracker/index.tsx +48 -0
  236. package/templates/storefront/src/modules/order/components/order-redesign/index.tsx +887 -0
  237. package/templates/storefront/src/modules/order/components/order-summary/index.tsx +60 -0
  238. package/templates/storefront/src/modules/order/components/payment-details/index.tsx +63 -0
  239. package/templates/storefront/src/modules/order/components/shipping-details/index.tsx +73 -0
  240. package/templates/storefront/src/modules/order/components/transfer-actions/index.tsx +81 -0
  241. package/templates/storefront/src/modules/order/components/transfer-image/index.tsx +275 -0
  242. package/templates/storefront/src/modules/order/templates/order-completed-template.tsx +233 -0
  243. package/templates/storefront/src/modules/order/templates/order-details-template.tsx +128 -0
  244. package/templates/storefront/src/modules/products/components/image-gallery/index.tsx +297 -0
  245. package/templates/storefront/src/modules/products/components/product-actions/index.tsx +1400 -0
  246. package/templates/storefront/src/modules/products/components/product-actions/mobile-actions.tsx +217 -0
  247. package/templates/storefront/src/modules/products/components/product-actions/option-select.tsx +62 -0
  248. package/templates/storefront/src/modules/products/components/product-onboarding-cta/index.tsx +30 -0
  249. package/templates/storefront/src/modules/products/components/product-preview/index.tsx +5 -0
  250. package/templates/storefront/src/modules/products/components/product-preview/price.tsx +29 -0
  251. package/templates/storefront/src/modules/products/components/product-price/index.tsx +58 -0
  252. package/templates/storefront/src/modules/products/components/product-rating/index.tsx +1 -0
  253. package/templates/storefront/src/modules/products/components/product-tabs/accordion.tsx +100 -0
  254. package/templates/storefront/src/modules/products/components/product-tabs/index.tsx +127 -0
  255. package/templates/storefront/src/modules/products/components/product-tabs/ratings-tab.tsx +598 -0
  256. package/templates/storefront/src/modules/products/components/product-view-tracker/index.tsx +53 -0
  257. package/templates/storefront/src/modules/products/components/related-products/index.tsx +152 -0
  258. package/templates/storefront/src/modules/products/components/review-modal/index.tsx +1 -0
  259. package/templates/storefront/src/modules/products/components/share-button/index.tsx +1 -0
  260. package/templates/storefront/src/modules/products/components/thumbnail/index.tsx +91 -0
  261. package/templates/storefront/src/modules/products/components/wishlist-icon/index.tsx +1 -0
  262. package/templates/storefront/src/modules/products/context/product-context.tsx +52 -0
  263. package/templates/storefront/src/modules/products/templates/index.tsx +26 -0
  264. package/templates/storefront/src/modules/products/templates/product-actions-wrapper/index.tsx +1 -0
  265. package/templates/storefront/src/modules/products/templates/product-info/index.tsx +2 -0
  266. package/templates/storefront/src/modules/shipping/components/free-shipping-price-nudge/index.tsx +283 -0
  267. package/templates/storefront/src/modules/skeletons/components/skeleton-button/index.tsx +5 -0
  268. package/templates/storefront/src/modules/skeletons/components/skeleton-card-details/index.tsx +10 -0
  269. package/templates/storefront/src/modules/skeletons/components/skeleton-cart-item/index.tsx +35 -0
  270. package/templates/storefront/src/modules/skeletons/components/skeleton-cart-totals/index.tsx +30 -0
  271. package/templates/storefront/src/modules/skeletons/components/skeleton-code-form/index.tsx +13 -0
  272. package/templates/storefront/src/modules/skeletons/components/skeleton-line-item/index.tsx +35 -0
  273. package/templates/storefront/src/modules/skeletons/components/skeleton-order-confirmed-header/index.tsx +14 -0
  274. package/templates/storefront/src/modules/skeletons/components/skeleton-order-information/index.tsx +36 -0
  275. package/templates/storefront/src/modules/skeletons/components/skeleton-order-items/index.tsx +43 -0
  276. package/templates/storefront/src/modules/skeletons/components/skeleton-order-summary/index.tsx +15 -0
  277. package/templates/storefront/src/modules/skeletons/components/skeleton-product-preview/index.tsx +15 -0
  278. package/templates/storefront/src/modules/skeletons/templates/skeleton-cart-page/index.tsx +65 -0
  279. package/templates/storefront/src/modules/skeletons/templates/skeleton-order-confirmed/index.tsx +21 -0
  280. package/templates/storefront/src/modules/skeletons/templates/skeleton-product-grid/index.tsx +23 -0
  281. package/templates/storefront/src/modules/skeletons/templates/skeleton-related-products/index.tsx +25 -0
  282. package/templates/storefront/src/modules/store/components/client-paginated-products.tsx +108 -0
  283. package/templates/storefront/src/modules/store/components/mobile-filters/index.tsx +135 -0
  284. package/templates/storefront/src/modules/store/components/pagination/index.tsx +118 -0
  285. package/templates/storefront/src/modules/store/components/product-list-view-tracker/index.tsx +43 -0
  286. package/templates/storefront/src/modules/store/components/refinement-list/index.tsx +299 -0
  287. package/templates/storefront/src/modules/store/components/refinement-list/sort-products/index.tsx +120 -0
  288. package/templates/storefront/src/modules/store/components/store-header/index.tsx +67 -0
  289. package/templates/storefront/src/modules/store/templates/index.tsx +1 -0
  290. package/templates/storefront/src/modules/store/templates/paginated-products.tsx +175 -0
  291. package/templates/storefront/src/modules/wishlist/components/wishlist-item/index.tsx +797 -0
  292. package/templates/storefront/src/modules/wishlist/templates/index.tsx +176 -0
  293. package/templates/storefront/src/storefront.config.ts +12 -0
  294. package/templates/storefront/src/styles/globals.css +326 -0
  295. package/templates/storefront/src/theme/valero/blocks/home/Features/index.tsx +61 -0
  296. package/templates/storefront/src/theme/valero/blocks/home/Hero/index.tsx +102 -0
  297. package/templates/storefront/src/theme/valero/blocks/home/LovedByMoms/index.tsx +407 -0
  298. package/templates/storefront/src/theme/valero/blocks/home/NewArrivals/index.tsx +48 -0
  299. package/templates/storefront/src/theme/valero/blocks/home/ShopByAge/index.tsx +128 -0
  300. package/templates/storefront/src/theme/valero/blocks/home/ShopByCategory/index.tsx +409 -0
  301. package/templates/storefront/src/theme/valero/blocks/home/Testimonials/index.tsx +697 -0
  302. package/templates/storefront/src/theme/valero/blocks/home/WhyChooseUs/index.tsx +62 -0
  303. package/templates/storefront/src/theme/valero/layouts/MainLayoutShell.tsx +14 -0
  304. package/templates/storefront/src/theme/valero/primitives/Button.tsx +28 -0
  305. package/templates/storefront/src/theme/valero/primitives/Card.tsx +32 -0
  306. package/templates/storefront/src/theme/valero/primitives/index.ts +2 -0
  307. package/templates/storefront/src/theme/valero/slots/account/ForgotPassword/index.tsx +1 -0
  308. package/templates/storefront/src/theme/valero/slots/account/Login/index.tsx +1 -0
  309. package/templates/storefront/src/theme/valero/slots/account/LoginTemplate/index.tsx +44 -0
  310. package/templates/storefront/src/theme/valero/slots/account/Register/index.tsx +1 -0
  311. package/templates/storefront/src/theme/valero/slots/cart/CartItem/index.tsx +11 -0
  312. package/templates/storefront/src/theme/valero/slots/cart/CartSummary/index.tsx +13 -0
  313. package/templates/storefront/src/theme/valero/slots/checkout/CheckoutForm/index.tsx +1 -0
  314. package/templates/storefront/src/theme/valero/slots/checkout/CheckoutSummary/index.tsx +1 -0
  315. package/templates/storefront/src/theme/valero/slots/layout/Footer/index.tsx +104 -0
  316. package/templates/storefront/src/theme/valero/slots/layout/Nav/index.tsx +97 -0
  317. package/templates/storefront/src/theme/valero/slots/layout/PromoBar/index.tsx +19 -0
  318. package/templates/storefront/src/theme/valero/slots/layout/PromoBar/promo-bar-content.tsx +174 -0
  319. package/templates/storefront/src/theme/valero/slots/order/OrderDetails/index.tsx +12 -0
  320. package/templates/storefront/src/theme/valero/slots/product/ProductActions/ProductCTASection.tsx +191 -0
  321. package/templates/storefront/src/theme/valero/slots/product/ProductActions/ProductDetailsSection.tsx +137 -0
  322. package/templates/storefront/src/theme/valero/slots/product/ProductActions/ProductFeaturePanel.tsx +245 -0
  323. package/templates/storefront/src/theme/valero/slots/product/ProductActions/ProductHighlightsSection.tsx +98 -0
  324. package/templates/storefront/src/theme/valero/slots/product/ProductActions/ProductOptionsSection.tsx +233 -0
  325. package/templates/storefront/src/theme/valero/slots/product/ProductActions/ProductPriceSection.tsx +53 -0
  326. package/templates/storefront/src/theme/valero/slots/product/ProductActions/ProductTrustSection.tsx +84 -0
  327. package/templates/storefront/src/theme/valero/slots/product/ProductActions/index.tsx +161 -0
  328. package/templates/storefront/src/theme/valero/slots/product/ProductCard/index.tsx +132 -0
  329. package/templates/storefront/src/theme/valero/slots/product/ProductInfo/index.tsx +40 -0
  330. package/templates/storefront/src/theme/valero/templates/StorePage/index.tsx +154 -0
  331. package/templates/storefront/src/theme/valero/tokens/colors.js +16 -0
  332. package/templates/storefront/src/theme/valero/tokens/colors.ts +21 -0
  333. package/templates/storefront/src/theme/valero/tokens/fonts.ts +13 -0
  334. package/templates/storefront/src/theme/valero/tokens/index.ts +3 -0
  335. package/templates/storefront/src/theme/valero/tokens/spacing.ts +9 -0
  336. package/templates/storefront/src/theme/valero/tokens/theme.css +91 -0
  337. package/templates/storefront/tailwind.config.js +221 -0
  338. package/templates/storefront/tsconfig.json +30 -0
@@ -0,0 +1,300 @@
1
+ "use client"
2
+
3
+ import { useActionState, useEffect, useState } from "react"
4
+ import { HttpTypes } from "@medusajs/types"
5
+ import { createReturnRequest } from "@core/data/returns"
6
+ import { listPaymentDetails, createPaymentDetail, makeDefaultPaymentDetail } from "@core/data/payment-details"
7
+ import { enhanceItemsWithReturnStatus } from "@core/util/returns"
8
+ import ReturnItemSelector from "../components/return-item-selector"
9
+ import ReturnShippingSelector from "../components/return-shipping-selector"
10
+ import { Button, Heading, Text, Label, Input } from "@medusajs/ui"
11
+ import LocalizedClientLink from "@modules/common/components/localized-client-link"
12
+
13
+ type ReturnRequestTemplateProps = {
14
+ order: HttpTypes.StoreOrder & { cart_id?: string }
15
+ shippingOptions: HttpTypes.StoreShippingOption[]
16
+ returnReasons: HttpTypes.StoreReturnReason[]
17
+ }
18
+
19
+ const initialState = {
20
+ success: false,
21
+ error: null,
22
+ return: null,
23
+ }
24
+
25
+ const ReturnRequestTemplate = ({
26
+ order,
27
+ shippingOptions,
28
+ returnReasons,
29
+ }: ReturnRequestTemplateProps) => {
30
+ // 1. ABSOLUTE GUEST DETECTION
31
+ const isGuest = !order.customer_id || order.customer_id === ""
32
+
33
+ const [items, setItems] = useState(enhanceItemsWithReturnStatus(order.items || []))
34
+ const [selectedItems, setSelectedItems] = useState<Array<{
35
+ id: string
36
+ quantity: number
37
+ return_reason_id?: string
38
+ }>>([])
39
+ const [selectedShippingOption, setSelectedShippingOption] = useState<string | null>(null)
40
+
41
+ const [paymentMethods, setPaymentMethods] = useState<any[]>([])
42
+ const [isLoadingPayments, setIsLoadingPayments] = useState(!isGuest)
43
+ const [selectedPaymentId, setSelectedPaymentId] = useState<string | null>(null)
44
+
45
+ const [state, formAction] = useActionState(createReturnRequest, initialState)
46
+ const [isLinkingPayment, setIsLinkingPayment] = useState(false)
47
+ const [paymentLinked, setPaymentLinked] = useState(false)
48
+ const [showRefundPopup, setShowRefundPopup] = useState(false)
49
+
50
+ // DIRECT SUBMIT FOR EVERYONE
51
+ const handleFormSubmit = async (formData: FormData) => {
52
+ formData.append("order_id", order.id)
53
+ formData.append("items", JSON.stringify(selectedItems))
54
+ if (selectedShippingOption) formData.append("return_shipping_option_id", selectedShippingOption)
55
+ const locId = formData.get("location_id") || (order as any).fulfillments?.[0]?.location_id
56
+ if (locId) formData.set("location_id", locId.toString())
57
+
58
+ formAction(formData)
59
+ }
60
+
61
+ const handleLinkPayment = async (paymentId: string) => {
62
+ if (!state.return?.id) return
63
+ setIsLinkingPayment(true)
64
+ setSelectedPaymentId(paymentId)
65
+ try {
66
+ const { updateReturnPayment } = await import("@core/data/returns")
67
+ const res = await updateReturnPayment(state.return.id, paymentId)
68
+ if (res.success) {
69
+ setPaymentLinked(true)
70
+ setTimeout(() => setShowRefundPopup(false), 1500)
71
+ }
72
+ } catch (e) {
73
+ console.error("Link fail", e)
74
+ } finally {
75
+ setIsLinkingPayment(false)
76
+ }
77
+ }
78
+
79
+ // ONLY FETCH PAYMENTS AFTER SUCCESSFUL RETURN (For Registered Users)
80
+ useEffect(() => {
81
+ if (state.success && state.return) {
82
+ // Scroll to top when success happens
83
+ window.scrollTo({ top: 0, behavior: 'smooth' })
84
+
85
+ if (!isGuest && !paymentLinked) {
86
+ // First fetch the methods
87
+ listPaymentDetails().then(methods => {
88
+ setPaymentMethods(methods)
89
+ const defaultMethod = methods.find((p: any) => p.is_default) || methods[0]
90
+ if (defaultMethod) setSelectedPaymentId(defaultMethod.id)
91
+
92
+ // Then show the popup
93
+ const timer = setTimeout(() => setShowRefundPopup(true), 800)
94
+ return () => clearTimeout(timer)
95
+ }).catch(() => {
96
+ // If payment fetch fails, still show the finish screen
97
+ console.error("Could not load payment methods")
98
+ })
99
+ }
100
+ }
101
+ }, [state.success, state.return, isGuest, paymentLinked])
102
+
103
+ // SCROLL TO TOP ON INITIAL MOUNT
104
+ useEffect(() => {
105
+ window.scrollTo({ top: 0, behavior: 'instant' as ScrollBehavior })
106
+ }, [])
107
+
108
+ const backToOrdersLink = isGuest ? `/orders/${order.id}` : "/account/orders"
109
+
110
+ if (state.success && state.return) {
111
+ return (
112
+ <div className="relative">
113
+ <div className="max-w-md mx-auto pt-16 sm:pt-20 pb-6 sm:pb-8 px-4 animate-in fade-in slide-in-from-bottom-4 duration-500">
114
+ <div className="bg-white border border-gray-200 rounded-2xl shadow-sm p-5 sm:p-6 space-y-4">
115
+ <div className="flex flex-col items-center text-center space-y-2">
116
+ <div className="w-14 h-14 bg-green-50 rounded-full flex items-center justify-center shadow-sm border border-green-200">
117
+ <svg className="w-7 h-7 text-green-600" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth="2.5" aria-hidden="true">
118
+ <path strokeLinecap="round" strokeLinejoin="round" d="M5 13l4 4L19 7" />
119
+ </svg>
120
+ </div>
121
+ <Heading level="h1" className="text-2xl sm:text-3xl font-extrabold text-[#0D1B3E] tracking-tight">Return Requested!</Heading>
122
+ <Text className="text-gray-500 text-sm sm:text-base max-w-sm leading-snug">
123
+ Your return for order <span className="text-[#0D1B3E] font-bold">#{order.display_id}</span> has been submitted and is under review.
124
+ </Text>
125
+ </div>
126
+
127
+ <div className="space-y-3">
128
+ {!isGuest && !paymentLinked && !showRefundPopup && (
129
+ <Button
130
+ variant="secondary"
131
+ onClick={() => setShowRefundPopup(true)}
132
+ className="w-full rounded-xl h-11 font-bold text-brand-accent border border-brand-accent/30 bg-white hover:bg-brand-accent-muted transition-all text-sm"
133
+ >
134
+ Link Refund Bank Account
135
+ </Button>
136
+ )}
137
+
138
+ {paymentLinked && (
139
+ <div className="bg-green-50/50 rounded-xl px-3 py-2.5 flex items-center gap-2.5 border border-green-200 animate-in zoom-in-95">
140
+ <div className="w-7 h-7 bg-green-500 rounded-lg flex items-center justify-center text-inverse shrink-0">
141
+ <svg className="w-3.5 h-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth="3"><path d="M5 13l4 4L19 7" /></svg>
142
+ </div>
143
+ <div className="text-left min-w-0">
144
+ <p className="text-green-900 font-bold text-sm leading-tight">Refund Method Linked</p>
145
+ <p className="text-green-700/70 text-xs leading-snug">Funds will be credited to your selected account.</p>
146
+ </div>
147
+ </div>
148
+ )}
149
+
150
+ <div className="bg-gray-50/50 rounded-xl px-4 py-3 flex flex-col items-center gap-1 border border-gray-200">
151
+ <span className="text-[10px] font-bold text-gray-400 uppercase tracking-[0.15em]">Request ID</span>
152
+ <span className="text-xs font-mono font-bold text-[#0D1B3E] break-all text-center select-all">{state.return.id}</span>
153
+ </div>
154
+
155
+ <LocalizedClientLink href={backToOrdersLink} className="block">
156
+ <Button className="w-full rounded-xl bg-[#0D1B3E] hover:bg-black text-inverse h-11 font-bold text-sm shadow-md shadow-gray-200/80 transition-all active:scale-95">
157
+ Go to My Orders
158
+ </Button>
159
+ </LocalizedClientLink>
160
+ </div>
161
+ </div>
162
+ </div>
163
+
164
+ {/* REFUND POPUP FOR LOGIN USERS ONLY */}
165
+ {showRefundPopup && (
166
+ <div className="fixed inset-0 z-[100] flex items-center justify-center p-4">
167
+ <div className="absolute inset-0 bg-gray-900/60 backdrop-blur-xl animate-in fade-in" onClick={() => setShowRefundPopup(false)} />
168
+ <div className="relative w-full max-w-lg bg-page-bg rounded-[32px] sm:rounded-[40px] shadow-2xl p-6 sm:p-10 animate-in zoom-in-95 duration-300">
169
+ <button onClick={() => setShowRefundPopup(false)} className="absolute top-5 right-5 sm:top-8 sm:right-8 text-gray-400 hover:text-heading"><svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5"><path d="M18 6L6 18M6 6l12 12" /></svg></button>
170
+
171
+ <div className="text-center mb-6 sm:mb-8">
172
+ <Heading level="h2" className="text-2xl sm:text-3xl font-black text-[#0D1B3E] tracking-tight">Refund Destination</Heading>
173
+ <p className="text-gray-500 text-sm font-medium mt-2">Where should we send your money?</p>
174
+ </div>
175
+
176
+ <div className="space-y-3 sm:space-y-4 max-h-[40vh] overflow-y-auto px-1 custom-scrollbar mb-6 sm:mb-8">
177
+ {paymentMethods.map(pm => (
178
+ <div key={pm.id} onClick={() => setSelectedPaymentId(pm.id)} className={`p-4 sm:p-6 rounded-2xl sm:rounded-3xl border-2 cursor-pointer transition-all ${selectedPaymentId === pm.id ? 'border-brand-accent bg-brand-accent-muted/50' : 'border-gray-50 bg-gray-50/50'}`}>
179
+ <div className="flex items-center justify-between">
180
+ <div className="flex flex-col">
181
+ <span className="font-bold text-[#0D1B3E] text-sm sm:text-base">{pm.type.toUpperCase()}: {pm.type === "upi" ? pm.detail_json?.upi_id : pm.detail_json?.bank_name}</span>
182
+ </div>
183
+ <div className={`w-6 h-6 sm:w-7 sm:h-7 rounded-full border-2 flex items-center justify-center shrink-0 ml-3 ${selectedPaymentId === pm.id ? 'border-brand-accent bg-brand-accent' : 'border-gray-200'}`}>
184
+ {selectedPaymentId === pm.id && <svg className="w-3 h-3 sm:w-4 sm:h-4 text-inverse" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth="4"><path d="M5 13l4 4L19 7" /></svg>}
185
+ </div>
186
+ </div>
187
+ </div>
188
+ ))}
189
+ </div>
190
+
191
+ <div className="flex flex-col gap-3 sm:gap-4">
192
+ <Button
193
+ onClick={() => selectedPaymentId && handleLinkPayment(selectedPaymentId)}
194
+ disabled={!selectedPaymentId || isLinkingPayment || paymentLinked}
195
+ className={`w-full h-14 sm:h-16 rounded-2xl font-black text-base sm:text-lg transition-all ${paymentLinked ? 'bg-green-500' : 'bg-[#0D1B3E] hover:bg-black'} text-inverse`}
196
+ >
197
+ {isLinkingPayment ? "Linking..." : paymentLinked ? "Linked Successfully!" : "Confirm & Link Account"}
198
+ </Button>
199
+ <button onClick={() => setShowRefundPopup(false)} className="text-gray-400 font-black uppercase text-[10px] tracking-widest hover:text-brand-accent">Skip for now</button>
200
+ </div>
201
+ </div>
202
+ </div>
203
+ )}
204
+ </div>
205
+ )
206
+ }
207
+
208
+ return (
209
+ <div className="max-w-4xl mx-auto py-8 sm:py-12 px-4 sm:px-6">
210
+ <div className="mb-8 sm:mb-12">
211
+ <LocalizedClientLink href={`/orders/${order.id}`} className="text-[10px] sm:text-xs text-gray-400 hover:text-brand-accent mb-6 inline-flex gap-2 items-center font-bold tracking-[0.2em] transition-colors">
212
+ <svg width="14" height="14" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth="2.5"><path d="M15 19l-7-7 7-7" /></svg>
213
+ BACK TO ORDER #{order.display_id}
214
+ </LocalizedClientLink>
215
+ <Heading level="h1" className="text-3xl sm:text-4xl md:text-5xl font-extrabold tracking-tight text-[#0D1B3E]">Return Request</Heading>
216
+ <p className="text-gray-400 font-medium text-sm sm:text-base mt-2">Follow the steps below to return items from your order.</p>
217
+ </div>
218
+
219
+ <form action={handleFormSubmit} className="space-y-6 sm:space-y-10 pb-12">
220
+ {state.error && (
221
+ <div className="p-4 bg-red-50 text-red-700 rounded-2xl text-xs sm:text-sm font-bold border border-red-100 flex items-center gap-3 animate-in shake duration-500">
222
+ <svg className="w-5 h-5 shrink-0" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth="2.5"><path strokeLinecap="round" strokeLinejoin="round" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" /></svg>
223
+ {state.error}
224
+ </div>
225
+ )}
226
+
227
+ {/* STEP 1: SELECT ITEMS */}
228
+ <div className="space-y-4">
229
+ <div className="flex items-center gap-3 px-2">
230
+ <div className="w-6 h-6 rounded-lg bg-brand-accent text-inverse flex items-center justify-center font-bold text-[10px]">1</div>
231
+ <h2 className="text-sm font-bold text-[#0D1B3E] uppercase tracking-wider">Select items to return</h2>
232
+ </div>
233
+ <div className="bg-white rounded-[2.5rem] border border-gray-100 shadow-sm p-4 sm:p-8">
234
+ <ReturnItemSelector items={items} returnReasons={returnReasons} selectedItems={selectedItems} onItemSelectionChange={setSelectedItems} currencyCode={order.currency_code} />
235
+ </div>
236
+ </div>
237
+
238
+ {/* STEP 2: SHIPPING METHOD (only if admin has return shipping options) */}
239
+ {selectedItems.length > 0 && shippingOptions.length > 0 && (
240
+ <div className="space-y-4 animate-in fade-in slide-in-from-bottom-4 duration-500">
241
+ <div className="flex items-center gap-3 px-2">
242
+ <div className="w-6 h-6 rounded-lg bg-brand-accent text-inverse flex items-center justify-center font-bold text-[10px]">2</div>
243
+ <h2 className="text-sm font-bold text-[#0D1B3E] uppercase tracking-wider">Return Shipping</h2>
244
+ </div>
245
+ <div className="bg-white rounded-[2.5rem] border border-gray-100 shadow-sm p-4 sm:p-8">
246
+ <ReturnShippingSelector shippingOptions={shippingOptions} selectedOption={selectedShippingOption} onOptionSelect={setSelectedShippingOption} cartId={order.cart_id || ""} currencyCode={order.currency_code} />
247
+ </div>
248
+ <input type="hidden" name="location_id" value={(order as any).fulfillments?.[0]?.location_id || "default_location"} />
249
+ </div>
250
+ )}
251
+ {/* CONDITIONAL ADDITIONAL DETAILS SECTION */}
252
+ {selectedItems.length > 0 && (shippingOptions.length === 0 || selectedShippingOption) && (
253
+ <div className="space-y-4 animate-in fade-in slide-in-from-bottom-4 duration-500">
254
+ <div className="flex items-center gap-3 px-2">
255
+ <div className="w-6 h-6 rounded-lg bg-brand-accent text-inverse flex items-center justify-center font-bold text-[10px]">
256
+ {shippingOptions.length > 0 ? "3" : "2"}
257
+ </div>
258
+ <h2 className="text-sm font-bold text-[#0D1B3E] uppercase tracking-wider">Additional Details (Optional)</h2>
259
+ </div>
260
+ <div className="bg-white rounded-[2.5rem] border border-gray-100 shadow-sm p-4 sm:p-8">
261
+ <textarea
262
+ name="note"
263
+ placeholder="Tell us more about the reason for your return..."
264
+ className="w-full min-h-[120px] rounded-2xl border-gray-100 bg-gray-50/50 p-4 text-sm font-medium text-gray-700 outline-none focus:border-brand-accent/30 focus:ring-0 transition-all placeholder:text-gray-300 resize-none font-sans"
265
+ />
266
+ </div>
267
+ </div>
268
+ )}
269
+
270
+ <div className="flex flex-col sm:flex-row items-center justify-end gap-3 pt-8 border-t border-gray-100 mt-8">
271
+ <LocalizedClientLink href={`/orders/${order.id}`} className="w-full sm:w-auto">
272
+ <Button variant="secondary" type="button" className="w-full h-11 rounded-3xl px-10 font-bold text-gray-400 border-none hover:bg-gray-50 transition-all uppercase tracking-widest text-[10px]">
273
+ Cancel
274
+ </Button>
275
+ </LocalizedClientLink>
276
+
277
+ <Button
278
+ type="submit"
279
+ disabled={
280
+ selectedItems.length === 0 ||
281
+ selectedItems.some(i => !i.return_reason_id) ||
282
+ (shippingOptions.length > 0 && !selectedShippingOption)
283
+ }
284
+ className="w-full sm:w-auto h-11 rounded-3xl bg-[#0D1B3E] hover:bg-black text-inverse px-12 font-black text-xs uppercase tracking-widest shadow-lg shadow-gray-200 transition-all active:scale-95 disabled:opacity-20"
285
+ >
286
+ {selectedItems.length === 0
287
+ ? "Select items"
288
+ : selectedItems.some(i => !i.return_reason_id)
289
+ ? "Select reasons"
290
+ : shippingOptions.length > 0 && !selectedShippingOption
291
+ ? "Choose shipping"
292
+ : "Confirm Return Request"}
293
+ </Button>
294
+ </div>
295
+ </form>
296
+ </div>
297
+ )
298
+ }
299
+
300
+ export default ReturnRequestTemplate
@@ -0,0 +1,21 @@
1
+ "use client"
2
+
3
+ export default function ScrollToPendingOrdersButton() {
4
+ const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {
5
+ e.preventDefault()
6
+ const element = document.getElementById("abandoned-carts-section")
7
+ if (element) {
8
+ element.scrollIntoView({ behavior: "smooth", block: "start" })
9
+ }
10
+ }
11
+
12
+ return (
13
+ <button
14
+ onClick={handleClick}
15
+ className="w-full min-[600px]:w-auto px-6 py-2.5 min-[600px]:px-4 min-[600px]:py-1.5 whitespace-nowrap bg-[#8B5AB1] hover:bg-[#7a4f9b] text-white text-[11px] sm:text-xs font-bold rounded-full shadow-sm transition-all duration-200 cursor-pointer active:scale-[0.98] flex items-center justify-center gap-2"
16
+ >
17
+ Complete Your Orders ✅
18
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="3" strokeLinecap="round" strokeLinejoin="round"><path d="M7 13l5 5 5-5M7 6l5 5 5-5" /></svg>
19
+ </button>
20
+ )
21
+ }
@@ -0,0 +1,335 @@
1
+ "use client"
2
+
3
+ import { HttpTypes } from "@medusajs/types"
4
+ import { Button, Heading, Text } from "@medusajs/ui"
5
+ import Link from "next/link"
6
+ import { ShoppingBag, ArrowRight, Zap, RefreshCw, Loader2 } from "lucide-react"
7
+ import { Trash } from "@medusajs/icons"
8
+ import { useState, useTransition, useEffect } from "react"
9
+ import { resumeAbandonedCart, deleteCart } from "@core/data/cart"
10
+ import Modal from "@modules/common/components/modal"
11
+
12
+ type AbandonedCartsProps = {
13
+ abandonedCarts?: {
14
+ buyNowCarts: HttpTypes.StoreCart[]
15
+ reorderCarts: HttpTypes.StoreCart[]
16
+ }
17
+ countryCode: string
18
+ }
19
+
20
+ export default function AbandonedCarts({ abandonedCarts, countryCode }: AbandonedCartsProps) {
21
+ const [dismissed, setDismissed] = useState<Record<string, boolean>>({})
22
+ const [isPending, startTransition] = useTransition()
23
+ const [resumingId, setResumingId] = useState<string | null>(null)
24
+ const [deletingId, setDeletingId] = useState<string | null>(null)
25
+ const [isDeleting, setIsDeleting] = useState(false)
26
+ const [expandedCarts, setExpandedCarts] = useState<Record<string, boolean>>({})
27
+ const [activeTab, setActiveTab] = useState<"buy_now" | "reorder">("buy_now")
28
+
29
+ const buyNowCarts = abandonedCarts?.buyNowCarts ?? []
30
+ const reorderCarts = abandonedCarts?.reorderCarts ?? []
31
+
32
+ const activeBuyNowCarts = buyNowCarts.filter(cart => !dismissed[cart.id])
33
+ const activeReorderCarts = reorderCarts.filter(cart => !dismissed[cart.id])
34
+
35
+ useEffect(() => {
36
+ if (activeBuyNowCarts.length === 0 && activeReorderCarts.length > 0 && activeTab === "buy_now") {
37
+ setActiveTab("reorder")
38
+ } else if (activeReorderCarts.length === 0 && activeBuyNowCarts.length > 0 && activeTab === "reorder") {
39
+ setActiveTab("buy_now")
40
+ }
41
+ }, [activeBuyNowCarts.length, activeReorderCarts.length, activeTab])
42
+
43
+ if (!abandonedCarts) return null
44
+
45
+ if (activeBuyNowCarts.length === 0 && activeReorderCarts.length === 0) return null
46
+
47
+ const handleDelete = async () => {
48
+ if (!deletingId) return
49
+
50
+ setIsDeleting(true)
51
+ const result = await deleteCart(deletingId)
52
+
53
+ if (result.success) {
54
+ setDismissed(prev => ({ ...prev, [deletingId]: true }))
55
+ setDeletingId(null)
56
+ }
57
+ setIsDeleting(false)
58
+ }
59
+
60
+ const handleResume = (cartId: string) => {
61
+ setResumingId(cartId)
62
+ startTransition(() => {
63
+ resumeAbandonedCart(cartId, countryCode)
64
+ })
65
+ }
66
+
67
+ const renderCartCard = (cart: HttpTypes.StoreCart, type: "buy_now" | "reorder") => {
68
+ const itemCount = cart.items?.reduce((acc, item) => acc + item.quantity, 0) || 0
69
+ const items = cart.items || []
70
+ const total = items.reduce((acc, item) => acc + (item.total || 0), 0).toFixed(2)
71
+
72
+ const isBuyNow = type === "buy_now"
73
+ const isResuming = isPending && resumingId === cart.id
74
+
75
+ return (
76
+ <div key={cart.id} className="relative group bg-white border border-purple-100/80 rounded-xl p-3 md:p-4 shadow-sm hover:shadow-md hover:border-purple-200 transition-all duration-300">
77
+ <button
78
+ onClick={(e) => {
79
+ e.preventDefault()
80
+ e.stopPropagation()
81
+ setDeletingId(cart.id)
82
+ }}
83
+ className="absolute top-1.5 right-1.5 text-gray-400 hover:text-gray-900 bg-transparent hover:bg-purple-50/60 rounded-full p-2 transition-colors z-20 cursor-pointer"
84
+ title="Delete this cart"
85
+ disabled={isResuming || (isDeleting && deletingId === cart.id)}
86
+ >
87
+ {isDeleting && deletingId === cart.id ? (
88
+ <Loader2 className="w-4 h-4 animate-spin" />
89
+ ) : (
90
+ <Trash className="w-4 h-4 pointer-events-none" />
91
+ )}
92
+ </button>
93
+
94
+ <div className="flex flex-col gap-2 relative z-10">
95
+ {/* Badge */}
96
+ <div className="flex items-center gap-2">
97
+ <span className="text-[10px] font-bold uppercase tracking-wider text-[#8B5AB1] bg-[#8B5AB1]/10 px-2 py-0.5 rounded-md">
98
+ {isBuyNow ? "Buy Now Order" : "Reorder Order"}
99
+ </span>
100
+ </div>
101
+
102
+ {/* Items List */}
103
+ <div className="flex flex-col gap-2">
104
+ {(expandedCarts[cart.id] ? items : items.slice(0, 1)).map((item, index) => (
105
+ <div key={item.id} className={`flex items-center gap-3 ${index > 0 ? 'pt-2 border-t border-gray-100' : ''}`}>
106
+ <div className="w-16 h-16 rounded-lg bg-purple-50/60 flex items-center justify-center flex-shrink-0 overflow-hidden border border-purple-100/60">
107
+ {item.thumbnail ? (
108
+ <img src={item.thumbnail} alt={item.title} className="w-full h-full object-cover" />
109
+ ) : (
110
+ <ShoppingBag className="w-4 h-4 text-purple-200" />
111
+ )}
112
+ </div>
113
+ <div className="flex-1 min-w-0">
114
+ <h3 className="font-semibold text-gray-900 text-xs md:text-sm line-clamp-1">{item.title}</h3>
115
+ <p className="text-gray-500 text-[11px] mt-0.5 font-medium">
116
+ Qty: {item.quantity} &nbsp;•&nbsp; <span className="text-gray-900 font-semibold">₹{item.total?.toFixed(2) || '0.00'}</span>
117
+ </p>
118
+ </div>
119
+ </div>
120
+ ))}
121
+
122
+ {items.length > 1 && (
123
+ <div className="flex items-center gap-2.5 mt-1">
124
+ <button
125
+ onClick={(e) => {
126
+ e.preventDefault()
127
+ setExpandedCarts(prev => ({ ...prev, [cart.id]: !prev[cart.id] }))
128
+ }}
129
+ className="text-[10px] font-bold text-[#8B5AB1] hover:text-[#7a4f9b] transition-colors flex items-center gap-1.5 w-fit uppercase tracking-tight whitespace-nowrap"
130
+ >
131
+ {expandedCarts[cart.id] ? "Show Less" : `+ View ${items.length - 1} more`}
132
+ </button>
133
+
134
+ {!expandedCarts[cart.id] && (
135
+ <div className="flex -space-x-1.5">
136
+ {items.slice(1, 4).map((item, idx) => {
137
+ const bgColors = ['bg-[#0D9488]', 'bg-[#1E293B]', 'bg-[#0891B2]']
138
+ return (
139
+ <div
140
+ key={item.id}
141
+ className={`w-5 h-5 rounded-full border border-white flex items-center justify-center overflow-hidden shadow-sm ${bgColors[idx % 3]}`}
142
+ title={item.title}
143
+ >
144
+ {item.thumbnail ? (
145
+ <img src={item.thumbnail} alt={item.title} className="w-full h-full object-cover" />
146
+ ) : (
147
+ <span className="text-[7px] font-bold text-white">
148
+ {item.title?.split(' ').map(n => n[0]).join('').slice(0, 2).toUpperCase()}
149
+ </span>
150
+ )}
151
+ </div>
152
+ )
153
+ })}
154
+ {items.length > 4 && (
155
+ <div className="w-5 h-5 rounded-full border border-white bg-purple-100 flex items-center justify-center text-[7px] font-bold text-[#8B5AB1] shadow-sm">
156
+ +{items.length - 4}
157
+ </div>
158
+ )}
159
+ </div>
160
+ )}
161
+ </div>
162
+ )}
163
+ </div>
164
+
165
+ {/* Footer: Total + Resume Button */}
166
+ <div className="flex flex-col sm:flex-row sm:items-center justify-between gap-2 pt-2 border-t border-purple-100/40">
167
+ <p className="text-gray-600 text-xs font-medium">
168
+ {itemCount} {itemCount === 1 ? 'item' : 'items'} &nbsp;•&nbsp; Total: <span className="text-gray-900 font-bold text-sm">₹{total}</span>
169
+ </p>
170
+ <Button
171
+ variant="primary"
172
+ onClick={() => handleResume(cart.id)}
173
+ disabled={isResuming || isDeleting}
174
+ className="w-full sm:w-auto rounded-xl bg-[#8B5AB1] hover:bg-[#7a4f9b] text-white shadow-[#8B5AB1]/20 hover:shadow-[#8B5AB1]/30 transition-all font-semibold flex items-center justify-center gap-2 h-9 px-4 text-sm group/btn"
175
+ >
176
+ {isResuming ? (
177
+ <>
178
+ <Loader2 className="w-4 h-4 animate-spin" />
179
+ Processing...
180
+ </>
181
+ ) : (
182
+ <>
183
+ {isBuyNow ? "Continue Checkout" : "Continue Reorder"}
184
+ <ArrowRight className="w-4 h-4 group-hover/btn:translate-x-1 transition-transform" />
185
+ </>
186
+ )}
187
+ </Button>
188
+ </div>
189
+ </div>
190
+ </div>
191
+ )
192
+ }
193
+
194
+ const buyNowTotalItems = activeBuyNowCarts.reduce((acc, cart) => acc + (cart.items?.reduce((a, i) => a + i.quantity, 0) || 0), 0)
195
+ const reorderTotalItems = activeReorderCarts.reduce((acc, cart) => acc + (cart.items?.reduce((a, i) => a + i.quantity, 0) || 0), 0)
196
+
197
+ return (
198
+ <>
199
+ <div id="abandoned-carts-section" className="w-full flex flex-col gap-3 animate-in fade-in duration-500 scroll-mt-24 min-[1024px]:scroll-mt-32">
200
+
201
+ {/* Tabs Navigation */}
202
+ {(activeBuyNowCarts.length > 0 && activeReorderCarts.length > 0) && (
203
+ <div className="flex items-center gap-1 bg-purple-50/50 p-1 rounded-2xl border border-purple-100/60 w-fit mx-auto">
204
+ <button
205
+ onClick={() => setActiveTab("buy_now")}
206
+ className={`px-6 py-2.5 rounded-xl text-sm font-bold transition-all ${activeTab === "buy_now" ? "bg-white text-[#8B5AB1] shadow-md shadow-purple-200/50" : "text-gray-500 hover:text-gray-900"}`}
207
+ >
208
+ Buy Now ({activeBuyNowCarts.length})
209
+ </button>
210
+ <button
211
+ onClick={() => setActiveTab("reorder")}
212
+ className={`px-6 py-2.5 rounded-xl text-sm font-bold transition-all ${activeTab === "reorder" ? "bg-white text-[#8B5AB1] shadow-md shadow-purple-200/50" : "text-gray-500 hover:text-gray-900"}`}
213
+ >
214
+ Reorder ({activeReorderCarts.length})
215
+ </button>
216
+ </div>
217
+ )}
218
+
219
+ {/* BUY NOW SECTION */}
220
+ {activeTab === "buy_now" && activeBuyNowCarts.length > 0 && (
221
+ <div className="bg-white rounded-2xl border border-purple-100/80 shadow-sm overflow-hidden relative">
222
+ <div className="absolute top-0 right-0 w-64 h-64 bg-gradient-to-br from-purple-50/50 to-purple-100/20 rounded-bl-[100px] -z-10 pointer-events-none" />
223
+
224
+ <div className="p-3 md:p-4 border-b border-purple-100/60 flex items-start justify-between gap-3 md:gap-4">
225
+ <div className="flex items-start gap-2.5">
226
+ <div className="bg-[#8B5AB1]/10 p-1.5 rounded-lg shadow-sm border border-purple-100/50 flex-shrink-0">
227
+ <Zap className="w-4 h-4 text-[#8B5AB1] fill-purple-100" />
228
+ </div>
229
+ <div>
230
+ <h2 className="text-base font-bold text-gray-900 tracking-tight leading-tight">Pending Buy Now Order</h2>
231
+ <p className="text-xs text-gray-500 mt-0.5 leading-relaxed">
232
+ Your Buy Now items are pending. Proceed to checkout to complete your order.
233
+ </p>
234
+ </div>
235
+ </div>
236
+ <div className="hidden sm:flex items-center mt-0.5">
237
+ <span className="text-[#8B5AB1] font-bold bg-[#8B5AB1]/10 px-2.5 py-1 rounded-full text-[11px] whitespace-nowrap border border-purple-100">
238
+ {buyNowTotalItems} {buyNowTotalItems === 1 ? 'Item' : 'Items'} Pending
239
+ </span>
240
+ </div>
241
+ </div>
242
+ <div className={`p-3 md:p-4 grid gap-3 bg-purple-50/10 ${activeBuyNowCarts.length === 1 ? 'grid-cols-1' : 'grid-cols-1 md:grid-cols-2'}`}>
243
+ {/* Mobile items count */}
244
+ <div className="sm:hidden mb-1">
245
+ <span className="text-[#8B5AB1] font-bold bg-[#8B5AB1]/10 px-3 py-1 rounded-full text-xs whitespace-nowrap border border-purple-100 inline-block">
246
+ {buyNowTotalItems} {buyNowTotalItems === 1 ? 'Item' : 'Items'} Pending
247
+ </span>
248
+ </div>
249
+ {activeBuyNowCarts.map(cart => renderCartCard(cart, "buy_now"))}
250
+ </div>
251
+ </div>
252
+ )}
253
+
254
+ {/* REORDER SECTION */}
255
+ {(activeTab === "reorder" || activeBuyNowCarts.length === 0) && activeReorderCarts.length > 0 && (
256
+ <div className="bg-white rounded-2xl border border-purple-100/80 shadow-sm overflow-hidden relative">
257
+ <div className="absolute top-0 right-0 w-64 h-64 bg-gradient-to-br from-purple-50/50 to-purple-100/20 rounded-bl-[100px] -z-10 pointer-events-none" />
258
+
259
+ <div className="p-3 md:p-4 border-b border-purple-100/60 flex items-start justify-between gap-3 md:gap-4">
260
+ <div className="flex items-start gap-2.5">
261
+ <div className="bg-[#8B5AB1]/10 p-1.5 rounded-lg shadow-sm border border-purple-100/50 flex-shrink-0">
262
+ <RefreshCw className="w-4 h-4 text-[#8B5AB1]" />
263
+ </div>
264
+ <div>
265
+ <h2 className="text-base font-bold text-gray-900 tracking-tight leading-tight">Pending Reorder Order</h2>
266
+ <p className="text-xs text-gray-500 mt-0.5 leading-relaxed">
267
+ Your reorder items are pending. Proceed to checkout to complete your order.
268
+ </p>
269
+ </div>
270
+ </div>
271
+ <div className="hidden sm:flex items-center mt-0.5">
272
+ <span className="text-[#8B5AB1] font-bold bg-[#8B5AB1]/10 px-2.5 py-1 rounded-full text-[11px] whitespace-nowrap border border-purple-100">
273
+ {reorderTotalItems} {reorderTotalItems === 1 ? 'Item' : 'Items'} Pending
274
+ </span>
275
+ </div>
276
+ </div>
277
+ <div className={`p-3 md:p-4 grid gap-3 bg-purple-50/10 ${activeReorderCarts.length === 1 ? 'grid-cols-1' : 'grid-cols-1 md:grid-cols-2'}`}>
278
+ {/* Mobile items count */}
279
+ <div className="sm:hidden mb-1">
280
+ <span className="text-[#8B5AB1] font-bold bg-[#8B5AB1]/10 px-3 py-1 rounded-full text-xs whitespace-nowrap border border-purple-100 inline-block">
281
+ {reorderTotalItems} {reorderTotalItems === 1 ? 'Item' : 'Items'} Pending
282
+ </span>
283
+ </div>
284
+ {activeReorderCarts.map(cart => renderCartCard(cart, "reorder"))}
285
+ </div>
286
+ </div>
287
+ )}
288
+ </div>
289
+
290
+ {/* Confirmation Modal */}
291
+ <Modal isOpen={!!deletingId} close={() => setDeletingId(null)} size="xsmall">
292
+ <div className="p-7 md:p-9">
293
+ <div className="flex flex-col items-center text-center">
294
+ {/* Icon Container */}
295
+ <div className="w-13 h-13 rounded-full bg-[#FFF5F5] flex items-center justify-center mb-5">
296
+ <Trash className="w-6 h-6 text-[#F34E4E]" />
297
+ </div>
298
+
299
+ {/* Title */}
300
+ <h2 className="text-xl md:text-2xl font-extrabold text-[#111827] mb-2 tracking-tight">
301
+ Remove Order?
302
+ </h2>
303
+
304
+ {/* Description */}
305
+ <p className="text-[#6B7280] text-sm md:text-base leading-relaxed mb-7 max-w-[280px]">
306
+ Are you sure you want to remove this pending order? This action cannot be undone.
307
+ </p>
308
+
309
+ {/* Actions */}
310
+ <div className="flex flex-row gap-3 w-full">
311
+ <button
312
+ onClick={() => setDeletingId(null)}
313
+ disabled={isDeleting}
314
+ className="flex-1 bg-white hover:bg-gray-50 text-[#111827] font-bold h-[48px] rounded-xl text-sm md:text-base transition-all active:scale-[0.98] border-2 border-[#E5E7EB] disabled:opacity-70 disabled:cursor-not-allowed"
315
+ >
316
+ Cancel
317
+ </button>
318
+ <button
319
+ onClick={handleDelete}
320
+ disabled={isDeleting}
321
+ className="flex-1 bg-[#F34E4E] hover:bg-[#E03E3E] text-white font-bold h-[48px] rounded-xl text-sm md:text-base transition-all active:scale-[0.98] flex items-center justify-center border-2 border-[#111827] disabled:opacity-70 disabled:cursor-not-allowed"
322
+ >
323
+ {isDeleting ? (
324
+ <Loader2 className="w-4 h-4 animate-spin text-white" />
325
+ ) : (
326
+ "Yes, Remove"
327
+ )}
328
+ </button>
329
+ </div>
330
+ </div>
331
+ </div>
332
+ </Modal>
333
+ </>
334
+ )
335
+ }