@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,416 @@
1
+ "use client"
2
+
3
+ import React, { useActionState, useEffect, useState, useRef } from "react"
4
+ import { HttpTypes } from "@medusajs/types"
5
+ import { updateCustomer, uploadProfileImage } from "@core/data/customer"
6
+ import { PencilSquare } from "@medusajs/icons"
7
+ import { sendCustomerOTP, verifyCustomerOTP } from "@core/data/customer-registration"
8
+ import PhoneInput from "react-phone-input-2"
9
+ import "react-phone-input-2/lib/style.css"
10
+ import AccountDeletion from "../account-deletion"
11
+
12
+ type ProfileFormProps = {
13
+ customer: HttpTypes.StoreCustomer
14
+ }
15
+
16
+ // Helper function to get profile image URL from metadata
17
+ const getProfileImageUrl = (
18
+ customer: HttpTypes.StoreCustomer,
19
+ accentHex = "8B5AB1"
20
+ ): string => {
21
+ const metadata = customer.metadata as Record<string, any> | undefined
22
+ if (metadata?.profile_image_url) {
23
+ return metadata.profile_image_url
24
+ }
25
+ return `https://ui-avatars.com/api/?name=${customer.first_name || "J"}+${customer.last_name || "W"}&background=${accentHex}&color=fff&size=256&bold=true`
26
+ }
27
+
28
+ const ProfileForm: React.FC<ProfileFormProps> = ({ customer }) => {
29
+ const [successState, setSuccessState] = useState(false)
30
+ const [isSubmitting, setIsSubmitting] = useState(false)
31
+ const [accentHex, setAccentHex] = useState("8B5AB1")
32
+ const [imagePreview, setImagePreview] = useState<string>(getProfileImageUrl(customer))
33
+ const [isUploadingImage, setIsUploadingImage] = useState(false)
34
+ const fileInputRef = useRef<HTMLInputElement>(null)
35
+
36
+ // OTP related states
37
+ const [isSendingOtp, setIsSendingOtp] = useState(false)
38
+ const [isVerifying, setIsVerifying] = useState(false)
39
+ const [otpToken, setOtpToken] = useState<string | null>(null)
40
+ const [otpCode, setOtpCode] = useState("")
41
+ const [showOtpInput, setShowOtpInput] = useState(false)
42
+ const [otpType, setOtpType] = useState<"email_verification" | "phone_verification">("phone_verification")
43
+ const [otpError, setOtpError] = useState<string | null>(null)
44
+ const [imageError, setImageError] = useState<string | null>(null)
45
+ const [phoneVerified, setPhoneVerified] = useState((customer as any).phone_verified === true || (customer as any).phone_verified === "true" || customer.metadata?.phone_verified === true || customer.metadata?.phone_verified === "true")
46
+ const [emailVerified, setEmailVerified] = useState((customer as any).email_verified === true || (customer as any).email_verified === "true" || customer.metadata?.email_verified === true || customer.metadata?.email_verified === "true")
47
+
48
+ useEffect(() => {
49
+ const raw = getComputedStyle(document.documentElement)
50
+ .getPropertyValue("--color-brand-accent")
51
+ .trim()
52
+ if (raw) {
53
+ const hex = raw.replace("#", "")
54
+ setAccentHex(hex)
55
+ setImagePreview((prev) => {
56
+ if (prev.includes("ui-avatars.com")) {
57
+ return getProfileImageUrl(customer, hex)
58
+ }
59
+ return prev
60
+ })
61
+ }
62
+ }, [customer])
63
+
64
+ const updateProfile = async (
65
+ _currentState: Record<string, unknown>,
66
+ formData: FormData
67
+ ) => {
68
+ setIsSubmitting(true)
69
+ const fullName = formData.get("full_name") as string
70
+ const phone = formData.get("phone") as string
71
+
72
+ try {
73
+ // Only include fields supported by Medusa 2.0 Store API
74
+ const payload: any = {
75
+ first_name: fullName.split(" ")[0],
76
+ last_name: fullName.split(" ").slice(1).join(" ") || ".",
77
+ phone: phone,
78
+ }
79
+
80
+ await updateCustomer(payload)
81
+ setIsSubmitting(false)
82
+ // If phone is changed, it's no longer verified
83
+ if (phone !== customer.phone) {
84
+ setPhoneVerified(false)
85
+ }
86
+ return { success: true, error: null }
87
+ } catch (error: any) {
88
+ setIsSubmitting(false)
89
+ return { success: false, error: error.toString() }
90
+ }
91
+ }
92
+
93
+ const [state, formAction] = useActionState(updateProfile, {
94
+ error: null,
95
+ success: false,
96
+ })
97
+
98
+ useEffect(() => {
99
+ if (state.success) {
100
+ setSuccessState(true)
101
+ const timer = setTimeout(() => setSuccessState(false), 3000)
102
+ return () => clearTimeout(timer)
103
+ }
104
+ }, [state.success])
105
+
106
+ const fullName = `${customer.first_name || ""} ${customer.last_name || ""}`.trim()
107
+
108
+ const handleImageUpload = async (e: React.ChangeEvent<HTMLInputElement>) => {
109
+ const file = e.target.files?.[0]
110
+ if (!file) return
111
+
112
+ setImageError(null)
113
+ if (!file.type.startsWith("image/")) {
114
+ setImageError("Please select an image file")
115
+ return
116
+ }
117
+
118
+ if (file.size > 5 * 1024 * 1024) {
119
+ setImageError("Please upload an image smaller than 5MB")
120
+ return
121
+ }
122
+
123
+ setIsUploadingImage(true)
124
+ try {
125
+ const formData = new FormData()
126
+ formData.append("image", file)
127
+ const result = await uploadProfileImage(formData)
128
+ if (result.success) {
129
+ window.location.reload()
130
+ } else {
131
+ throw new Error(result.error)
132
+ }
133
+ } catch (error: any) {
134
+ alert(error.message || "Failed to upload image")
135
+ setImagePreview(getProfileImageUrl(customer))
136
+ } finally {
137
+ setIsUploadingImage(false)
138
+ }
139
+ }
140
+
141
+ const handleSendOtp = async (type: "email_verification" | "phone_verification" = "phone_verification") => {
142
+ const target = type === "email_verification" ? customer.email : customer.phone
143
+ if (!target) {
144
+ setOtpError(`Please save a ${type === "email_verification" ? "email" : "phone number"} first.`)
145
+ return
146
+ }
147
+
148
+ setIsSendingOtp(true)
149
+ setOtpError(null)
150
+ setOtpType(type)
151
+ try {
152
+ const result = await sendCustomerOTP(customer.id, type)
153
+ if (result.success && result.token) {
154
+ setOtpToken(result.token)
155
+ setShowOtpInput(true)
156
+ } else {
157
+ setOtpError(result.error || "Failed to send OTP")
158
+ }
159
+ } catch (err: any) {
160
+ setOtpError(err.message || "An error occurred")
161
+ } finally {
162
+ setIsSendingOtp(false)
163
+ }
164
+ }
165
+
166
+ const handleVerifyOtp = async () => {
167
+ if (!otpToken || !otpCode) return
168
+
169
+ setIsVerifying(true)
170
+ setOtpError(null)
171
+ try {
172
+ const result = await verifyCustomerOTP(otpToken, otpCode)
173
+ if (result.success) {
174
+ // Update local state
175
+ if (otpType === "phone_verification") {
176
+ setPhoneVerified(true)
177
+ } else {
178
+ setEmailVerified(true)
179
+ }
180
+
181
+ // Persist verification status in metadata
182
+ const newMetadata = {
183
+ ...(customer.metadata as Record<string, any> || {}),
184
+ [otpType === "phone_verification" ? "phone_verified" : "email_verified"]: true
185
+ }
186
+ await updateCustomer({ metadata: newMetadata })
187
+
188
+ setShowOtpInput(false)
189
+ setSuccessState(true)
190
+ // Reload to fetch updated metadata and ensure consistency
191
+ window.location.reload()
192
+ } else {
193
+ setOtpError(result.error || "Invalid OTP")
194
+ }
195
+ } catch (err: any) {
196
+ setOtpError(err.message || "An error occurred")
197
+ } finally {
198
+ setIsVerifying(false)
199
+ }
200
+ }
201
+
202
+ return (
203
+ <div className="w-full max-w-4xl mx-auto">
204
+ <form action={formAction} className="w-full">
205
+ <div className="flex flex-col gap-y-8">
206
+ {/* Avatar Section */}
207
+ <div className="flex flex-col items-center mb-2">
208
+ <div className="relative group">
209
+ <div className="w-32 h-32 rounded-full overflow-hidden bg-gradient-to-br from-brand-accent-muted to-surface-muted shadow-lg ring-4 ring-white">
210
+ <img
211
+ src={imagePreview}
212
+ alt="Profile"
213
+ className="w-full h-full object-cover"
214
+ />
215
+ </div>
216
+ <button
217
+ type="button"
218
+ onClick={() => fileInputRef.current?.click()}
219
+ disabled={isUploadingImage}
220
+ className="absolute bottom-1 right-1 bg-white rounded-full p-2.5 shadow-lg border-2 border-white cursor-pointer hover:bg-gray-50 transition-all group-hover:scale-110 disabled:opacity-50"
221
+ >
222
+ {isUploadingImage ? (
223
+ <div className="w-5 h-5 border-2 border-brand-accent border-t-transparent rounded-full animate-spin" />
224
+ ) : (
225
+ <PencilSquare className="w-5 h-5 text-brand-accent" />
226
+ )}
227
+ </button>
228
+ <input
229
+ ref={fileInputRef}
230
+ type="file"
231
+ accept="image/*"
232
+ onChange={handleImageUpload}
233
+ className="hidden"
234
+ />
235
+ </div>
236
+ <p className="text-[10px] text-gray-400 mt-2 font-medium">Please upload an image smaller than 5MB.</p>
237
+ {imageError && (
238
+ <p className="text-[10px] text-red-600 mt-1 font-bold animate-in fade-in slide-in-from-top-1">
239
+ {imageError}
240
+ </p>
241
+ )}
242
+ </div>
243
+
244
+ {/* Main Fields */}
245
+ <div className="grid grid-cols-1 md:grid-cols-2 gap-6">
246
+ <div className="flex flex-col gap-y-2">
247
+ <label className="text-sm font-medium text-gray-700">
248
+ Full Name<span className="text-red-500">*</span>
249
+ </label>
250
+ <input
251
+ type="text"
252
+ name="full_name"
253
+ required
254
+ defaultValue={fullName}
255
+ className="w-full px-4 py-3 rounded-lg border border-gray-200 bg-gray-50/50 focus:bg-white focus:outline-none focus:ring-2 focus:ring-brand-accent focus:border-transparent transition-all"
256
+ />
257
+ </div>
258
+ <div className="flex flex-col gap-y-2">
259
+ <label className="text-sm font-medium text-gray-700">
260
+ Mobile Number<span className="text-red-500">*</span>
261
+ </label>
262
+ <div className="relative phone-input-container">
263
+ <PhoneInput
264
+ country={"in"}
265
+ value={customer.phone || ""}
266
+ onChange={(value) => {
267
+ const cleanedValue = value.replace(/\D/g, "")
268
+ const cleanedCustomerPhone = (customer.phone || "").replace(/\D/g, "")
269
+ if (cleanedValue && cleanedValue !== cleanedCustomerPhone) {
270
+ setPhoneVerified(false)
271
+ }
272
+ }}
273
+ inputProps={{
274
+ name: "phone",
275
+ required: true
276
+ }}
277
+ inputStyle={{
278
+ width: "100%",
279
+ height: "46px",
280
+ fontSize: "14px",
281
+ paddingLeft: "52px",
282
+ paddingRight: "80px",
283
+ borderRadius: "8px",
284
+ border: "1px solid #e5e7eb",
285
+ backgroundColor: "#f9fafb99",
286
+ transition: "all 0.2s",
287
+ color: "#111827"
288
+ }}
289
+ buttonStyle={{
290
+ backgroundColor: "transparent",
291
+ border: "none",
292
+ borderRadius: "8px 0 0 8px",
293
+ paddingLeft: "8px"
294
+ }}
295
+ containerStyle={{
296
+ width: "100%",
297
+ height: "46px"
298
+ }}
299
+ dropdownStyle={{
300
+ width: "280px",
301
+ borderRadius: "8px",
302
+ boxShadow: "0 10px 15px -3px rgba(0, 0, 0, 0.1)"
303
+ }}
304
+ />
305
+ <div className="absolute right-2 top-1/2 -translate-y-1/2 flex items-center">
306
+ {phoneVerified ? (
307
+ <div className="bg-green-50 px-2 py-1.5 rounded-md flex items-center gap-1">
308
+ <svg className="w-3 h-3 text-green-600" fill="currentColor" viewBox="0 0 20 20"><path d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" /></svg>
309
+ <span className="text-[10px] font-bold text-green-600 uppercase tracking-wider">Verified</span>
310
+ </div>
311
+ ) : customer.phone ? (
312
+ <button
313
+ type="button"
314
+ onClick={() => handleSendOtp("phone_verification")}
315
+ disabled={isSendingOtp}
316
+ className="bg-[#F3E8FF] text-brand-accent px-3 h-8 rounded-lg text-[11px] font-bold hover:bg-brand-accent hover:text-inverse transition-all disabled:opacity-50"
317
+ >
318
+ {isSendingOtp && otpType === "phone_verification" ? "..." : "Verify"}
319
+ </button>
320
+ ) : null}
321
+ </div>
322
+ </div>
323
+ <style jsx global>{`
324
+ .phone-input-container .react-tel-input .form-control:focus {
325
+ background-color: white !important;
326
+ outline: none !important;
327
+ ring: 2px !important;
328
+ border-color: var(--color-brand-accent) !important;
329
+ box-shadow: 0 0 0 2px #f3e8ff !important;
330
+ }
331
+ `}</style>
332
+ </div>
333
+ </div>
334
+
335
+ {/* OTP Input Section */}
336
+ {showOtpInput && (
337
+ <div className="p-4 rounded-xl bg-brand-accent-muted border border-brand-accent-border space-y-3 animate-in fade-in slide-in-from-top-2">
338
+ <div className="flex justify-between items-center">
339
+ <span className="text-sm font-semibold text-heading">Confirm {otpType === "email_verification" ? "Email" : "Phone"} OTP</span>
340
+ <button type="button" onClick={() => setShowOtpInput(false)} className="text-xs text-muted hover:text-brand-accent">Cancel</button>
341
+ </div>
342
+ <div className="flex gap-2">
343
+ <input
344
+ type="text"
345
+ maxLength={6}
346
+ placeholder="Enter 6-digit code"
347
+ value={otpCode}
348
+ onChange={(e) => setOtpCode(e.target.value.replace(/[^0-9]/g, ''))}
349
+ className="flex-1 min-w-0 px-3 py-2 rounded-lg border border-brand-accent-border focus:outline-none focus:ring-2 focus:ring-brand-accent text-sm"
350
+ />
351
+ <button
352
+ type="button"
353
+ onClick={handleVerifyOtp}
354
+ disabled={isVerifying || otpCode.length < 4}
355
+ className="shrink-0 px-4 py-2 bg-brand-accent text-inverse rounded-lg font-bold hover:bg-brand-accent-hover disabled:opacity-50 text-sm whitespace-nowrap"
356
+ >
357
+ {isVerifying ? "..." : "Verify"}
358
+ </button>
359
+ </div>
360
+ {otpError && <p className="text-xs text-red-600">{otpError}</p>}
361
+ </div>
362
+ )}
363
+
364
+ <div className="flex flex-col gap-y-2">
365
+ <label className="text-sm font-medium text-gray-700">Email</label>
366
+ <div className="relative">
367
+ <input
368
+ type="email"
369
+ name="email"
370
+ defaultValue={customer.email}
371
+ readOnly
372
+ className="w-full px-4 py-3 rounded-lg border border-gray-200 bg-gray-100 text-gray-500 cursor-not-allowed focus:outline-none pr-24"
373
+ />
374
+ <div className="absolute right-2 top-1/2 -translate-y-1/2 flex items-center">
375
+ {emailVerified ? (
376
+ <div className="bg-green-50 px-2 py-1.5 rounded-md flex items-center gap-1">
377
+ <svg className="w-3 h-3 text-green-600" fill="currentColor" viewBox="0 0 20 20"><path d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" /></svg>
378
+ <span className="text-[10px] font-bold text-green-600 uppercase tracking-wider">Verified</span>
379
+ </div>
380
+ ) : customer.email ? (
381
+ <button
382
+ type="button"
383
+ onClick={() => handleSendOtp("email_verification")}
384
+ disabled={isSendingOtp}
385
+ className="bg-[#F3E8FF] text-brand-accent px-3 h-8 rounded-lg text-[11px] font-bold hover:bg-brand-accent hover:text-inverse transition-all disabled:opacity-50"
386
+ >
387
+ {isSendingOtp && otpType === "email_verification" ? "..." : "Verify"}
388
+ </button>
389
+ ) : null}
390
+ </div>
391
+ </div>
392
+ </div>
393
+
394
+ <div className="flex flex-col sm:flex-row gap-4 mt-4">
395
+ <button
396
+ type="submit"
397
+ disabled={isSubmitting}
398
+ className="w-full sm:flex-1 h-11 bg-brand-accent text-inverse rounded-[30px] font-bold hover:bg-brand-accent-hover transition-all shadow-lg shadow-brand-sm disabled:opacity-50 text-sm"
399
+ >
400
+ {isSubmitting ? "Saving..." : "Save Profile Details"}
401
+ </button>
402
+ <div className="w-full sm:flex-1">
403
+ <AccountDeletion customerEmail={customer.email} hideHeader={true} />
404
+ </div>
405
+ </div>
406
+
407
+ {/* Status Messages */}
408
+ {state.error && <div className="p-4 rounded-lg bg-red-50 text-red-700 text-sm"><strong>Error:</strong> {state.error}</div>}
409
+ {successState && <div className="p-4 rounded-lg bg-green-50 text-green-700 text-sm"><strong>Success!</strong> Profile updated.</div>}
410
+ </div>
411
+ </form>
412
+ </div>
413
+ )
414
+ }
415
+
416
+ export default ProfileForm
@@ -0,0 +1,76 @@
1
+ "use client"
2
+
3
+ import React, { useEffect, useActionState } from "react";
4
+
5
+ import Input from "@modules/common/components/input"
6
+
7
+ import AccountInfo from "../account-info"
8
+ import { HttpTypes } from "@medusajs/types"
9
+ import { updateCustomer } from "@core/data/customer"
10
+
11
+ type MyInformationProps = {
12
+ customer: HttpTypes.StoreCustomer
13
+ }
14
+
15
+ const ProfileName: React.FC<MyInformationProps> = ({ customer }) => {
16
+ const [successState, setSuccessState] = React.useState(false)
17
+
18
+ const updateCustomerName = async (
19
+ _currentState: Record<string, unknown>,
20
+ formData: FormData
21
+ ) => {
22
+ const full_name = formData.get("full_name") as string
23
+ const [first_name, ...last_name_parts] = (full_name || "").split(" ")
24
+ const last_name = last_name_parts.join(" ") || "."
25
+
26
+ const customer = {
27
+ first_name: first_name || "",
28
+ last_name: last_name,
29
+ }
30
+
31
+ try {
32
+ await updateCustomer(customer)
33
+ return { success: true, error: null }
34
+ } catch (error: any) {
35
+ return { success: false, error: error.toString() }
36
+ }
37
+ }
38
+
39
+ const [state, formAction] = useActionState(updateCustomerName, {
40
+ error: false,
41
+ success: false,
42
+ })
43
+
44
+ const clearState = () => {
45
+ setSuccessState(false)
46
+ }
47
+
48
+ useEffect(() => {
49
+ setSuccessState(state.success)
50
+ }, [state])
51
+
52
+ return (
53
+ <form action={formAction} className="w-full overflow-visible">
54
+ <AccountInfo
55
+ label="Name"
56
+ currentInfo={`${customer.first_name} ${customer.last_name}`}
57
+ isSuccess={successState}
58
+ isError={!!state?.error}
59
+ clearState={clearState}
60
+ data-testid="account-name-editor"
61
+ >
62
+ <div className="flex flex-col gap-y-4">
63
+ <Input
64
+ label="Full name"
65
+ name="full_name"
66
+ required
67
+ defaultValue={customer.first_name ? `${customer.first_name} ${customer.last_name === "." ? "" : customer.last_name}`.trim() : ""}
68
+ data-testid="full-name-input"
69
+ />
70
+ </div>
71
+ </AccountInfo>
72
+ </form>
73
+ )
74
+ }
75
+
76
+ export default ProfileName
@@ -0,0 +1,70 @@
1
+ "use client"
2
+
3
+ import React, { useEffect, useActionState } from "react"
4
+ import Input from "@modules/common/components/input"
5
+ import AccountInfo from "../account-info"
6
+ import { HttpTypes } from "@medusajs/types"
7
+ import { toast } from "@medusajs/ui"
8
+
9
+ type MyInformationProps = {
10
+ customer: HttpTypes.StoreCustomer
11
+ }
12
+
13
+ const ProfilePassword: React.FC<MyInformationProps> = ({ customer }) => {
14
+ const [successState, setSuccessState] = React.useState(false)
15
+
16
+ // TODO: Add support for password updates
17
+ const updatePassword = async () => {
18
+ toast.info("Password update is not implemented")
19
+ }
20
+
21
+ const clearState = () => {
22
+ setSuccessState(false)
23
+ }
24
+
25
+ return (
26
+ <form
27
+ action={updatePassword}
28
+ onReset={() => clearState()}
29
+ className="w-full"
30
+ >
31
+ <AccountInfo
32
+ label="Password"
33
+ currentInfo={
34
+ <span>The password is not shown for security reasons</span>
35
+ }
36
+ isSuccess={successState}
37
+ isError={false}
38
+ errorMessage={undefined}
39
+ clearState={clearState}
40
+ data-testid="account-password-editor"
41
+ >
42
+ <div className="grid grid-cols-2 gap-4">
43
+ <Input
44
+ label="Old password"
45
+ name="old_password"
46
+ required
47
+ type="password"
48
+ data-testid="old-password-input"
49
+ />
50
+ <Input
51
+ label="New password"
52
+ type="password"
53
+ name="new_password"
54
+ required
55
+ data-testid="new-password-input"
56
+ />
57
+ <Input
58
+ label="Confirm password"
59
+ type="password"
60
+ name="confirm_password"
61
+ required
62
+ data-testid="confirm-password-input"
63
+ />
64
+ </div>
65
+ </AccountInfo>
66
+ </form>
67
+ )
68
+ }
69
+
70
+ export default ProfilePassword