@salifbiaye/create-boutique 0.1.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 (316) hide show
  1. package/README.md +1 -0
  2. package/cli/dist/commands.js +382 -0
  3. package/cli/dist/create.js +194 -0
  4. package/cli/dist/docker.js +19 -0
  5. package/cli/dist/generate.js +322 -0
  6. package/cli/dist/guide.js +72 -0
  7. package/cli/dist/index.js +156 -0
  8. package/cli/dist/paths.js +29 -0
  9. package/cli/dist/ports.js +54 -0
  10. package/cli/dist/project.js +119 -0
  11. package/cli/dist/themes.js +24 -0
  12. package/docs/fiche-client.en.html +137 -0
  13. package/docs/fiche-client.html +137 -0
  14. package/docs/guide-complet.en.html +259 -0
  15. package/docs/guide-complet.fr.html +259 -0
  16. package/package.json +51 -0
  17. package/templates/backend/.dockerignore +9 -0
  18. package/templates/backend/Dockerfile +30 -0
  19. package/templates/backend/README.md +78 -0
  20. package/templates/backend/TEMPLATE_VERSION +1 -0
  21. package/templates/backend/docker/entrypoint.sh +28 -0
  22. package/templates/backend/instrumentation.ts +24 -0
  23. package/templates/backend/medusa-config.ts +114 -0
  24. package/templates/backend/package-lock.json +16222 -0
  25. package/templates/backend/package.json +39 -0
  26. package/templates/backend/src/admin/README.md +33 -0
  27. package/templates/backend/src/admin/components/image-field.tsx +61 -0
  28. package/templates/backend/src/admin/i18n/README.md +58 -0
  29. package/templates/backend/src/admin/i18n/index.ts +8 -0
  30. package/templates/backend/src/admin/i18n/json/en.json +66 -0
  31. package/templates/backend/src/admin/i18n/json/fr.json +66 -0
  32. package/templates/backend/src/admin/lib/client.ts +9 -0
  33. package/templates/backend/src/admin/routes/boutique-campaigns/campaign-drawer.tsx +286 -0
  34. package/templates/backend/src/admin/routes/boutique-campaigns/page.tsx +113 -0
  35. package/templates/backend/src/admin/tsconfig.json +24 -0
  36. package/templates/backend/src/admin/vite-env.d.ts +1 -0
  37. package/templates/backend/src/admin/widgets/category-image.tsx +56 -0
  38. package/templates/backend/src/api/README.md +135 -0
  39. package/templates/backend/src/api/admin/boutique-campaigns/[salesChannelId]/route.ts +30 -0
  40. package/templates/backend/src/api/admin/boutique-campaigns/route.ts +24 -0
  41. package/templates/backend/src/api/middlewares.ts +28 -0
  42. package/templates/backend/src/api/rate-limit.ts +30 -0
  43. package/templates/backend/src/api/route.ts +6 -0
  44. package/templates/backend/src/api/store/campaign/route.ts +25 -0
  45. package/templates/backend/src/api/store/order-lookup/route.ts +74 -0
  46. package/templates/backend/src/emails/en.json +64 -0
  47. package/templates/backend/src/emails/fr.json +64 -0
  48. package/templates/backend/src/jobs/README.md +38 -0
  49. package/templates/backend/src/lib/emails.ts +94 -0
  50. package/templates/backend/src/lib/notify.ts +148 -0
  51. package/templates/backend/src/lib/project.ts +146 -0
  52. package/templates/backend/src/links/README.md +26 -0
  53. package/templates/backend/src/links/campaign-sales-channel.ts +9 -0
  54. package/templates/backend/src/modules/README.md +117 -0
  55. package/templates/backend/src/modules/campaign/index.ts +9 -0
  56. package/templates/backend/src/modules/campaign/migrations/.snapshot-boutique-campaign.json +272 -0
  57. package/templates/backend/src/modules/campaign/migrations/Migration20260928141440.ts +16 -0
  58. package/templates/backend/src/modules/campaign/migrations/Migration20260928145243.ts +13 -0
  59. package/templates/backend/src/modules/campaign/models/campaign.ts +28 -0
  60. package/templates/backend/src/modules/campaign/service.ts +6 -0
  61. package/templates/backend/src/modules/campaign/validators.ts +94 -0
  62. package/templates/backend/src/modules/resend/index.ts +6 -0
  63. package/templates/backend/src/modules/resend/service.ts +63 -0
  64. package/templates/backend/src/scripts/README.md +63 -0
  65. package/templates/backend/src/scripts/campaign-export.ts +15 -0
  66. package/templates/backend/src/scripts/campaign-import.ts +38 -0
  67. package/templates/backend/src/scripts/price-report.ts +34 -0
  68. package/templates/backend/src/scripts/seed.ts +418 -0
  69. package/templates/backend/src/scripts/storage.ts +63 -0
  70. package/templates/backend/src/subscribers/README.md +61 -0
  71. package/templates/backend/src/subscribers/account-emails.ts +27 -0
  72. package/templates/backend/src/subscribers/fulfillment-emails.ts +42 -0
  73. package/templates/backend/src/subscribers/order-emails.ts +12 -0
  74. package/templates/backend/src/subscribers/return-refund-emails.ts +50 -0
  75. package/templates/backend/src/workflows/README.md +81 -0
  76. package/templates/backend/src/workflows/steps/upsert-campaign.ts +53 -0
  77. package/templates/backend/src/workflows/upsert-campaign.ts +30 -0
  78. package/templates/backend/tsconfig.json +36 -0
  79. package/templates/storefront/.dockerignore +7 -0
  80. package/templates/storefront/.github/ISSUE_TEMPLATE/bug-report.yml +71 -0
  81. package/templates/storefront/.prettierrc +8 -0
  82. package/templates/storefront/Dockerfile +37 -0
  83. package/templates/storefront/LICENSE +21 -0
  84. package/templates/storefront/README.md +127 -0
  85. package/templates/storefront/locales/en.json +269 -0
  86. package/templates/storefront/locales/fr.json +269 -0
  87. package/templates/storefront/next-env.d.ts +7 -0
  88. package/templates/storefront/next-sitemap.js +19 -0
  89. package/templates/storefront/next.config.js +29 -0
  90. package/templates/storefront/package-lock.json +9031 -0
  91. package/templates/storefront/package.json +49 -0
  92. package/templates/storefront/postcss.config.js +6 -0
  93. package/templates/storefront/public/favicon.ico +0 -0
  94. package/templates/storefront/scripts/sync-design.mjs +30 -0
  95. package/templates/storefront/src/app/(checkout)/checkout/page.tsx +31 -0
  96. package/templates/storefront/src/app/(checkout)/layout.tsx +29 -0
  97. package/templates/storefront/src/app/(checkout)/not-found.tsx +20 -0
  98. package/templates/storefront/src/app/(main)/account/@dashboard/addresses/page.tsx +34 -0
  99. package/templates/storefront/src/app/(main)/account/@dashboard/loading.tsx +9 -0
  100. package/templates/storefront/src/app/(main)/account/@dashboard/orders/details/[id]/page.tsx +33 -0
  101. package/templates/storefront/src/app/(main)/account/@dashboard/orders/page.tsx +37 -0
  102. package/templates/storefront/src/app/(main)/account/@dashboard/page.tsx +22 -0
  103. package/templates/storefront/src/app/(main)/account/@dashboard/profile/page.tsx +53 -0
  104. package/templates/storefront/src/app/(main)/account/@login/page.tsx +12 -0
  105. package/templates/storefront/src/app/(main)/account/layout.tsx +20 -0
  106. package/templates/storefront/src/app/(main)/account/loading.tsx +9 -0
  107. package/templates/storefront/src/app/(main)/cart/loading.tsx +5 -0
  108. package/templates/storefront/src/app/(main)/cart/not-found.tsx +21 -0
  109. package/templates/storefront/src/app/(main)/cart/page.tsx +21 -0
  110. package/templates/storefront/src/app/(main)/categories/[...category]/page.tsx +55 -0
  111. package/templates/storefront/src/app/(main)/collections/[handle]/page.tsx +55 -0
  112. package/templates/storefront/src/app/(main)/layout.tsx +43 -0
  113. package/templates/storefront/src/app/(main)/legal/[page]/page.tsx +42 -0
  114. package/templates/storefront/src/app/(main)/not-found.tsx +21 -0
  115. package/templates/storefront/src/app/(main)/order/[id]/confirmed/loading.tsx +5 -0
  116. package/templates/storefront/src/app/(main)/order/[id]/confirmed/page.tsx +23 -0
  117. package/templates/storefront/src/app/(main)/order/[id]/transfer/[token]/accept/page.tsx +42 -0
  118. package/templates/storefront/src/app/(main)/order/[id]/transfer/[token]/decline/page.tsx +42 -0
  119. package/templates/storefront/src/app/(main)/order/[id]/transfer/[token]/page.tsx +35 -0
  120. package/templates/storefront/src/app/(main)/order/track/page.tsx +32 -0
  121. package/templates/storefront/src/app/(main)/page.tsx +68 -0
  122. package/templates/storefront/src/app/(main)/products/[handle]/page.tsx +86 -0
  123. package/templates/storefront/src/app/(main)/store/page.tsx +28 -0
  124. package/templates/storefront/src/app/api/health/route.ts +13 -0
  125. package/templates/storefront/src/app/layout.tsx +42 -0
  126. package/templates/storefront/src/app/not-found.tsx +21 -0
  127. package/templates/storefront/src/app/opengraph-image.jpg +0 -0
  128. package/templates/storefront/src/app/twitter-image.jpg +0 -0
  129. package/templates/storefront/src/instrumentation-node.ts +18 -0
  130. package/templates/storefront/src/instrumentation.ts +9 -0
  131. package/templates/storefront/src/lib/boutique/campaign.ts +116 -0
  132. package/templates/storefront/src/lib/boutique/config.ts +152 -0
  133. package/templates/storefront/src/lib/boutique/fonts.ts +29 -0
  134. package/templates/storefront/src/lib/boutique/i18n-client.tsx +34 -0
  135. package/templates/storefront/src/lib/boutique/i18n.ts +43 -0
  136. package/templates/storefront/src/lib/boutique/schema.ts +131 -0
  137. package/templates/storefront/src/lib/config.ts +39 -0
  138. package/templates/storefront/src/lib/constants.tsx +75 -0
  139. package/templates/storefront/src/lib/context/modal-context.tsx +34 -0
  140. package/templates/storefront/src/lib/data/cart.ts +434 -0
  141. package/templates/storefront/src/lib/data/categories.ts +49 -0
  142. package/templates/storefront/src/lib/data/collections.ts +59 -0
  143. package/templates/storefront/src/lib/data/cookies.ts +103 -0
  144. package/templates/storefront/src/lib/data/customer.ts +261 -0
  145. package/templates/storefront/src/lib/data/fulfillment.ts +68 -0
  146. package/templates/storefront/src/lib/data/onboarding.ts +9 -0
  147. package/templates/storefront/src/lib/data/order-lookup.ts +34 -0
  148. package/templates/storefront/src/lib/data/orders.ts +112 -0
  149. package/templates/storefront/src/lib/data/payment.ts +35 -0
  150. package/templates/storefront/src/lib/data/products.ts +127 -0
  151. package/templates/storefront/src/lib/data/regions.ts +70 -0
  152. package/templates/storefront/src/lib/data/variants.ts +38 -0
  153. package/templates/storefront/src/lib/hooks/use-in-view.tsx +29 -0
  154. package/templates/storefront/src/lib/hooks/use-toggle-state.tsx +46 -0
  155. package/templates/storefront/src/lib/util/compare-addresses.ts +28 -0
  156. package/templates/storefront/src/lib/util/get-percentage-diff.ts +6 -0
  157. package/templates/storefront/src/lib/util/get-product-price.ts +79 -0
  158. package/templates/storefront/src/lib/util/isEmpty.ts +11 -0
  159. package/templates/storefront/src/lib/util/medusa-error.ts +22 -0
  160. package/templates/storefront/src/lib/util/money.ts +35 -0
  161. package/templates/storefront/src/lib/util/product.ts +5 -0
  162. package/templates/storefront/src/lib/util/repeat.ts +5 -0
  163. package/templates/storefront/src/lib/util/sort-products.ts +50 -0
  164. package/templates/storefront/src/modules/account/components/account-info/index.tsx +140 -0
  165. package/templates/storefront/src/modules/account/components/account-nav/index.tsx +198 -0
  166. package/templates/storefront/src/modules/account/components/address-book/index.tsx +28 -0
  167. package/templates/storefront/src/modules/account/components/address-card/add-address.tsx +169 -0
  168. package/templates/storefront/src/modules/account/components/address-card/edit-address-modal.tsx +241 -0
  169. package/templates/storefront/src/modules/account/components/login/index.tsx +65 -0
  170. package/templates/storefront/src/modules/account/components/order-card/index.tsx +88 -0
  171. package/templates/storefront/src/modules/account/components/order-overview/index.tsx +47 -0
  172. package/templates/storefront/src/modules/account/components/overview/index.tsx +169 -0
  173. package/templates/storefront/src/modules/account/components/profile-billing-address/index.tsx +193 -0
  174. package/templates/storefront/src/modules/account/components/profile-email/index.tsx +75 -0
  175. package/templates/storefront/src/modules/account/components/profile-name/index.tsx +79 -0
  176. package/templates/storefront/src/modules/account/components/profile-password/index.tsx +72 -0
  177. package/templates/storefront/src/modules/account/components/profile-phone/index.tsx +74 -0
  178. package/templates/storefront/src/modules/account/components/register/index.tsx +107 -0
  179. package/templates/storefront/src/modules/account/components/transfer-request-form/index.tsx +83 -0
  180. package/templates/storefront/src/modules/account/templates/account-layout.tsx +43 -0
  181. package/templates/storefront/src/modules/account/templates/login-template.tsx +27 -0
  182. package/templates/storefront/src/modules/cart/components/cart-item-select/index.tsx +75 -0
  183. package/templates/storefront/src/modules/cart/components/empty-cart-message/index.tsx +25 -0
  184. package/templates/storefront/src/modules/cart/components/item/index.tsx +144 -0
  185. package/templates/storefront/src/modules/cart/components/sign-in-prompt/index.tsx +27 -0
  186. package/templates/storefront/src/modules/cart/templates/index.tsx +51 -0
  187. package/templates/storefront/src/modules/cart/templates/items.tsx +58 -0
  188. package/templates/storefront/src/modules/cart/templates/preview.tsx +51 -0
  189. package/templates/storefront/src/modules/cart/templates/summary.tsx +50 -0
  190. package/templates/storefront/src/modules/categories/templates/index.tsx +94 -0
  191. package/templates/storefront/src/modules/checkout/components/address-select/index.tsx +117 -0
  192. package/templates/storefront/src/modules/checkout/components/addresses/index.tsx +186 -0
  193. package/templates/storefront/src/modules/checkout/components/billing_address/index.tsx +114 -0
  194. package/templates/storefront/src/modules/checkout/components/country-select/index.tsx +50 -0
  195. package/templates/storefront/src/modules/checkout/components/discount-code/index.tsx +181 -0
  196. package/templates/storefront/src/modules/checkout/components/error-message/index.tsx +13 -0
  197. package/templates/storefront/src/modules/checkout/components/payment/index.tsx +261 -0
  198. package/templates/storefront/src/modules/checkout/components/payment-button/index.tsx +195 -0
  199. package/templates/storefront/src/modules/checkout/components/payment-container/index.tsx +130 -0
  200. package/templates/storefront/src/modules/checkout/components/payment-test/index.tsx +12 -0
  201. package/templates/storefront/src/modules/checkout/components/payment-wrapper/index.tsx +42 -0
  202. package/templates/storefront/src/modules/checkout/components/payment-wrapper/stripe-wrapper.tsx +54 -0
  203. package/templates/storefront/src/modules/checkout/components/review/index.tsx +54 -0
  204. package/templates/storefront/src/modules/checkout/components/shipping/index.tsx +417 -0
  205. package/templates/storefront/src/modules/checkout/components/shipping-address/index.tsx +219 -0
  206. package/templates/storefront/src/modules/checkout/components/submit-button/index.tsx +32 -0
  207. package/templates/storefront/src/modules/checkout/templates/checkout-form/index.tsx +38 -0
  208. package/templates/storefront/src/modules/checkout/templates/checkout-summary/index.tsx +31 -0
  209. package/templates/storefront/src/modules/collections/templates/index.tsx +44 -0
  210. package/templates/storefront/src/modules/common/components/cart-totals/index.tsx +84 -0
  211. package/templates/storefront/src/modules/common/components/checkbox/index.tsx +44 -0
  212. package/templates/storefront/src/modules/common/components/delete-button/index.tsx +42 -0
  213. package/templates/storefront/src/modules/common/components/divider/index.tsx +9 -0
  214. package/templates/storefront/src/modules/common/components/filter-radio-group/index.tsx +61 -0
  215. package/templates/storefront/src/modules/common/components/input/index.tsx +79 -0
  216. package/templates/storefront/src/modules/common/components/interactive-link/index.tsx +33 -0
  217. package/templates/storefront/src/modules/common/components/line-item-options/index.tsx +26 -0
  218. package/templates/storefront/src/modules/common/components/line-item-price/index.tsx +63 -0
  219. package/templates/storefront/src/modules/common/components/line-item-unit-price/index.tsx +62 -0
  220. package/templates/storefront/src/modules/common/components/localized-client-link/index.tsx +29 -0
  221. package/templates/storefront/src/modules/common/components/modal/index.tsx +118 -0
  222. package/templates/storefront/src/modules/common/components/native-select/index.tsx +76 -0
  223. package/templates/storefront/src/modules/common/components/radio/index.tsx +27 -0
  224. package/templates/storefront/src/modules/common/icons/back.tsx +37 -0
  225. package/templates/storefront/src/modules/common/icons/bancontact.tsx +26 -0
  226. package/templates/storefront/src/modules/common/icons/chevron-down.tsx +30 -0
  227. package/templates/storefront/src/modules/common/icons/eye-off.tsx +37 -0
  228. package/templates/storefront/src/modules/common/icons/eye.tsx +37 -0
  229. package/templates/storefront/src/modules/common/icons/fast-delivery.tsx +65 -0
  230. package/templates/storefront/src/modules/common/icons/ideal.tsx +26 -0
  231. package/templates/storefront/src/modules/common/icons/map-pin.tsx +37 -0
  232. package/templates/storefront/src/modules/common/icons/package.tsx +44 -0
  233. package/templates/storefront/src/modules/common/icons/paypal.tsx +30 -0
  234. package/templates/storefront/src/modules/common/icons/placeholder-image.tsx +44 -0
  235. package/templates/storefront/src/modules/common/icons/refresh.tsx +51 -0
  236. package/templates/storefront/src/modules/common/icons/spinner.tsx +37 -0
  237. package/templates/storefront/src/modules/common/icons/trash.tsx +51 -0
  238. package/templates/storefront/src/modules/common/icons/user.tsx +37 -0
  239. package/templates/storefront/src/modules/common/icons/x.tsx +37 -0
  240. package/templates/storefront/src/modules/layout/components/cart-mismatch-banner/index.tsx +59 -0
  241. package/templates/storefront/src/modules/order/components/help/index.tsx +26 -0
  242. package/templates/storefront/src/modules/order/components/item/index.tsx +57 -0
  243. package/templates/storefront/src/modules/order/components/items/index.tsx +44 -0
  244. package/templates/storefront/src/modules/order/components/onboarding-cta/index.tsx +28 -0
  245. package/templates/storefront/src/modules/order/components/order-details/index.tsx +64 -0
  246. package/templates/storefront/src/modules/order/components/order-summary/index.tsx +61 -0
  247. package/templates/storefront/src/modules/order/components/payment-details/index.tsx +64 -0
  248. package/templates/storefront/src/modules/order/components/shipping-details/index.tsx +74 -0
  249. package/templates/storefront/src/modules/order/components/transfer-actions/index.tsx +83 -0
  250. package/templates/storefront/src/modules/order/components/transfer-image/index.tsx +275 -0
  251. package/templates/storefront/src/modules/order/templates/order-completed-template.tsx +53 -0
  252. package/templates/storefront/src/modules/order/templates/order-details-template.tsx +46 -0
  253. package/templates/storefront/src/modules/products/components/thumbnail/index.tsx +70 -0
  254. package/templates/storefront/src/modules/products/templates/index.tsx +118 -0
  255. package/templates/storefront/src/modules/shipping/components/free-shipping-price-nudge/index.tsx +285 -0
  256. package/templates/storefront/src/modules/skeletons/components/skeleton-button/index.tsx +5 -0
  257. package/templates/storefront/src/modules/skeletons/components/skeleton-card-details/index.tsx +10 -0
  258. package/templates/storefront/src/modules/skeletons/components/skeleton-cart-item/index.tsx +35 -0
  259. package/templates/storefront/src/modules/skeletons/components/skeleton-cart-totals/index.tsx +30 -0
  260. package/templates/storefront/src/modules/skeletons/components/skeleton-code-form/index.tsx +13 -0
  261. package/templates/storefront/src/modules/skeletons/components/skeleton-line-item/index.tsx +35 -0
  262. package/templates/storefront/src/modules/skeletons/components/skeleton-order-confirmed-header/index.tsx +14 -0
  263. package/templates/storefront/src/modules/skeletons/components/skeleton-order-information/index.tsx +36 -0
  264. package/templates/storefront/src/modules/skeletons/components/skeleton-order-items/index.tsx +43 -0
  265. package/templates/storefront/src/modules/skeletons/components/skeleton-order-summary/index.tsx +15 -0
  266. package/templates/storefront/src/modules/skeletons/components/skeleton-product-preview/index.tsx +15 -0
  267. package/templates/storefront/src/modules/skeletons/templates/skeleton-cart-page/index.tsx +65 -0
  268. package/templates/storefront/src/modules/skeletons/templates/skeleton-order-confirmed/index.tsx +21 -0
  269. package/templates/storefront/src/modules/skeletons/templates/skeleton-product-grid/index.tsx +23 -0
  270. package/templates/storefront/src/modules/store/components/pagination/index.tsx +114 -0
  271. package/templates/storefront/src/modules/store/components/refinement-list/index.tsx +41 -0
  272. package/templates/storefront/src/modules/store/components/refinement-list/sort-products/index.tsx +48 -0
  273. package/templates/storefront/src/modules/store/templates/index.tsx +42 -0
  274. package/templates/storefront/src/modules/store/templates/paginated-products.tsx +80 -0
  275. package/templates/storefront/src/modules/ub/button.tsx +41 -0
  276. package/templates/storefront/src/modules/ub/campaign-blocks.tsx +197 -0
  277. package/templates/storefront/src/modules/ub/campaign-ended.tsx +28 -0
  278. package/templates/storefront/src/modules/ub/category-tiles.tsx +41 -0
  279. package/templates/storefront/src/modules/ub/countdown.tsx +46 -0
  280. package/templates/storefront/src/modules/ub/footer.tsx +56 -0
  281. package/templates/storefront/src/modules/ub/icons.tsx +42 -0
  282. package/templates/storefront/src/modules/ub/nav.tsx +90 -0
  283. package/templates/storefront/src/modules/ub/pdp/buy-box.tsx +140 -0
  284. package/templates/storefront/src/modules/ub/pdp/gallery.tsx +40 -0
  285. package/templates/storefront/src/modules/ub/product-card.tsx +66 -0
  286. package/templates/storefront/src/modules/ub/top-bar.tsx +20 -0
  287. package/templates/storefront/src/modules/ub/track-form.tsx +92 -0
  288. package/templates/storefront/src/proxy.ts +89 -0
  289. package/templates/storefront/src/styles/globals.css +98 -0
  290. package/templates/storefront/src/styles/ub/bundle.css +372 -0
  291. package/templates/storefront/src/styles/ub/fonts.css +17 -0
  292. package/templates/storefront/src/styles/ub/medusa-ui.css +90 -0
  293. package/templates/storefront/src/styles/ub/overrides.css +12 -0
  294. package/templates/storefront/src/styles/ub/tokens.css +9 -0
  295. package/templates/storefront/src/types/global.ts +24 -0
  296. package/templates/storefront/src/types/icon.ts +4 -0
  297. package/templates/storefront/tailwind.config.js +164 -0
  298. package/templates/storefront/themes/black-friday/campaign.en.json +31 -0
  299. package/templates/storefront/themes/black-friday/campaign.fr.json +31 -0
  300. package/templates/storefront/themes/black-friday/theme.json +9 -0
  301. package/templates/storefront/themes/cyber-monday/campaign.en.json +31 -0
  302. package/templates/storefront/themes/cyber-monday/campaign.fr.json +31 -0
  303. package/templates/storefront/themes/cyber-monday/theme.json +9 -0
  304. package/templates/storefront/themes/halloween/campaign.en.json +31 -0
  305. package/templates/storefront/themes/halloween/campaign.fr.json +31 -0
  306. package/templates/storefront/themes/halloween/theme.json +9 -0
  307. package/templates/storefront/themes/noel/campaign.en.json +31 -0
  308. package/templates/storefront/themes/noel/campaign.fr.json +31 -0
  309. package/templates/storefront/themes/noel/theme.json +9 -0
  310. package/templates/storefront/themes/nouvel-an/campaign.en.json +31 -0
  311. package/templates/storefront/themes/nouvel-an/campaign.fr.json +31 -0
  312. package/templates/storefront/themes/nouvel-an/theme.json +9 -0
  313. package/templates/storefront/themes/thanksgiving/campaign.en.json +31 -0
  314. package/templates/storefront/themes/thanksgiving/campaign.fr.json +31 -0
  315. package/templates/storefront/themes/thanksgiving/theme.json +9 -0
  316. package/templates/storefront/tsconfig.json +53 -0
@@ -0,0 +1,28 @@
1
+ import { getBoutique } from "@lib/boutique/config"
2
+ import { t } from "@lib/boutique/i18n"
3
+ import Button from "./button"
4
+
5
+ /** Page « This sale has ended » + lien vers la campagne suivante du client (autre boutique du projet). */
6
+ export default function CampaignEnded({ nextUrl }: { nextUrl?: string }) {
7
+ const { storeName } = getBoutique()
8
+
9
+ return (
10
+ <section className="ub-hero">
11
+ <div className="ub-wrap" style={{ padding: "96px 24px", textAlign: "center", display: "grid", gap: 24, justifyItems: "center" }}>
12
+ <h1 className="ub-hero__title ub-head">{t("ended.title")}</h1>
13
+ <p className="ub-hero__sub">{t("ended.text", { storeName })}</p>
14
+ {nextUrl ? (
15
+ // Lien absolu vers une autre boutique du même projet (URL connue par project.json).
16
+ <a className="ub-btn ub-btn--primary" href={nextUrl}>
17
+ <span>{t("ended.cta")}</span>
18
+ </a>
19
+ ) : (
20
+ <p className="ub-hero__sub">{t("ended.soon")}</p>
21
+ )}
22
+ <Button href="/account" variant="ghost">
23
+ {t("nav.account")}
24
+ </Button>
25
+ </div>
26
+ </section>
27
+ )
28
+ }
@@ -0,0 +1,41 @@
1
+ import Link from "next/link"
2
+ import { t } from "@lib/boutique/i18n"
3
+ import { HttpTypes } from "@medusajs/types"
4
+ import { Icon, TILE_ICONS } from "./icons"
5
+
6
+ /** Tuiles catégorie : catégories racines de Medusa (6 max), couleurs --tint-1…4 du thème. */
7
+ export default function CategoryTiles({ categories }: { categories: HttpTypes.StoreProductCategory[] }) {
8
+ const roots = categories.filter((c) => !c.parent_category).slice(0, 6)
9
+ if (!roots.length) return null
10
+
11
+ return (
12
+ <div className="ub-tiles">
13
+ {roots.map((c, i) => (
14
+ <Link
15
+ key={c.id}
16
+ className="ub-tile"
17
+ href={`/categories/${c.handle}`}
18
+ style={{ "--tile": `var(--tint-${(i % 4) + 1})` } as React.CSSProperties}
19
+ >
20
+ {typeof c.metadata?.image === "string" && /^https?:\/\//.test(c.metadata.image) ? (
21
+ <span className="ub-tile__img" style={{ overflow: "hidden" }}>
22
+ {/* Image de la catégorie : admin → catégorie → « Image de la catégorie » */}
23
+ {/* eslint-disable-next-line @next/next/no-img-element */}
24
+ <img src={c.metadata.image} alt="" loading="lazy" style={{ width: "100%", height: "100%", objectFit: "cover" }} />
25
+ </span>
26
+ ) : (
27
+ <span className="ub-tile__img ub-ph" />
28
+ )}
29
+ <span className="ub-tile__ic">
30
+ <Icon name={TILE_ICONS[i % TILE_ICONS.length]} />
31
+ </span>
32
+ <span className="ub-tile__txt">
33
+ <span className="ub-tile__name">{c.name}</span>
34
+ {c.products && <span className="ub-tile__meta">{t("tile.items", { count: c.products.length })}</span>}
35
+ <span className="ub-tile__cta">{t("tile.cta")}</span>
36
+ </span>
37
+ </Link>
38
+ ))}
39
+ </div>
40
+ )
41
+ }
@@ -0,0 +1,46 @@
1
+ "use client"
2
+
3
+ import { useEffect, useState } from "react"
4
+
5
+ type Labels = { label: string; days: string; hours: string; mins: string; secs: string }
6
+
7
+ const pad = (n: number) => String(n).padStart(2, "0")
8
+
9
+ function parts(ms: number) {
10
+ const s = Math.max(0, Math.floor(ms / 1000))
11
+ return { d: Math.floor(s / 86400), h: Math.floor((s % 86400) / 3600), m: Math.floor((s % 3600) / 60), s: s % 60 }
12
+ }
13
+
14
+ /**
15
+ * Compte à rebours jusqu'à endsAt. Le premier rendu (serveur) reçoit `now` du serveur
16
+ * pour éviter un écart d'hydratation ; ensuite l'horloge du navigateur prend le relais.
17
+ */
18
+ export default function Countdown({ endsAt, serverNow, labels }: { endsAt: string; serverNow: number; labels: Labels }) {
19
+ const end = Date.parse(endsAt)
20
+ const [now, setNow] = useState(serverNow)
21
+
22
+ useEffect(() => {
23
+ setNow(Date.now())
24
+ const id = setInterval(() => setNow(Date.now()), 1000)
25
+ return () => clearInterval(id)
26
+ }, [])
27
+
28
+ const v = parts(end - now)
29
+ const cells: [number, string][] = [
30
+ [v.d, labels.days],
31
+ [v.h, labels.hours],
32
+ [v.m, labels.mins],
33
+ [v.s, labels.secs],
34
+ ]
35
+
36
+ return (
37
+ <div className="ub-countdown" role="timer" aria-label={labels.label}>
38
+ {cells.map(([n, l]) => (
39
+ <div className="ub-countdown__c" key={l}>
40
+ <b>{pad(n)}</b>
41
+ <small>{l}</small>
42
+ </div>
43
+ ))}
44
+ </div>
45
+ )
46
+ }
@@ -0,0 +1,56 @@
1
+ import Link from "next/link"
2
+ import { getBoutique } from "@lib/boutique/config"
3
+ import { t } from "@lib/boutique/i18n"
4
+ import { Logo } from "./nav"
5
+
6
+ // Simples libellés : en production, remplacer par les marques officielles fournies par Stripe.
7
+ const PAYMENTS = ["VISA", "Mastercard", "Amex", "Apple Pay", "Google Pay"]
8
+
9
+ export default function Footer() {
10
+ const { storeName } = getBoutique()
11
+
12
+ return (
13
+ <footer className="ub-footer">
14
+ <div className="ub-wrap">
15
+ <div className="ub-footer__top">
16
+ <div>
17
+ <Logo />
18
+ <p>{t("footer.tagline")}</p>
19
+ </div>
20
+ <div>
21
+ <h4>{t("footer.shop")}</h4>
22
+ <ul>
23
+ <li><Link href="/store">{t("footer.all")}</Link></li>
24
+ <li><Link href="/cart">{t("footer.cart")}</Link></li>
25
+ <li><Link href="/account">{t("nav.account")}</Link></li>
26
+ </ul>
27
+ </div>
28
+ <div>
29
+ <h4>{t("footer.help")}</h4>
30
+ <ul>
31
+ <li><Link href="/legal/shipping">{t("legal.shipping")}</Link></li>
32
+ <li><Link href="/legal/returns">{t("legal.returns")}</Link></li>
33
+ <li><Link href="/order/track">{t("nav.track")}</Link></li>
34
+ </ul>
35
+ </div>
36
+ <div>
37
+ <h4>{t("footer.company")}</h4>
38
+ <ul>
39
+ <li><Link href="/legal/contact">{t("legal.contact")}</Link></li>
40
+ <li><Link href="/legal/privacy">{t("legal.privacy")}</Link></li>
41
+ <li><Link href="/legal/terms">{t("legal.terms")}</Link></li>
42
+ </ul>
43
+ </div>
44
+ </div>
45
+ <div className="ub-footer__bot">
46
+ <span>{t("footer.rights", { year: new Date().getFullYear(), storeName })}</span>
47
+ <div className="ub-pays" aria-label={t("footer.payments")}>
48
+ {PAYMENTS.map((p) => (
49
+ <span key={p}>{p}</span>
50
+ ))}
51
+ </div>
52
+ </div>
53
+ </div>
54
+ </footer>
55
+ )
56
+ }
@@ -0,0 +1,42 @@
1
+ // Icônes des maquettes (design/previews) : trait 1.6, currentColor.
2
+ const paths = {
3
+ truck: <><path d="M3 6h11v10H3zM14 9h4l3 3v4h-7" /><circle cx="7" cy="17.5" r="1.8" /><circle cx="17" cy="17.5" r="1.8" /></>,
4
+ tag: <><path d="M3 12V4h8l10 10-8 8z" /><circle cx="7.5" cy="8.5" r="1.3" /></>,
5
+ lock: <><rect x="5" y="11" width="14" height="9" rx="2" /><path d="M8 11V8a4 4 0 0 1 8 0v3" /></>,
6
+ search: <><circle cx="11" cy="11" r="6.5" /><path d="M20 20l-4.2-4.2" /></>,
7
+ heart: <path d="M12 20s-7-4.4-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 10c0 5.6-7 10-7 10z" />,
8
+ user: <><circle cx="12" cy="8" r="3.5" /><path d="M5 20a7 7 0 0 1 14 0" /></>,
9
+ cart: <><path d="M3 4h2l2.2 11h11.3L21 7H6.2" /><circle cx="9" cy="19.5" r="1.3" /><circle cx="17" cy="19.5" r="1.3" /></>,
10
+ arrowUpRight: <path d="M7 17L17 7M9 7h8v8" />,
11
+ arrowRight: <path d="M5 12h14M13 6l6 6-6 6" />,
12
+ shield: <><path d="M12 3l7 3v6c0 4.4-3 7.6-7 9-4-1.4-7-4.6-7-9V6z" /><path d="M9 12l2 2 4-4" /></>,
13
+ returns: <path d="M4 12a8 8 0 1 0 2.3-5.6M4 4v4h4" />,
14
+ headset: <><path d="M4 14v-2a8 8 0 0 1 16 0v2" /><rect x="3" y="13" width="4" height="6" rx="1.5" /><rect x="17" y="13" width="4" height="6" rx="1.5" /></>,
15
+ shirt: <path d="M8 4l4 2 4-2 4 3-2 4h-2v9H8v-9H6L4 7z" />,
16
+ phone: <><rect x="7" y="3" width="10" height="18" rx="2" /><path d="M11 18h2" /></>,
17
+ home: <><path d="M4 11l8-7 8 7v9H4z" /><path d="M10 20v-5h4v5" /></>,
18
+ gift: <><rect x="4" y="9" width="16" height="11" rx="1" /><path d="M3 9h18M12 9v11M12 9c-2-4-6-4-6-1s6 1 6 1zm0 0c2-4 6-4 6-1s-6 1-6 1z" /></>,
19
+ sparkle: <path d="M12 3v4M12 17v4M3 12h4M17 12h4M6 6l2.5 2.5M15.5 15.5L18 18M6 18l2.5-2.5M15.5 8.5L18 6" />,
20
+ watch: <><rect x="7" y="6" width="10" height="12" rx="3" /><path d="M9 6l1-3h4l1 3M9 18l1 3h4l1-3M12 10v2l1.5 1" /></>,
21
+ } as const
22
+
23
+ export type IconName = keyof typeof paths
24
+
25
+ export const TILE_ICONS: IconName[] = ["shirt", "phone", "home", "gift", "sparkle", "watch"]
26
+
27
+ export function Icon({ name, strokeWidth = 1.6, style }: { name: IconName; strokeWidth?: number; style?: React.CSSProperties }) {
28
+ return (
29
+ <svg
30
+ viewBox="0 0 24 24"
31
+ fill="none"
32
+ stroke="currentColor"
33
+ strokeWidth={strokeWidth}
34
+ strokeLinecap="round"
35
+ strokeLinejoin="round"
36
+ aria-hidden="true"
37
+ style={style}
38
+ >
39
+ {paths[name]}
40
+ </svg>
41
+ )
42
+ }
@@ -0,0 +1,90 @@
1
+ import { Suspense } from "react"
2
+ import Link from "next/link"
3
+ import { getCampaign } from "@lib/boutique/campaign"
4
+ import { getBoutique } from "@lib/boutique/config"
5
+ import { t } from "@lib/boutique/i18n"
6
+ import { retrieveCart } from "@lib/data/cart"
7
+ import Button from "./button"
8
+ import { Icon } from "./icons"
9
+
10
+ async function CartCount() {
11
+ const cart = await retrieveCart().catch(() => null)
12
+ const count = cart?.items?.reduce((n, i) => n + i.quantity, 0) ?? 0
13
+
14
+ return (
15
+ <Link className="ub-icon" href="/cart" aria-label={t("nav.cart", { count })} data-testid="nav-cart-link">
16
+ <Icon name="cart" />
17
+ {count > 0 && <span className="ub-count">{count}</span>}
18
+ </Link>
19
+ )
20
+ }
21
+
22
+ function CartFallback() {
23
+ return (
24
+ <Link className="ub-icon" href="/cart" aria-label={t("nav.cart", { count: 0 })}>
25
+ <Icon name="cart" />
26
+ </Link>
27
+ )
28
+ }
29
+
30
+ /** Logo de la boutique (admin → Campagnes) ; à défaut, pastille de couleur du thème + nom. */
31
+ export async function Logo() {
32
+ const { storeName } = getBoutique()
33
+ const logo = await getCampaign()
34
+ .then((c) => c.logo)
35
+ .catch(() => undefined)
36
+
37
+ if (logo) {
38
+ return (
39
+ <Link className="ub-logo" href="/" data-testid="nav-store-link" aria-label={storeName}>
40
+ {/* eslint-disable-next-line @next/next/no-img-element */}
41
+ <img src={logo} alt={storeName} style={{ height: 36, width: "auto", maxWidth: 180, objectFit: "contain" }} />
42
+ </Link>
43
+ )
44
+ }
45
+
46
+ return (
47
+ <Link className="ub-logo" href="/" data-testid="nav-store-link">
48
+ <span className="ub-logo__mark" />
49
+ <span>{getBoutique().storeName}</span>
50
+ </Link>
51
+ )
52
+ }
53
+
54
+ export default function Nav({ current }: { current?: "home" | "shop" }) {
55
+ return (
56
+ <header className="ub-nav">
57
+ <div className="ub-wrap">
58
+ <Logo />
59
+ <nav className="ub-nav__links" aria-label={t("nav.main")}>
60
+ <Link href="/" aria-current={current === "home" ? "page" : undefined}>
61
+ {t("nav.home")}
62
+ </Link>
63
+ <Link href="/store" aria-current={current === "shop" ? "page" : undefined}>
64
+ {t("nav.shop")}
65
+ </Link>
66
+ <Link href="/order/track">{t("nav.track")}</Link>
67
+ <Link href="/legal/contact">{t("nav.contact")}</Link>
68
+ </nav>
69
+ <Link className="ub-search" href="/store">
70
+ {t("nav.search")}
71
+ <Icon name="search" />
72
+ </Link>
73
+ <div className="ub-nav__icons">
74
+ <Link className="ub-icon ub-icon--search" href="/store" aria-label={t("nav.search")}>
75
+ <Icon name="search" />
76
+ </Link>
77
+ <Link className="ub-icon ub-icon--user" href="/account" aria-label={t("nav.account")} data-testid="nav-account-link">
78
+ <Icon name="user" />
79
+ </Link>
80
+ <Suspense fallback={<CartFallback />}>
81
+ <CartCount />
82
+ </Suspense>
83
+ </div>
84
+ <Button href="/store" small className="ub-nav__cta">
85
+ {t("nav.cta")}
86
+ </Button>
87
+ </div>
88
+ </header>
89
+ )
90
+ }
@@ -0,0 +1,140 @@
1
+ "use client"
2
+
3
+ import { addToCart } from "@lib/data/cart"
4
+ import { getPricesForVariant } from "@lib/util/get-product-price"
5
+ import { convertToLocale } from "@lib/util/money"
6
+ import { HttpTypes } from "@medusajs/types"
7
+ import { isEqual } from "lodash"
8
+ import { usePathname, useRouter, useSearchParams } from "next/navigation"
9
+ import { useEffect, useMemo, useState, useTransition } from "react"
10
+
11
+ export type BuyBoxLabels = {
12
+ addToCart: string
13
+ buyNow: string
14
+ adding: string
15
+ selectVariant: string
16
+ outOfStock: string
17
+ /** "Save {amount}" */
18
+ save: string
19
+ }
20
+
21
+ const optionsOf = (v?: HttpTypes.StoreProductVariant) =>
22
+ (v?.options ?? []).reduce<Record<string, string>>((acc, o) => {
23
+ if (o.option_id) acc[o.option_id] = o.value
24
+ return acc
25
+ }, {})
26
+
27
+ /**
28
+ * Options, prix et boutons « Add to Cart » / « Buy Now » (markup ub-pdp).
29
+ * Le prix affiché vient de Medusa (calculated_price) ; le panier ne reçoit
30
+ * qu'un identifiant de variante et une quantité, jamais un prix.
31
+ */
32
+ export default function BuyBox({
33
+ product,
34
+ labels,
35
+ disabled,
36
+ }: {
37
+ product: HttpTypes.StoreProduct
38
+ labels: BuyBoxLabels
39
+ disabled?: boolean
40
+ }) {
41
+ const router = useRouter()
42
+ const pathname = usePathname()
43
+ const searchParams = useSearchParams()
44
+ const [pending, startTransition] = useTransition()
45
+
46
+ const variants = product.variants ?? []
47
+ const initial = variants.find((v) => v.id === searchParams.get("v_id")) ?? (variants.length === 1 ? variants[0] : undefined)
48
+ const [options, setOptions] = useState<Record<string, string>>(optionsOf(initial))
49
+
50
+ const selected = useMemo(() => variants.find((v) => isEqual(optionsOf(v), options)), [variants, options])
51
+
52
+ useEffect(() => {
53
+ const params = new URLSearchParams(searchParams.toString())
54
+ if ((params.get("v_id") ?? undefined) === selected?.id) return
55
+ if (selected?.id) params.set("v_id", selected.id)
56
+ else params.delete("v_id")
57
+ router.replace(`${pathname}?${params.toString()}`, { scroll: false })
58
+ // eslint-disable-next-line react-hooks/exhaustive-deps
59
+ }, [selected?.id])
60
+
61
+ const inStock =
62
+ !!selected &&
63
+ (!selected.manage_inventory || selected.allow_backorder || (selected.inventory_quantity ?? 0) > 0)
64
+
65
+ // Prix de la variante choisie, sinon le moins cher du produit
66
+ const cheapest = [...variants]
67
+ .filter((v) => v.calculated_price?.calculated_amount != null)
68
+ .sort((a, b) => a.calculated_price!.calculated_amount! - b.calculated_price!.calculated_amount!)[0]
69
+ const price = getPricesForVariant(selected ?? cheapest)
70
+ const onSale = price && price.original_price_number > price.calculated_price_number
71
+
72
+ const add = (thenCheckout: boolean) => {
73
+ if (!selected?.id) return
74
+ startTransition(async () => {
75
+ await addToCart({ variantId: selected.id, quantity: 1 })
76
+ if (thenCheckout) router.push("/checkout?step=address")
77
+ })
78
+ }
79
+
80
+ const blocked = !selected || !inStock || !!disabled || pending
81
+ const label = !selected ? labels.selectVariant : !inStock ? labels.outOfStock : pending ? labels.adding : labels.addToCart
82
+
83
+ return (
84
+ <>
85
+ {price && (
86
+ <>
87
+ {onSale && <p className="ub-pdp__was">{price.original_price}</p>}
88
+ <div className="ub-pdp__price">
89
+ <b data-testid="product-price">{price.calculated_price}</b>
90
+ {onSale && (
91
+ <span className="ub-save">
92
+ {labels.save.replace(
93
+ "{amount}",
94
+ convertToLocale({
95
+ amount: price.original_price_number - price.calculated_price_number,
96
+ currency_code: price.currency_code,
97
+ })
98
+ )}
99
+ </span>
100
+ )}
101
+ </div>
102
+ </>
103
+ )}
104
+
105
+ {variants.length > 1 &&
106
+ (product.options ?? []).map((option) => (
107
+ <div className="ub-options" role="group" aria-label={option.title ?? undefined} key={option.id}>
108
+ {(option.values ?? []).map((v) => (
109
+ <button
110
+ key={v.id}
111
+ type="button"
112
+ className="ub-opt"
113
+ aria-pressed={options[option.id] === v.value}
114
+ disabled={!!disabled || pending}
115
+ onClick={() => setOptions((prev) => ({ ...prev, [option.id]: v.value }))}
116
+ data-testid="option-button"
117
+ >
118
+ {v.value}
119
+ </button>
120
+ ))}
121
+ </div>
122
+ ))}
123
+
124
+ <div className="ub-pdp__buy">
125
+ <button
126
+ type="button"
127
+ className="ub-btn ub-btn--primary ub-btn--full"
128
+ disabled={blocked}
129
+ onClick={() => add(false)}
130
+ data-testid="add-product-button"
131
+ >
132
+ {label}
133
+ </button>
134
+ <button type="button" className="ub-btn ub-btn--dark ub-btn--full" disabled={blocked} onClick={() => add(true)}>
135
+ {labels.buyNow}
136
+ </button>
137
+ </div>
138
+ </>
139
+ )
140
+ }
@@ -0,0 +1,40 @@
1
+ "use client"
2
+
3
+ import { useState } from "react"
4
+
5
+ type Img = { id: string; url: string }
6
+
7
+ /** Galerie de la fiche produit : image principale + vignettes (4 max visibles). */
8
+ export default function Gallery({ images, alt }: { images: Img[]; alt: string }) {
9
+ const [current, setCurrent] = useState(0)
10
+ const main = images[current]
11
+
12
+ return (
13
+ <div>
14
+ <div className={`ub-gallery__main${main ? "" : " ub-ph"}`}>
15
+ {main && (
16
+ // eslint-disable-next-line @next/next/no-img-element
17
+ <img src={main.url} alt={alt} style={{ width: "100%", height: "100%", objectFit: "cover", borderRadius: "inherit" }} />
18
+ )}
19
+ </div>
20
+ {images.length > 1 && (
21
+ <div className="ub-gallery__thumbs">
22
+ {images.slice(0, 4).map((img, i) => (
23
+ <button
24
+ key={img.id}
25
+ type="button"
26
+ className="ub-ph"
27
+ aria-current={i === current ? "true" : undefined}
28
+ aria-label={`${alt} ${i + 1}`}
29
+ onClick={() => setCurrent(i)}
30
+ style={{ padding: 0, overflow: "hidden", cursor: "pointer" }}
31
+ >
32
+ {/* eslint-disable-next-line @next/next/no-img-element */}
33
+ <img src={img.url} alt="" style={{ width: "100%", height: "100%", objectFit: "cover" }} />
34
+ </button>
35
+ ))}
36
+ </div>
37
+ )}
38
+ </div>
39
+ )
40
+ }
@@ -0,0 +1,66 @@
1
+ import Link from "next/link"
2
+ import { t } from "@lib/boutique/i18n"
3
+ import { getProductPrice } from "@lib/util/get-product-price"
4
+ import { HttpTypes } from "@medusajs/types"
5
+ import { Icon } from "./icons"
6
+
7
+ /** Carte produit des maquettes. Prix calculés par Medusa pour la région de la boutique. */
8
+ export default function ProductCard({ product }: { product: HttpTypes.StoreProduct }) {
9
+ const { cheapestPrice: price } = getProductPrice({ product })
10
+ const onSale = price?.price_type === "sale"
11
+ const href = `/products/${product.handle}`
12
+ const image = product.thumbnail ?? product.images?.[0]?.url
13
+ const category = product.categories?.[0]?.name ?? product.collection?.title
14
+
15
+ return (
16
+ <article className="ub-card" data-testid="product-wrapper">
17
+ {onSale && price?.percentage_diff && (
18
+ <span className="ub-badge ub-badge--sale">{t("card.sale", { percent: price.percentage_diff })}</span>
19
+ )}
20
+ <Link
21
+ className={`ub-card__media${image ? "" : " ub-ph"}`}
22
+ href={href}
23
+ aria-label={t("card.view", { name: product.title ?? "" })}
24
+ >
25
+ {image && (
26
+ // eslint-disable-next-line @next/next/no-img-element
27
+ <img src={image} alt="" loading="lazy" style={{ width: "100%", height: "100%", objectFit: "cover" }} />
28
+ )}
29
+ </Link>
30
+ <div className="ub-card__body">
31
+ {category && <p className="ub-card__cat">{category}</p>}
32
+ <h3 className="ub-card__name">
33
+ <Link href={href} data-testid="product-title">
34
+ {product.title}
35
+ </Link>
36
+ </h3>
37
+ <div className="ub-card__foot">
38
+ {price && (
39
+ <div className={`ub-price${onSale ? " ub-price--sale" : ""}`}>
40
+ <span className="ub-price__now">{price.calculated_price}</span>
41
+ {onSale && <span className="ub-price__was">{price.original_price}</span>}
42
+ </div>
43
+ )}
44
+ <Link className="ub-card__cart" href={href} aria-label={t("card.addToCart")}>
45
+ <span className="ub-cart-ic">
46
+ <Icon name="cart" />
47
+ </span>
48
+ <span className="ub-arrow">
49
+ <Icon name="arrowUpRight" />
50
+ </span>
51
+ </Link>
52
+ </div>
53
+ </div>
54
+ </article>
55
+ )
56
+ }
57
+
58
+ export function ProductGrid({ products }: { products: HttpTypes.StoreProduct[] }) {
59
+ return (
60
+ <div className="ub-grid">
61
+ {products.map((p) => (
62
+ <ProductCard key={p.id} product={p} />
63
+ ))}
64
+ </div>
65
+ )
66
+ }
@@ -0,0 +1,20 @@
1
+ import { Icon, type IconName } from "./icons"
2
+
3
+ const ICONS: IconName[] = ["truck", "tag", "lock"]
4
+
5
+ export default function TopBar({ messages }: { messages: string[] }) {
6
+ if (!messages.length) return null
7
+
8
+ return (
9
+ <div className="ub-topbar">
10
+ <div className="ub-wrap">
11
+ {messages.slice(0, 3).map((m, i) => (
12
+ <span key={i}>
13
+ <Icon name={ICONS[i]} />
14
+ <span>{m}</span>
15
+ </span>
16
+ ))}
17
+ </div>
18
+ </div>
19
+ )
20
+ }
@@ -0,0 +1,92 @@
1
+ "use client"
2
+
3
+ import { useActionState } from "react"
4
+ import { useT } from "@lib/boutique/i18n-client"
5
+ import { trackOrder, type TrackState } from "@lib/data/order-lookup"
6
+ import { convertToLocale } from "@lib/util/money"
7
+
8
+ const STEPS = ["placed", "shipped", "delivered"] as const
9
+
10
+ /** Formulaire de suivi (n° de commande + e-mail) et résultat : étapes, articles, liens de suivi. */
11
+ export default function TrackForm() {
12
+ const t = useT()
13
+ const [state, action, pending] = useActionState<TrackState, FormData>(trackOrder, {})
14
+ const order = state.order
15
+ const date = (iso?: string | null) =>
16
+ iso ? new Date(iso).toLocaleDateString(document.documentElement.lang, { dateStyle: "long" }) : ""
17
+
18
+ return (
19
+ <div style={{ display: "grid", gap: 24 }}>
20
+ <form action={action} style={{ display: "grid", gap: 12, maxWidth: 420 }}>
21
+ <label className="ub-field ub-field--full">
22
+ {t("track.number")}
23
+ <input className="ub-input" name="number" inputMode="numeric" required placeholder="1042" />
24
+ </label>
25
+ <label className="ub-field ub-field--full">
26
+ {t("track.email")}
27
+ <input className="ub-input" name="email" type="email" required autoComplete="email" />
28
+ </label>
29
+ <button className="ub-btn ub-btn--primary" type="submit" disabled={pending}>
30
+ {pending ? t("track.searching") : t("track.submit")}
31
+ </button>
32
+ {state.error && (
33
+ <p role="alert" style={{ color: "var(--sale)" }}>
34
+ {t(`track.error.${state.error}`)}
35
+ </p>
36
+ )}
37
+ </form>
38
+
39
+ {order && (
40
+ <section aria-live="polite" style={{ display: "grid", gap: 16 }}>
41
+ <h2 className="ub-head" style={{ fontSize: 22 }}>
42
+ {t("track.order", { number: order.number })} · {date(order.created_at)}
43
+ </h2>
44
+
45
+ {order.step === "canceled" ? (
46
+ <p>{t("track.step.canceled")}</p>
47
+ ) : (
48
+ <ol style={{ display: "flex", gap: 8, listStyle: "none", padding: 0, flexWrap: "wrap" }}>
49
+ {STEPS.map((s, i) => {
50
+ const done = STEPS.indexOf(order.step as (typeof STEPS)[number]) >= i
51
+ return (
52
+ <li
53
+ key={s}
54
+ className="ub-tag"
55
+ aria-current={order.step === s ? "step" : undefined}
56
+ style={{ padding: "6px 12px", background: done ? "var(--primary)" : "var(--surface)", color: done ? "var(--on-primary)" : "var(--ink-muted)" }}
57
+ >
58
+ {t(`track.step.${s}`)}
59
+ </li>
60
+ )
61
+ })}
62
+ </ol>
63
+ )}
64
+
65
+ <ul style={{ display: "grid", gap: 4 }}>
66
+ {order.items.map((i, k) => (
67
+ <li key={k}>
68
+ {i.quantity} × {i.title}
69
+ {i.variant ? ` — ${i.variant}` : ""}
70
+ </li>
71
+ ))}
72
+ </ul>
73
+ <p>
74
+ <b>{t("cart.total")} : </b>
75
+ {convertToLocale({ amount: order.total, currency_code: order.currency_code })}
76
+ </p>
77
+
78
+ {order.shipments.flatMap((s) => s.tracking).filter((tr) => tr.number).map((tr, k) => (
79
+ <p key={k}>
80
+ {t("track.tracking")} : <b>{tr.number}</b>{" "}
81
+ {tr.url && /^https?:\/\//.test(tr.url) && (
82
+ <a href={tr.url} target="_blank" rel="noopener noreferrer" style={{ textDecoration: "underline" }}>
83
+ {t("track.follow")}
84
+ </a>
85
+ )}
86
+ </p>
87
+ ))}
88
+ </section>
89
+ )}
90
+ </div>
91
+ )
92
+ }