@vendure-platform/create 0.5.0 → 0.5.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 (325) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +39 -39
  3. package/dist/add-to-existing.js +1 -1
  4. package/dist/assets/demo-data/initial-data.json +663 -663
  5. package/dist/assets/storefront/components.json +20 -20
  6. package/dist/assets/storefront/eslint.config.mjs +10 -10
  7. package/dist/assets/storefront/graphql.config.yml +1 -1
  8. package/dist/assets/storefront/next.config.ts +5 -4
  9. package/dist/assets/storefront/package.json +1 -1
  10. package/dist/assets/storefront/postcss.config.mjs +1 -1
  11. package/dist/assets/storefront/src/app/[locale]/(catalog)/catalog/page.tsx +17 -21
  12. package/dist/assets/storefront/src/app/[locale]/(catalog)/collection/[slug]/page.tsx +64 -42
  13. package/dist/assets/storefront/src/app/[locale]/(catalog)/layout.tsx +1 -5
  14. package/dist/assets/storefront/src/app/[locale]/(catalog)/product/[slug]/actions.ts +69 -65
  15. package/dist/assets/storefront/src/app/[locale]/(catalog)/product/[slug]/page.tsx +64 -38
  16. package/dist/assets/storefront/src/app/[locale]/(catalog)/search/page.tsx +24 -27
  17. package/dist/assets/storefront/src/app/[locale]/(catalog)/search/search-results.tsx +11 -9
  18. package/dist/assets/storefront/src/app/[locale]/(catalog)/search/search-term.tsx +4 -4
  19. package/dist/assets/storefront/src/app/[locale]/(scenario)/[...path]/page.tsx +1 -1
  20. package/dist/assets/storefront/src/app/[locale]/accept-invitation/[token]/accept-invitation-client.tsx +8 -13
  21. package/dist/assets/storefront/src/app/[locale]/accept-invitation/[token]/actions.ts +11 -14
  22. package/dist/assets/storefront/src/app/[locale]/accept-invitation/[token]/page.tsx +30 -33
  23. package/dist/assets/storefront/src/app/[locale]/accept-invitation/[token]/sign-out-and-retry.tsx +6 -6
  24. package/dist/assets/storefront/src/app/[locale]/account/addresses/actions.ts +30 -45
  25. package/dist/assets/storefront/src/app/[locale]/account/addresses/address-form.tsx +166 -159
  26. package/dist/assets/storefront/src/app/[locale]/account/addresses/addresses-client.tsx +35 -26
  27. package/dist/assets/storefront/src/app/[locale]/account/addresses/loading.tsx +1 -3
  28. package/dist/assets/storefront/src/app/[locale]/account/addresses/page.tsx +16 -18
  29. package/dist/assets/storefront/src/app/[locale]/account/approvals/actions.ts +5 -8
  30. package/dist/assets/storefront/src/app/[locale]/account/approvals/page.tsx +77 -69
  31. package/dist/assets/storefront/src/app/[locale]/account/company/actions.ts +10 -11
  32. package/dist/assets/storefront/src/app/[locale]/account/company/addresses/actions.ts +6 -15
  33. package/dist/assets/storefront/src/app/[locale]/account/company/addresses/address-form.tsx +57 -49
  34. package/dist/assets/storefront/src/app/[locale]/account/company/addresses/addresses-client.tsx +23 -25
  35. package/dist/assets/storefront/src/app/[locale]/account/company/addresses/page.tsx +30 -30
  36. package/dist/assets/storefront/src/app/[locale]/account/company/business-units/actions.ts +20 -29
  37. package/dist/assets/storefront/src/app/[locale]/account/company/business-units/business-unit-form.tsx +32 -37
  38. package/dist/assets/storefront/src/app/[locale]/account/company/business-units/business-units-client.tsx +32 -25
  39. package/dist/assets/storefront/src/app/[locale]/account/company/business-units/page.tsx +24 -24
  40. package/dist/assets/storefront/src/app/[locale]/account/company/business-units/types.ts +7 -4
  41. package/dist/assets/storefront/src/app/[locale]/account/company/edit-company-form.tsx +11 -21
  42. package/dist/assets/storefront/src/app/[locale]/account/company/page.tsx +23 -28
  43. package/dist/assets/storefront/src/app/[locale]/account/company/payment-methods/page.tsx +24 -24
  44. package/dist/assets/storefront/src/app/[locale]/account/company/payment-methods/payment-methods-client.tsx +5 -7
  45. package/dist/assets/storefront/src/app/[locale]/account/company/roles/page.tsx +22 -25
  46. package/dist/assets/storefront/src/app/[locale]/account/company/roles/roles-client.tsx +11 -26
  47. package/dist/assets/storefront/src/app/[locale]/account/company/tax-ids/actions.ts +6 -10
  48. package/dist/assets/storefront/src/app/[locale]/account/company/tax-ids/page.tsx +18 -16
  49. package/dist/assets/storefront/src/app/[locale]/account/company/tax-ids/tax-ids-client.tsx +74 -67
  50. package/dist/assets/storefront/src/app/[locale]/account/company/users/actions.ts +16 -25
  51. package/dist/assets/storefront/src/app/[locale]/account/company/users/edit-user-form.tsx +27 -25
  52. package/dist/assets/storefront/src/app/[locale]/account/company/users/invite-user-form.tsx +27 -19
  53. package/dist/assets/storefront/src/app/[locale]/account/company/users/page.tsx +32 -29
  54. package/dist/assets/storefront/src/app/[locale]/account/company/users/users-client.tsx +35 -38
  55. package/dist/assets/storefront/src/app/[locale]/account/error.tsx +1 -3
  56. package/dist/assets/storefront/src/app/[locale]/account/layout.tsx +16 -22
  57. package/dist/assets/storefront/src/app/[locale]/account/orders/[code]/page.tsx +151 -103
  58. package/dist/assets/storefront/src/app/[locale]/account/orders/[code]/reorder-actions.ts +6 -7
  59. package/dist/assets/storefront/src/app/[locale]/account/orders/[code]/reorder-dialog.tsx +22 -48
  60. package/dist/assets/storefront/src/app/[locale]/account/orders/loading.tsx +8 -8
  61. package/dist/assets/storefront/src/app/[locale]/account/orders/page.tsx +101 -61
  62. package/dist/assets/storefront/src/app/[locale]/account/profile/actions.ts +32 -23
  63. package/dist/assets/storefront/src/app/[locale]/account/profile/change-password-form.tsx +6 -16
  64. package/dist/assets/storefront/src/app/[locale]/account/profile/edit-email-form.tsx +7 -17
  65. package/dist/assets/storefront/src/app/[locale]/account/profile/edit-profile-form.tsx +6 -16
  66. package/dist/assets/storefront/src/app/[locale]/account/profile/loading.tsx +12 -18
  67. package/dist/assets/storefront/src/app/[locale]/account/profile/page.tsx +15 -15
  68. package/dist/assets/storefront/src/app/[locale]/account/quick-order/file-upload-tab.tsx +2 -6
  69. package/dist/assets/storefront/src/app/[locale]/account/quick-order/manual-entry-tab.tsx +18 -15
  70. package/dist/assets/storefront/src/app/[locale]/account/quick-order/page.tsx +3 -6
  71. package/dist/assets/storefront/src/app/[locale]/account/quick-order/preview-table.tsx +10 -2
  72. package/dist/assets/storefront/src/app/[locale]/account/quick-order/save-to-list-dialog.tsx +24 -26
  73. package/dist/assets/storefront/src/app/[locale]/account/quick-order/sku-autocomplete.tsx +19 -10
  74. package/dist/assets/storefront/src/app/[locale]/account/quick-order/text-input-tab.tsx +3 -8
  75. package/dist/assets/storefront/src/app/[locale]/account/quotes/[id]/page.tsx +86 -59
  76. package/dist/assets/storefront/src/app/[locale]/account/quotes/actions.ts +38 -45
  77. package/dist/assets/storefront/src/app/[locale]/account/quotes/new/new-quote-form.tsx +3 -5
  78. package/dist/assets/storefront/src/app/[locale]/account/quotes/new/page.tsx +6 -6
  79. package/dist/assets/storefront/src/app/[locale]/account/quotes/page.tsx +92 -59
  80. package/dist/assets/storefront/src/app/[locale]/account/shared-carts/[id]/add-item-search.tsx +11 -9
  81. package/dist/assets/storefront/src/app/[locale]/account/shared-carts/[id]/add-member-form.tsx +31 -15
  82. package/dist/assets/storefront/src/app/[locale]/account/shared-carts/[id]/members-panel.tsx +52 -33
  83. package/dist/assets/storefront/src/app/[locale]/account/shared-carts/[id]/page.tsx +22 -14
  84. package/dist/assets/storefront/src/app/[locale]/account/shared-carts/[id]/rename-dialog.tsx +34 -13
  85. package/dist/assets/storefront/src/app/[locale]/account/shared-carts/actions.ts +117 -72
  86. package/dist/assets/storefront/src/app/[locale]/account/shared-carts/new/new-shared-cart-form.tsx +21 -14
  87. package/dist/assets/storefront/src/app/[locale]/account/shared-carts/new/page.tsx +10 -10
  88. package/dist/assets/storefront/src/app/[locale]/account/shared-carts/page.tsx +54 -41
  89. package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/[id]/page.tsx +22 -8
  90. package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/[id]/shopping-list-detail-client.tsx +62 -49
  91. package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/actions.ts +9 -4
  92. package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/create-shopping-list-form.tsx +5 -11
  93. package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/loading.tsx +1 -1
  94. package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/page.tsx +32 -42
  95. package/dist/assets/storefront/src/app/[locale]/account/store-credits/actions.ts +8 -8
  96. package/dist/assets/storefront/src/app/[locale]/account/store-credits/claim-form.tsx +6 -10
  97. package/dist/assets/storefront/src/app/[locale]/account/store-credits/page.tsx +76 -55
  98. package/dist/assets/storefront/src/app/[locale]/account/store-credits/reveal-code.tsx +10 -6
  99. package/dist/assets/storefront/src/app/[locale]/account/verify-email/page.tsx +32 -39
  100. package/dist/assets/storefront/src/app/[locale]/cart/actions.ts +29 -23
  101. package/dist/assets/storefront/src/app/[locale]/cart/cart-items.tsx +111 -40
  102. package/dist/assets/storefront/src/app/[locale]/cart/cart-line-actions.tsx +9 -9
  103. package/dist/assets/storefront/src/app/[locale]/cart/cart-quantity-control.tsx +61 -48
  104. package/dist/assets/storefront/src/app/[locale]/cart/cart-remove-button.tsx +15 -9
  105. package/dist/assets/storefront/src/app/[locale]/cart/cart.tsx +38 -41
  106. package/dist/assets/storefront/src/app/[locale]/cart/code-input.tsx +8 -8
  107. package/dist/assets/storefront/src/app/[locale]/cart/order-summary.tsx +50 -32
  108. package/dist/assets/storefront/src/app/[locale]/cart/page.tsx +11 -11
  109. package/dist/assets/storefront/src/app/[locale]/cart/promotion-code.tsx +48 -42
  110. package/dist/assets/storefront/src/app/[locale]/cart/reapproval-confirm.tsx +22 -20
  111. package/dist/assets/storefront/src/app/[locale]/cart/request-quote-button.tsx +7 -16
  112. package/dist/assets/storefront/src/app/[locale]/checkout/actions.ts +39 -65
  113. package/dist/assets/storefront/src/app/[locale]/checkout/cancel-quote-checkout-button.tsx +5 -5
  114. package/dist/assets/storefront/src/app/[locale]/checkout/checkout-flow.tsx +202 -202
  115. package/dist/assets/storefront/src/app/[locale]/checkout/checkout-provider.tsx +142 -142
  116. package/dist/assets/storefront/src/app/[locale]/checkout/order-summary.tsx +158 -139
  117. package/dist/assets/storefront/src/app/[locale]/checkout/page.tsx +56 -47
  118. package/dist/assets/storefront/src/app/[locale]/checkout/steps/delivery-step.tsx +86 -88
  119. package/dist/assets/storefront/src/app/[locale]/checkout/steps/payment-step.tsx +90 -91
  120. package/dist/assets/storefront/src/app/[locale]/checkout/steps/review-step.tsx +166 -161
  121. package/dist/assets/storefront/src/app/[locale]/checkout/steps/shipping-address-step.tsx +573 -494
  122. package/dist/assets/storefront/src/app/[locale]/error.tsx +3 -5
  123. package/dist/assets/storefront/src/app/[locale]/forgot-password/actions.ts +10 -7
  124. package/dist/assets/storefront/src/app/[locale]/forgot-password/forgot-password-form.tsx +10 -25
  125. package/dist/assets/storefront/src/app/[locale]/forgot-password/page.tsx +5 -5
  126. package/dist/assets/storefront/src/app/[locale]/globals.css +48 -48
  127. package/dist/assets/storefront/src/app/[locale]/layout.tsx +53 -47
  128. package/dist/assets/storefront/src/app/[locale]/not-found.tsx +3 -5
  129. package/dist/assets/storefront/src/app/[locale]/order-confirmation/[code]/order-confirmation.tsx +71 -44
  130. package/dist/assets/storefront/src/app/[locale]/order-confirmation/[code]/page.tsx +7 -5
  131. package/dist/assets/storefront/src/app/[locale]/page.tsx +33 -35
  132. package/dist/assets/storefront/src/app/[locale]/register/actions.ts +7 -7
  133. package/dist/assets/storefront/src/app/[locale]/register/page.tsx +22 -16
  134. package/dist/assets/storefront/src/app/[locale]/register/registration-form.tsx +22 -34
  135. package/dist/assets/storefront/src/app/[locale]/register-company/actions.ts +15 -19
  136. package/dist/assets/storefront/src/app/[locale]/register-company/page.tsx +17 -15
  137. package/dist/assets/storefront/src/app/[locale]/register-company/registration-form.tsx +9 -15
  138. package/dist/assets/storefront/src/app/[locale]/reset-password/actions.ts +7 -8
  139. package/dist/assets/storefront/src/app/[locale]/reset-password/page.tsx +18 -12
  140. package/dist/assets/storefront/src/app/[locale]/reset-password/reset-password-form.tsx +8 -16
  141. package/dist/assets/storefront/src/app/[locale]/shopping-list/[code]/add-to-cart-button.tsx +10 -4
  142. package/dist/assets/storefront/src/app/[locale]/shopping-list/[code]/page.tsx +62 -30
  143. package/dist/assets/storefront/src/app/[locale]/sign-in/actions.ts +14 -16
  144. package/dist/assets/storefront/src/app/[locale]/sign-in/login-form.tsx +17 -30
  145. package/dist/assets/storefront/src/app/[locale]/sign-in/page.tsx +35 -30
  146. package/dist/assets/storefront/src/app/[locale]/verify/actions.ts +8 -8
  147. package/dist/assets/storefront/src/app/[locale]/verify/page.tsx +18 -14
  148. package/dist/assets/storefront/src/app/[locale]/verify/verify-content.tsx +25 -27
  149. package/dist/assets/storefront/src/app/[locale]/verify-pending/page.tsx +23 -23
  150. package/dist/assets/storefront/src/app/api/clear-company-context/route.ts +6 -3
  151. package/dist/assets/storefront/src/app/api/revalidate/route.ts +19 -28
  152. package/dist/assets/storefront/src/app/api/search-analytics/route.ts +1 -1
  153. package/dist/assets/storefront/src/components/commerce/account-nav-items.ts +43 -18
  154. package/dist/assets/storefront/src/components/commerce/account-sidebar.tsx +30 -22
  155. package/dist/assets/storefront/src/components/commerce/active-filters.tsx +1 -1
  156. package/dist/assets/storefront/src/components/commerce/add-to-shared-cart.tsx +49 -27
  157. package/dist/assets/storefront/src/components/commerce/approval-decision-form.tsx +9 -13
  158. package/dist/assets/storefront/src/components/commerce/approval-status-badge.tsx +23 -15
  159. package/dist/assets/storefront/src/components/commerce/business-unit-switcher.tsx +11 -11
  160. package/dist/assets/storefront/src/components/commerce/catalog-search-bar.tsx +2 -2
  161. package/dist/assets/storefront/src/components/commerce/category-product-section.tsx +28 -16
  162. package/dist/assets/storefront/src/components/commerce/category-sidebar.tsx +31 -18
  163. package/dist/assets/storefront/src/components/commerce/collection-hero-banner.tsx +2 -4
  164. package/dist/assets/storefront/src/components/commerce/company-state-badge.tsx +10 -16
  165. package/dist/assets/storefront/src/components/commerce/company-switcher.tsx +12 -12
  166. package/dist/assets/storefront/src/components/commerce/configurator-form.tsx +188 -79
  167. package/dist/assets/storefront/src/components/commerce/facet-filters.tsx +29 -49
  168. package/dist/assets/storefront/src/components/commerce/gift-card-pdp.tsx +4 -4
  169. package/dist/assets/storefront/src/components/commerce/gift-card-product-info.tsx +20 -30
  170. package/dist/assets/storefront/src/components/commerce/instant-search-dropdown.tsx +258 -227
  171. package/dist/assets/storefront/src/components/commerce/order-status-badge.tsx +27 -19
  172. package/dist/assets/storefront/src/components/commerce/packaging-unit-selector.tsx +27 -26
  173. package/dist/assets/storefront/src/components/commerce/permission-gate.tsx +4 -4
  174. package/dist/assets/storefront/src/components/commerce/price-range-filter.tsx +5 -5
  175. package/dist/assets/storefront/src/components/commerce/price-tiers.tsx +38 -21
  176. package/dist/assets/storefront/src/components/commerce/price.tsx +3 -3
  177. package/dist/assets/storefront/src/components/commerce/product-card-list.tsx +35 -14
  178. package/dist/assets/storefront/src/components/commerce/product-card.tsx +31 -16
  179. package/dist/assets/storefront/src/components/commerce/product-carousel.tsx +20 -12
  180. package/dist/assets/storefront/src/components/commerce/product-grid.tsx +14 -13
  181. package/dist/assets/storefront/src/components/commerce/product-image-carousel.tsx +10 -8
  182. package/dist/assets/storefront/src/components/commerce/product-info.tsx +118 -74
  183. package/dist/assets/storefront/src/components/commerce/product-list-expansion.tsx +102 -74
  184. package/dist/assets/storefront/src/components/commerce/product-list-view.tsx +1 -1
  185. package/dist/assets/storefront/src/components/commerce/product-sidebar.tsx +36 -11
  186. package/dist/assets/storefront/src/components/commerce/product-view-switcher.tsx +33 -21
  187. package/dist/assets/storefront/src/components/commerce/quote-action-buttons.tsx +54 -36
  188. package/dist/assets/storefront/src/components/commerce/quote-activity-timeline.tsx +126 -50
  189. package/dist/assets/storefront/src/components/commerce/quote-comment-form.tsx +9 -13
  190. package/dist/assets/storefront/src/components/commerce/quote-csv-export-button.tsx +6 -6
  191. package/dist/assets/storefront/src/components/commerce/quote-product-search.tsx +22 -18
  192. package/dist/assets/storefront/src/components/commerce/quote-request-form.tsx +28 -27
  193. package/dist/assets/storefront/src/components/commerce/quote-status-badge.tsx +26 -18
  194. package/dist/assets/storefront/src/components/commerce/quote-validity-indicator.tsx +7 -7
  195. package/dist/assets/storefront/src/components/commerce/quote-version-comparison.tsx +50 -30
  196. package/dist/assets/storefront/src/components/commerce/related-products.tsx +37 -28
  197. package/dist/assets/storefront/src/components/commerce/shared-cart-status-badge.tsx +12 -8
  198. package/dist/assets/storefront/src/components/commerce/shop-by-category.tsx +8 -7
  199. package/dist/assets/storefront/src/components/commerce/shopping-list-toggle.tsx +14 -20
  200. package/dist/assets/storefront/src/components/commerce/sort-dropdown.tsx +9 -16
  201. package/dist/assets/storefront/src/components/commerce/store-credit-summary.tsx +30 -32
  202. package/dist/assets/storefront/src/components/commerce/subcollection-tiles.tsx +11 -13
  203. package/dist/assets/storefront/src/components/layout/auth-page-shell.tsx +2 -2
  204. package/dist/assets/storefront/src/components/layout/draft-mode-indicator.tsx +2 -7
  205. package/dist/assets/storefront/src/components/layout/draft-mode-link.tsx +4 -2
  206. package/dist/assets/storefront/src/components/layout/footer.tsx +70 -28
  207. package/dist/assets/storefront/src/components/layout/navbar/actions.ts +9 -12
  208. package/dist/assets/storefront/src/components/layout/navbar/cart-icon.tsx +9 -9
  209. package/dist/assets/storefront/src/components/layout/navbar/channel-picker-wrapper.tsx +4 -9
  210. package/dist/assets/storefront/src/components/layout/navbar/channel-picker.tsx +13 -8
  211. package/dist/assets/storefront/src/components/layout/navbar/currency-picker-wrapper.tsx +4 -4
  212. package/dist/assets/storefront/src/components/layout/navbar/currency-picker.tsx +11 -6
  213. package/dist/assets/storefront/src/components/layout/navbar/language-picker.tsx +7 -7
  214. package/dist/assets/storefront/src/components/layout/navbar/login-button.tsx +24 -21
  215. package/dist/assets/storefront/src/components/layout/navbar/mobile-nav.tsx +8 -8
  216. package/dist/assets/storefront/src/components/layout/navbar/nav-menu-items.tsx +4 -6
  217. package/dist/assets/storefront/src/components/layout/navbar/navbar-cart.tsx +1 -1
  218. package/dist/assets/storefront/src/components/layout/navbar/navbar-collections.tsx +41 -42
  219. package/dist/assets/storefront/src/components/layout/navbar/navbar-link.tsx +7 -10
  220. package/dist/assets/storefront/src/components/layout/navbar/navbar-user.tsx +18 -23
  221. package/dist/assets/storefront/src/components/layout/navbar/theme-switcher.tsx +9 -9
  222. package/dist/assets/storefront/src/components/layout/navbar.tsx +36 -31
  223. package/dist/assets/storefront/src/components/layout/search-input.tsx +35 -32
  224. package/dist/assets/storefront/src/components/providers/awaiting-approval-banner.tsx +12 -10
  225. package/dist/assets/storefront/src/components/providers/cart-count-server.tsx +14 -12
  226. package/dist/assets/storefront/src/components/providers/company-context-guard.tsx +4 -4
  227. package/dist/assets/storefront/src/components/providers/company-permissions-server.tsx +2 -6
  228. package/dist/assets/storefront/src/components/providers/theme-provider.tsx +3 -3
  229. package/dist/assets/storefront/src/components/shared/breadcrumbs.tsx +4 -1
  230. package/dist/assets/storefront/src/components/shared/country-select.tsx +63 -67
  231. package/dist/assets/storefront/src/components/shared/pagination.tsx +15 -28
  232. package/dist/assets/storefront/src/components/shared/prefetch-link.tsx +1 -1
  233. package/dist/assets/storefront/src/components/shared/skeletons/search-input-skeleton.tsx +1 -3
  234. package/dist/assets/storefront/src/components/ui/accordion.tsx +46 -51
  235. package/dist/assets/storefront/src/components/ui/alert-dialog.tsx +94 -121
  236. package/dist/assets/storefront/src/components/ui/alert.tsx +48 -54
  237. package/dist/assets/storefront/src/components/ui/aspect-ratio.tsx +5 -7
  238. package/dist/assets/storefront/src/components/ui/avatar.tsx +29 -44
  239. package/dist/assets/storefront/src/components/ui/badge.tsx +28 -37
  240. package/dist/assets/storefront/src/components/ui/breadcrumb.tsx +82 -89
  241. package/dist/assets/storefront/src/components/ui/button.tsx +43 -49
  242. package/dist/assets/storefront/src/components/ui/calendar.tsx +157 -198
  243. package/dist/assets/storefront/src/components/ui/card.tsx +53 -76
  244. package/dist/assets/storefront/src/components/ui/carousel.tsx +194 -212
  245. package/dist/assets/storefront/src/components/ui/chart.tsx +274 -317
  246. package/dist/assets/storefront/src/components/ui/checkbox.tsx +24 -27
  247. package/dist/assets/storefront/src/components/ui/collapsible.tsx +9 -21
  248. package/dist/assets/storefront/src/components/ui/command.tsx +114 -159
  249. package/dist/assets/storefront/src/components/ui/context-menu.tsx +167 -199
  250. package/dist/assets/storefront/src/components/ui/dialog.tsx +97 -114
  251. package/dist/assets/storefront/src/components/ui/drawer.tsx +93 -107
  252. package/dist/assets/storefront/src/components/ui/dropdown-menu.tsx +171 -206
  253. package/dist/assets/storefront/src/components/ui/empty-state.tsx +5 -5
  254. package/dist/assets/storefront/src/components/ui/field.tsx +196 -208
  255. package/dist/assets/storefront/src/components/ui/form.tsx +115 -139
  256. package/dist/assets/storefront/src/components/ui/hover-card.tsx +27 -33
  257. package/dist/assets/storefront/src/components/ui/input-otp.tsx +50 -59
  258. package/dist/assets/storefront/src/components/ui/input.tsx +17 -17
  259. package/dist/assets/storefront/src/components/ui/kbd-shortcut.tsx +3 -1
  260. package/dist/assets/storefront/src/components/ui/label.tsx +16 -19
  261. package/dist/assets/storefront/src/components/ui/menubar.tsx +193 -223
  262. package/dist/assets/storefront/src/components/ui/navigation-menu.tsx +123 -130
  263. package/dist/assets/storefront/src/components/ui/pagination.tsx +87 -108
  264. package/dist/assets/storefront/src/components/ui/popover.tsx +29 -35
  265. package/dist/assets/storefront/src/components/ui/progress.tsx +19 -26
  266. package/dist/assets/storefront/src/components/ui/radio-group.tsx +32 -38
  267. package/dist/assets/storefront/src/components/ui/resizable.tsx +37 -42
  268. package/dist/assets/storefront/src/components/ui/scroll-area.tsx +41 -47
  269. package/dist/assets/storefront/src/components/ui/select.tsx +130 -152
  270. package/dist/assets/storefront/src/components/ui/separator.tsx +21 -21
  271. package/dist/assets/storefront/src/components/ui/sheet.tsx +90 -111
  272. package/dist/assets/storefront/src/components/ui/sidebar.tsx +611 -649
  273. package/dist/assets/storefront/src/components/ui/skeleton.tsx +10 -10
  274. package/dist/assets/storefront/src/components/ui/slider.tsx +50 -55
  275. package/dist/assets/storefront/src/components/ui/sonner.tsx +20 -20
  276. package/dist/assets/storefront/src/components/ui/switch.tsx +23 -26
  277. package/dist/assets/storefront/src/components/ui/table.tsx +65 -97
  278. package/dist/assets/storefront/src/components/ui/tabs.tsx +39 -55
  279. package/dist/assets/storefront/src/components/ui/textarea.tsx +14 -14
  280. package/dist/assets/storefront/src/components/ui/toggle-group.tsx +56 -62
  281. package/dist/assets/storefront/src/components/ui/toggle.tsx +37 -38
  282. package/dist/assets/storefront/src/components/ui/tooltip.tsx +38 -46
  283. package/dist/assets/storefront/src/config/scenario-meta.ts +2 -2
  284. package/dist/assets/storefront/src/config/scenario.ts +14 -16
  285. package/dist/assets/storefront/src/contexts/auth-context.tsx +5 -6
  286. package/dist/assets/storefront/src/graphql.ts +5 -5
  287. package/dist/assets/storefront/src/hooks/use-mobile.ts +13 -13
  288. package/dist/assets/storefront/src/i18n/locale-utils.ts +3 -3
  289. package/dist/assets/storefront/src/i18n/navigation.ts +4 -4
  290. package/dist/assets/storefront/src/i18n/request.ts +4 -4
  291. package/dist/assets/storefront/src/i18n/routing.ts +5 -5
  292. package/dist/assets/storefront/src/i18n/server.ts +3 -3
  293. package/dist/assets/storefront/src/lib/actions/switch-channel.ts +9 -9
  294. package/dist/assets/storefront/src/lib/actions/switch-currency.ts +7 -7
  295. package/dist/assets/storefront/src/lib/auth.ts +1 -1
  296. package/dist/assets/storefront/src/lib/backend-health.ts +3 -3
  297. package/dist/assets/storefront/src/lib/cart-count-context.tsx +10 -4
  298. package/dist/assets/storefront/src/lib/cart-guard-utils.ts +2 -1
  299. package/dist/assets/storefront/src/lib/cart-guard.ts +7 -6
  300. package/dist/assets/storefront/src/lib/channel-server.ts +4 -4
  301. package/dist/assets/storefront/src/lib/company-context.ts +1 -1
  302. package/dist/assets/storefront/src/lib/company-permissions-context.tsx +1 -5
  303. package/dist/assets/storefront/src/lib/currency-server.ts +4 -4
  304. package/dist/assets/storefront/src/lib/format.ts +16 -7
  305. package/dist/assets/storefront/src/lib/metadata.ts +39 -44
  306. package/dist/assets/storefront/src/lib/quantity.ts +2 -4
  307. package/dist/assets/storefront/src/lib/search-bar-context.tsx +7 -4
  308. package/dist/assets/storefront/src/lib/use-recent-searches.ts +8 -6
  309. package/dist/assets/storefront/src/lib/utils.ts +3 -3
  310. package/dist/assets/storefront/src/lib/vendure/actions.ts +18 -16
  311. package/dist/assets/storefront/src/lib/vendure/api.ts +36 -23
  312. package/dist/assets/storefront/src/lib/vendure/approval-utils.ts +9 -8
  313. package/dist/assets/storefront/src/lib/vendure/cached.ts +20 -15
  314. package/dist/assets/storefront/src/lib/vendure/queries.ts +15 -5
  315. package/dist/assets/storefront/src/middleware.ts +1 -1
  316. package/dist/assets/storefront/src/scenarios/customer/hero.tsx +2 -2
  317. package/dist/assets/storefront/src/scenarios/customer/meta.ts +1 -1
  318. package/dist/bin/run.js +1 -1
  319. package/dist/cli.d.ts +1 -1
  320. package/dist/index.d.ts +5 -5
  321. package/dist/index.js +1 -1
  322. package/dist/scaffold-storefront-only.js +1 -1
  323. package/dist/scaffolder.js +1 -1
  324. package/dist/template-renderer.js +1 -1
  325. package/package.json +2 -2
@@ -1,16 +1,16 @@
1
- import {client} from '@/lib/vendure/api';
2
- import {graphql} from '@/graphql';
3
- import {getLatestApprovalForOrder} from '@/lib/vendure/approval-utils';
4
- import {Button} from '@/components/ui/button';
5
- import {Card, CardContent, CardHeader, CardTitle} from '@/components/ui/card';
6
- import {CheckCircle2, Clock, XCircle, MessageSquare} from 'lucide-react';
7
- import {Link} from '@/i18n/navigation';
1
+ import { Price } from '@/components/commerce/price';
2
+ import { Button } from '@/components/ui/button';
3
+ import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
4
+ import { Separator } from '@/components/ui/separator';
5
+ import { graphql } from '@/graphql';
6
+ import { Link } from '@/i18n/navigation';
7
+ import { maskCode } from '@/lib/format';
8
+ import { client } from '@/lib/vendure/api';
9
+ import { getLatestApprovalForOrder } from '@/lib/vendure/approval-utils';
10
+ import { CheckCircle2, Clock, MessageSquare, XCircle } from 'lucide-react';
11
+ import { getTranslations } from 'next-intl/server';
8
12
  import Image from 'next/image';
9
- import {Separator} from '@/components/ui/separator';
10
- import {Price} from '@/components/commerce/price';
11
- import {maskCode} from '@/lib/format';
12
- import {notFound} from "next/navigation";
13
- import {getTranslations} from 'next-intl/server';
13
+ import { notFound } from 'next/navigation';
14
14
 
15
15
  const GetOrderByCodeQuery = graphql(`
16
16
  query GetOrderByCode($code: String!) {
@@ -70,17 +70,17 @@ const GetOrderByCodeQuery = graphql(`
70
70
  }
71
71
  `);
72
72
 
73
- export async function OrderConfirmation({params}: {params: Promise<{locale: string; code: string}>}) {
74
- const {code} = await params;
73
+ export async function OrderConfirmation({ params }: { params: Promise<{ locale: string; code: string }> }) {
74
+ const { code } = await params;
75
75
  const t = await getTranslations('OrderConfirmation');
76
- const [result, queryError] = await client.query(GetOrderByCodeQuery, {code});
76
+ const [result, queryError] = await client.query(GetOrderByCodeQuery, { code });
77
77
  if (queryError) {
78
78
  notFound();
79
79
  }
80
80
  const order = result.data.orderByCode;
81
81
 
82
82
  if (!order) {
83
- notFound();
83
+ notFound();
84
84
  }
85
85
 
86
86
  const taxTotal = order.totalWithTax - order.total;
@@ -99,10 +99,11 @@ export async function OrderConfirmation({params}: {params: Promise<{locale: stri
99
99
  <div className="text-center mb-8">
100
100
  {isRejected ? (
101
101
  <>
102
- <XCircle className="h-16 w-16 text-red-500 mx-auto mb-4"/>
102
+ <XCircle className="h-16 w-16 text-red-500 mx-auto mb-4" />
103
103
  <h1 className="text-3xl font-bold mb-2">Order Rejected</h1>
104
104
  <p className="text-muted-foreground">
105
- Your order <span className="font-semibold">{order.code}</span> was not approved.
105
+ Your order <span className="font-semibold">{order.code}</span> was not
106
+ approved.
106
107
  </p>
107
108
  <div className="mt-4 flex gap-3 justify-center">
108
109
  <Button variant="outline" asChild>
@@ -115,7 +116,7 @@ export async function OrderConfirmation({params}: {params: Promise<{locale: stri
115
116
  </>
116
117
  ) : isChangesRequested ? (
117
118
  <>
118
- <MessageSquare className="h-16 w-16 text-orange-500 mx-auto mb-4"/>
119
+ <MessageSquare className="h-16 w-16 text-orange-500 mx-auto mb-4" />
119
120
  <h1 className="text-3xl font-bold mb-2">Changes Requested</h1>
120
121
  <p className="text-muted-foreground">
121
122
  A reviewer has requested changes to your order{' '}
@@ -134,11 +135,12 @@ export async function OrderConfirmation({params}: {params: Promise<{locale: stri
134
135
  </>
135
136
  ) : isAwaitingApproval ? (
136
137
  <>
137
- <Clock className="h-16 w-16 text-amber-500 mx-auto mb-4"/>
138
+ <Clock className="h-16 w-16 text-amber-500 mx-auto mb-4" />
138
139
  <h1 className="text-3xl font-bold mb-2">Order Submitted for Approval</h1>
139
140
  <p className="text-muted-foreground">
140
141
  Your order <span className="font-semibold">{order.code}</span> has been
141
- submitted and is awaiting approval. You&apos;ll be notified once a decision is made.
142
+ submitted and is awaiting approval. You&apos;ll be notified once a decision is
143
+ made.
142
144
  </p>
143
145
  <div className="mt-4">
144
146
  <Button variant="outline" asChild>
@@ -148,11 +150,10 @@ export async function OrderConfirmation({params}: {params: Promise<{locale: stri
148
150
  </>
149
151
  ) : (
150
152
  <>
151
- <CheckCircle2 className="h-16 w-16 text-green-500 mx-auto mb-4"/>
153
+ <CheckCircle2 className="h-16 w-16 text-green-500 mx-auto mb-4" />
152
154
  <h1 className="text-3xl font-bold mb-2">{t('orderConfirmed')}</h1>
153
155
  <p className="text-muted-foreground">
154
- {t('thankYou')}{' '}
155
- <span className="font-semibold">{order.code}</span>
156
+ {t('thankYou')} <span className="font-semibold">{order.code}</span>
156
157
  </p>
157
158
  </>
158
159
  )}
@@ -190,44 +191,58 @@ export async function OrderConfirmation({params}: {params: Promise<{locale: stri
190
191
  </div>
191
192
  <div className="text-right w-24">
192
193
  <p className="font-semibold">
193
- <Price value={line.linePrice} currencyCode={order.currencyCode}/>
194
+ <Price value={line.linePrice} currencyCode={order.currencyCode} />
194
195
  </p>
195
196
  </div>
196
197
  </div>
197
198
  ))}
198
199
 
199
- <Separator/>
200
+ <Separator />
200
201
 
201
202
  <div className="space-y-2">
202
203
  <div className="flex justify-between text-sm">
203
- <span className="text-muted-foreground">Subtotal <span className="text-[10px]">(excl. tax)</span></span>
204
+ <span className="text-muted-foreground">
205
+ Subtotal <span className="text-[10px]">(excl. tax)</span>
206
+ </span>
204
207
  <span>
205
- <Price value={order.subTotal} currencyCode={order.currencyCode}/>
208
+ <Price value={order.subTotal} currencyCode={order.currencyCode} />
206
209
  </span>
207
210
  </div>
208
211
  <div className="flex justify-between text-sm">
209
212
  <span className="text-muted-foreground">Shipping</span>
210
213
  <span>
211
- {order.shipping > 0
212
- ? <Price value={order.shipping} currencyCode={order.currencyCode}/>
213
- : 'FREE'}
214
+ {order.shipping > 0 ? (
215
+ <Price value={order.shipping} currencyCode={order.currencyCode} />
216
+ ) : (
217
+ 'FREE'
218
+ )}
214
219
  </span>
215
220
  </div>
216
221
  <div className="flex justify-between text-sm">
217
222
  <span className="text-muted-foreground">Tax</span>
218
223
  <span>
219
- <Price value={taxTotal} currencyCode={order.currencyCode}/>
224
+ <Price value={taxTotal} currencyCode={order.currencyCode} />
220
225
  </span>
221
226
  </div>
222
- {hasCreditsApplied && order.storeCreditsApplied.map((credit) => (
223
- <div key={credit.code} className="flex justify-between text-sm text-green-600">
224
- <span>Store Credit ({maskCode(credit.code)})</span>
225
- <span>-<Price value={credit.amountDeducted} currencyCode={order.currencyCode}/></span>
226
- </div>
227
- ))}
227
+ {hasCreditsApplied &&
228
+ order.storeCreditsApplied.map((credit) => (
229
+ <div
230
+ key={credit.code}
231
+ className="flex justify-between text-sm text-green-600"
232
+ >
233
+ <span>Store Credit ({maskCode(credit.code)})</span>
234
+ <span>
235
+ -
236
+ <Price
237
+ value={credit.amountDeducted}
238
+ currencyCode={order.currencyCode}
239
+ />
240
+ </span>
241
+ </div>
242
+ ))}
228
243
  </div>
229
244
 
230
- <Separator/>
245
+ <Separator />
231
246
 
232
247
  <div>
233
248
  <div className="flex justify-between font-bold text-lg">
@@ -236,12 +251,23 @@ export async function OrderConfirmation({params}: {params: Promise<{locale: stri
236
251
  {hasCreditsApplied ? (
237
252
  <span className="flex items-center gap-2">
238
253
  <span className="text-sm font-normal text-muted-foreground line-through">
239
- <Price value={order.totalWithTax} currencyCode={order.currencyCode}/>
254
+ <Price
255
+ value={order.totalWithTax}
256
+ currencyCode={order.currencyCode}
257
+ />
240
258
  </span>
241
- <Price value={order.totalWithTaxAfterStoreCredit} currencyCode={order.currencyCode} taxLabel="incl" />
259
+ <Price
260
+ value={order.totalWithTaxAfterStoreCredit}
261
+ currencyCode={order.currencyCode}
262
+ taxLabel="incl"
263
+ />
242
264
  </span>
243
265
  ) : (
244
- <Price value={order.totalWithTax} currencyCode={order.currencyCode} taxLabel="incl" />
266
+ <Price
267
+ value={order.totalWithTax}
268
+ currencyCode={order.currencyCode}
269
+ taxLabel="incl"
270
+ />
245
271
  )}
246
272
  </span>
247
273
  </div>
@@ -258,7 +284,7 @@ export async function OrderConfirmation({params}: {params: Promise<{locale: stri
258
284
  {order.payments.map((payment) => (
259
285
  <div key={payment.id} className="flex justify-between text-sm">
260
286
  <span className="text-muted-foreground capitalize">{payment.method}</span>
261
- <Price value={payment.amount} currencyCode={order.currencyCode}/>
287
+ <Price value={payment.amount} currencyCode={order.currencyCode} />
262
288
  </div>
263
289
  ))}
264
290
  </CardContent>
@@ -274,7 +300,8 @@ export async function OrderConfirmation({params}: {params: Promise<{locale: stri
274
300
  <p className="font-medium">{order.shippingAddress.fullName}</p>
275
301
  <p className="text-sm text-muted-foreground mt-1">
276
302
  {order.shippingAddress.streetLine1}
277
- {order.shippingAddress.streetLine2 && `, ${order.shippingAddress.streetLine2}`}
303
+ {order.shippingAddress.streetLine2 &&
304
+ `, ${order.shippingAddress.streetLine2}`}
278
305
  </p>
279
306
  <p className="text-sm text-muted-foreground">
280
307
  {order.shippingAddress.city}, {order.shippingAddress.province}{' '}
@@ -1,7 +1,7 @@
1
- import type {Metadata} from 'next';
2
- import {Suspense} from 'react';
3
- import {OrderConfirmation} from './order-confirmation';
4
- import {noIndexRobots} from '@/lib/metadata';
1
+ import { noIndexRobots } from '@/lib/metadata';
2
+ import type { Metadata } from 'next';
3
+ import { Suspense } from 'react';
4
+ import { OrderConfirmation } from './order-confirmation';
5
5
 
6
6
  export const metadata: Metadata = {
7
7
  title: 'Order Confirmation',
@@ -9,7 +9,9 @@ export const metadata: Metadata = {
9
9
  robots: noIndexRobots(),
10
10
  };
11
11
 
12
- export default async function OrderConfirmationPage(props: {params: Promise<{locale: string; code: string}>}) {
12
+ export default async function OrderConfirmationPage(props: {
13
+ params: Promise<{ locale: string; code: string }>;
14
+ }) {
13
15
  return (
14
16
  <Suspense fallback={<div className="container mx-auto px-4 py-16 text-center">Loading...</div>}>
15
17
  <OrderConfirmation {...props} />
@@ -1,17 +1,17 @@
1
- import type { Metadata } from 'next';
2
- import { Suspense } from 'react';
3
- import { SITE_NAME, SITE_URL, buildCanonicalUrl } from '@/lib/metadata';
4
- import { getTopCollections } from '@/lib/vendure/cached';
5
- import { getActiveChannelToken } from '@/lib/channel-server';
6
- import { setRequestLocale } from 'next-intl/server';
7
1
  import { CatalogSearchBar } from '@/components/commerce/catalog-search-bar';
8
- import { CategorySidebar } from '@/components/commerce/category-sidebar';
9
2
  import { CategoryProductSection } from '@/components/commerce/category-product-section';
3
+ import { CategorySidebar } from '@/components/commerce/category-sidebar';
10
4
  import { ShopByCategory } from '@/components/commerce/shop-by-category';
11
5
  import { CatalogSidebarSkeleton } from '@/components/shared/catalog-sidebar-skeleton';
12
6
  import { getBranding } from '@/config/branding';
7
+ import type { HomeSlotOverrides, ServerComponent } from '@/config/scenario';
13
8
  import { getScenarioConfig, isFullPageOverride } from '@/config/scenario';
14
- import type { ServerComponent, HomeSlotOverrides } from '@/config/scenario';
9
+ import { getActiveChannelToken } from '@/lib/channel-server';
10
+ import { SITE_NAME, SITE_URL, buildCanonicalUrl } from '@/lib/metadata';
11
+ import { getTopCollections } from '@/lib/vendure/cached';
12
+ import type { Metadata } from 'next';
13
+ import { setRequestLocale } from 'next-intl/server';
14
+ import { Suspense } from 'react';
15
15
 
16
16
  const _branding = getBranding();
17
17
 
@@ -55,8 +55,8 @@ function CategorySectionSkeleton() {
55
55
  );
56
56
  }
57
57
 
58
- export default async function Home({params}: {params: Promise<{locale: string}>}) {
59
- const {locale} = await params;
58
+ export default async function Home({ params }: { params: Promise<{ locale: string }> }) {
59
+ const { locale } = await params;
60
60
  setRequestLocale(locale);
61
61
  const channelToken = await getActiveChannelToken();
62
62
  const collections = await getTopCollections(locale, channelToken);
@@ -76,9 +76,7 @@ export default async function Home({params}: {params: Promise<{locale: string}>}
76
76
  // collection carries a featuredAsset — avoids mixed rows of real imagery
77
77
  // and fallback icons during partial populate (see EE-73 plan concern #11).
78
78
  const showBaseShopByCategory =
79
- !ShopByCategoryComponent &&
80
- collections.length > 0 &&
81
- collections.every((c) => !!c.featuredAsset);
79
+ !ShopByCategoryComponent && collections.length > 0 && collections.every((c) => !!c.featuredAsset);
82
80
 
83
81
  return (
84
82
  // No wrapper padding-top here — the hero is full-bleed and absorbs
@@ -95,31 +93,31 @@ export default async function Home({params}: {params: Promise<{locale: string}>}
95
93
  </section>
96
94
  ) : null}
97
95
  <div className="container mx-auto px-4 pt-8">
98
- <div className="grid grid-cols-1 lg:grid-cols-4 gap-8 pb-8">
99
- <aside className="lg:col-span-1">
100
- <Suspense fallback={<CatalogSidebarSkeleton />}>
101
- <CategorySidebar collections={collections} />
102
- </Suspense>
103
- </aside>
104
- <div className="lg:col-span-3">
105
- <Suspense>
106
- <CatalogSearchBar />
107
- </Suspense>
108
- <div className="mt-6 space-y-12">
109
- {collections.map((collection) => (
110
- <Suspense key={collection.id} fallback={<CategorySectionSkeleton />}>
111
- <CategoryProductSection
112
- name={collection.name}
113
- slug={collection.slug}
114
- locale={locale}
115
- channelToken={channelToken}
116
- />
117
- </Suspense>
118
- ))}
96
+ <div className="grid grid-cols-1 lg:grid-cols-4 gap-8 pb-8">
97
+ <aside className="lg:col-span-1">
98
+ <Suspense fallback={<CatalogSidebarSkeleton />}>
99
+ <CategorySidebar collections={collections} />
100
+ </Suspense>
101
+ </aside>
102
+ <div className="lg:col-span-3">
103
+ <Suspense>
104
+ <CatalogSearchBar />
105
+ </Suspense>
106
+ <div className="mt-6 space-y-12">
107
+ {collections.map((collection) => (
108
+ <Suspense key={collection.id} fallback={<CategorySectionSkeleton />}>
109
+ <CategoryProductSection
110
+ name={collection.name}
111
+ slug={collection.slug}
112
+ locale={locale}
113
+ channelToken={channelToken}
114
+ />
115
+ </Suspense>
116
+ ))}
117
+ </div>
119
118
  </div>
120
119
  </div>
121
120
  </div>
122
- </div>
123
121
  </div>
124
122
  );
125
123
  }
@@ -1,9 +1,9 @@
1
1
  'use server';
2
2
 
3
- import {client} from '@/lib/vendure/api';
4
- import {RegisterCustomerAccountMutation} from '@/lib/vendure/mutations';
5
- import {cookies} from 'next/headers';
6
- import {redirect} from '@/i18n/navigation';
3
+ import { redirect } from '@/i18n/navigation';
4
+ import { client } from '@/lib/vendure/api';
5
+ import { RegisterCustomerAccountMutation } from '@/lib/vendure/mutations';
6
+ import { cookies } from 'next/headers';
7
7
 
8
8
  export async function registerAction(prevState: { error?: string } | undefined, formData: FormData) {
9
9
  const emailAddress = formData.get('emailAddress') as string;
@@ -14,7 +14,7 @@ export async function registerAction(prevState: { error?: string } | undefined,
14
14
  const redirectTo = formData.get('redirectTo') as string | null;
15
15
 
16
16
  if (!emailAddress || !password) {
17
- return {error: 'Email address and password are required'};
17
+ return { error: 'Email address and password are required' };
18
18
  }
19
19
 
20
20
  const [result, error] = await client.mutate(RegisterCustomerAccountMutation, {
@@ -24,14 +24,14 @@ export async function registerAction(prevState: { error?: string } | undefined,
24
24
  lastName: lastName || undefined,
25
25
  phoneNumber: phoneNumber || undefined,
26
26
  password,
27
- }
27
+ },
28
28
  });
29
29
  if (error) throw error;
30
30
 
31
31
  const registerResult = result.data.registerCustomerAccount;
32
32
 
33
33
  if (registerResult.__typename !== 'Success') {
34
- return {error: registerResult.message};
34
+ return { error: registerResult.message };
35
35
  }
36
36
 
37
37
  // Two mechanisms preserve redirectTo through the email verification round-trip:
@@ -1,16 +1,16 @@
1
- import type {Metadata} from 'next';
2
- import {Suspense} from 'react';
3
- import {getTranslations} from 'next-intl/server';
4
- import {locale as rootLocale} from 'next/root-params';
5
- import {type Locale} from '@/i18n/routing';
6
- import { RegistrationForm } from "./registration-form";
7
- import { Card, CardContent, CardFooter } from "@/components/ui/card";
8
- import { Skeleton } from "@/components/ui/skeleton";
9
- import { AuthPageShell } from "@/components/layout/auth-page-shell";
1
+ import { AuthPageShell } from '@/components/layout/auth-page-shell';
2
+ import { Card, CardContent, CardFooter } from '@/components/ui/card';
3
+ import { Skeleton } from '@/components/ui/skeleton';
4
+ import { type Locale } from '@/i18n/routing';
5
+ import type { Metadata } from 'next';
6
+ import { getTranslations } from 'next-intl/server';
7
+ import { locale as rootLocale } from 'next/root-params';
8
+ import { Suspense } from 'react';
9
+ import { RegistrationForm } from './registration-form';
10
10
 
11
11
  export async function generateMetadata(): Promise<Metadata> {
12
12
  const locale = (await rootLocale()) as Locale;
13
- const t = await getTranslations({locale, namespace: 'Auth'});
13
+ const t = await getTranslations({ locale, namespace: 'Auth' });
14
14
  return {
15
15
  title: t('createAccount'),
16
16
  description: t('joinUs'),
@@ -56,23 +56,29 @@ function RegistrationFormSkeleton() {
56
56
  );
57
57
  }
58
58
 
59
- async function RegisterContent({searchParams}: {searchParams: Promise<Record<string, string | string[] | undefined>>}) {
59
+ async function RegisterContent({
60
+ searchParams,
61
+ }: {
62
+ searchParams: Promise<Record<string, string | string[] | undefined>>;
63
+ }) {
60
64
  const resolvedParams = await searchParams;
61
65
  const redirectTo = resolvedParams?.redirectTo as string | undefined;
62
66
 
63
67
  return <RegistrationForm redirectTo={redirectTo} />;
64
68
  }
65
69
 
66
- export default async function RegisterPage({searchParams}: {searchParams: Promise<Record<string, string | string[] | undefined>>}) {
70
+ export default async function RegisterPage({
71
+ searchParams,
72
+ }: {
73
+ searchParams: Promise<Record<string, string | string[] | undefined>>;
74
+ }) {
67
75
  const locale = (await rootLocale()) as Locale;
68
- const t = await getTranslations({locale, namespace: 'Auth'});
76
+ const t = await getTranslations({ locale, namespace: 'Auth' });
69
77
  return (
70
78
  <AuthPageShell>
71
79
  <div className="space-y-2 text-center">
72
80
  <h1 className="text-3xl font-bold">{t('createAccount')}</h1>
73
- <p className="text-muted-foreground">
74
- {t('signUpMessage')}
75
- </p>
81
+ <p className="text-muted-foreground">{t('signUpMessage')}</p>
76
82
  </div>
77
83
  <Suspense fallback={<RegistrationFormSkeleton />}>
78
84
  <RegisterContent searchParams={searchParams} />
@@ -1,37 +1,32 @@
1
1
  'use client';
2
2
 
3
+ import { Button } from '@/components/ui/button';
4
+ import { Card, CardContent, CardFooter } from '@/components/ui/card';
5
+ import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from '@/components/ui/form';
6
+ import { Input } from '@/components/ui/input';
7
+ import { Link } from '@/i18n/navigation';
8
+ import { zodResolver } from '@hookform/resolvers/zod';
9
+ import { useTranslations } from 'next-intl';
3
10
  import { useState, useTransition } from 'react';
4
11
  import { useForm } from 'react-hook-form';
5
- import { zodResolver } from '@hookform/resolvers/zod';
6
12
  import * as z from 'zod';
7
- import { useTranslations } from 'next-intl';
8
13
  import { registerAction } from './actions';
9
- import { Button } from '@/components/ui/button';
10
- import { Input } from '@/components/ui/input';
11
- import { Card, CardContent, CardFooter } from '@/components/ui/card';
12
- import {
13
- Form,
14
- FormControl,
15
- FormField,
16
- FormItem,
17
- FormLabel,
18
- FormMessage,
19
- } from '@/components/ui/form';
20
- import {Link} from '@/i18n/navigation';
21
14
 
22
15
  function useRegistrationSchema() {
23
16
  const t = useTranslations('Auth');
24
- return z.object({
25
- emailAddress: z.string().email('Please enter a valid email address'),
26
- firstName: z.string().optional(),
27
- lastName: z.string().optional(),
28
- phoneNumber: z.string().optional(),
29
- password: z.string().min(8, t('passwordMinLength')),
30
- confirmPassword: z.string(),
31
- }).refine((data) => data.password === data.confirmPassword, {
32
- message: t('passwordsMismatch'),
33
- path: ["confirmPassword"],
34
- });
17
+ return z
18
+ .object({
19
+ emailAddress: z.string().email('Please enter a valid email address'),
20
+ firstName: z.string().optional(),
21
+ lastName: z.string().optional(),
22
+ phoneNumber: z.string().optional(),
23
+ password: z.string().min(8, t('passwordMinLength')),
24
+ confirmPassword: z.string(),
25
+ })
26
+ .refine((data) => data.password === data.confirmPassword, {
27
+ message: t('passwordsMismatch'),
28
+ path: ['confirmPassword'],
29
+ });
35
30
  }
36
31
 
37
32
  type RegistrationFormData = {
@@ -86,9 +81,7 @@ export function RegistrationForm({ redirectTo }: RegistrationFormProps) {
86
81
  });
87
82
  };
88
83
 
89
- const signInHref = redirectTo
90
- ? `/sign-in?redirectTo=${encodeURIComponent(redirectTo)}`
91
- : '/sign-in';
84
+ const signInHref = redirectTo ? `/sign-in?redirectTo=${encodeURIComponent(redirectTo)}` : '/sign-in';
92
85
 
93
86
  return (
94
87
  <Card>
@@ -211,18 +204,13 @@ export function RegistrationForm({ redirectTo }: RegistrationFormProps) {
211
204
  )}
212
205
  />
213
206
 
214
- {serverError && (
215
- <div className="text-sm text-destructive">
216
- {serverError}
217
- </div>
218
- )}
207
+ {serverError && <div className="text-sm text-destructive">{serverError}</div>}
219
208
 
220
209
  <Button type="submit" className="w-full" disabled={isPending}>
221
210
  {isPending ? t('creatingAccount') : t('createAccount')}
222
211
  </Button>
223
212
  </CardContent>
224
213
  <CardFooter className="flex flex-col space-y-4 mt-4">
225
-
226
214
  <div className="text-sm text-center text-muted-foreground">
227
215
  {t('alreadyHaveAccount')}{' '}
228
216
  <Link href={signInHref} className="hover:text-primary underline">
@@ -1,35 +1,31 @@
1
1
  'use server';
2
2
 
3
- import {readFragment} from '@/graphql';
4
- import {client} from '@/lib/vendure/api';
5
- import {RegisterCompanyMutation} from '@/lib/vendure/mutations';
6
- import {CompanyFragment} from '@/lib/vendure/fragments';
7
- import {setCompanyId} from '@/lib/company-context';
8
- import {redirect} from '@/i18n/navigation';
9
- import {revalidatePath} from 'next/cache';
10
-
11
- export async function registerCompanyAction(
12
- prevState: { error?: string } | undefined,
13
- formData: FormData,
14
- ) {
3
+ import { readFragment } from '@/graphql';
4
+ import { redirect } from '@/i18n/navigation';
5
+ import { setCompanyId } from '@/lib/company-context';
6
+ import { client } from '@/lib/vendure/api';
7
+ import { CompanyFragment } from '@/lib/vendure/fragments';
8
+ import { RegisterCompanyMutation } from '@/lib/vendure/mutations';
9
+ import { revalidatePath } from 'next/cache';
10
+
11
+ export async function registerCompanyAction(prevState: { error?: string } | undefined, formData: FormData) {
15
12
  const companyName = formData.get('companyName') as string;
16
13
 
17
14
  if (!companyName?.trim()) {
18
- return {error: 'Company name is required'};
15
+ return { error: 'Company name is required' };
19
16
  }
20
17
 
21
- const [result, error] = await client.mutate(
22
- RegisterCompanyMutation,
23
- {input: {companyName: companyName.trim()}},
24
- );
18
+ const [result, error] = await client.mutate(RegisterCompanyMutation, {
19
+ input: { companyName: companyName.trim() },
20
+ });
25
21
 
26
22
  if (error) {
27
- return {error: 'An unexpected error occurred. Please try again.'};
23
+ return { error: 'An unexpected error occurred. Please try again.' };
28
24
  }
29
25
 
30
26
  const companyAccount = result.data.registerCompany;
31
27
  if (!companyAccount?.company) {
32
- return {error: 'Failed to register company'};
28
+ return { error: 'Failed to register company' };
33
29
  }
34
30
 
35
31
  const company = readFragment(CompanyFragment, companyAccount.company);
@@ -1,16 +1,16 @@
1
- import type {Metadata} from 'next';
2
- import {Suspense} from 'react';
3
- import {redirect} from '@/i18n/navigation';
4
- import {getTranslations} from 'next-intl/server';
5
- import {locale as rootLocale} from 'next/root-params';
6
- import {type Locale} from '@/i18n/routing';
7
- import {getActiveCustomer} from '@/lib/vendure/actions';
8
- import {AuthPageShell} from '@/components/layout/auth-page-shell';
9
- import {RegistrationForm} from './registration-form';
1
+ import { AuthPageShell } from '@/components/layout/auth-page-shell';
2
+ import { redirect } from '@/i18n/navigation';
3
+ import { type Locale } from '@/i18n/routing';
4
+ import { getActiveCustomer } from '@/lib/vendure/actions';
5
+ import type { Metadata } from 'next';
6
+ import { getTranslations } from 'next-intl/server';
7
+ import { locale as rootLocale } from 'next/root-params';
8
+ import { Suspense } from 'react';
9
+ import { RegistrationForm } from './registration-form';
10
10
 
11
11
  export async function generateMetadata(): Promise<Metadata> {
12
12
  const locale = (await rootLocale()) as Locale;
13
- const t = await getTranslations({locale, namespace: 'RegisterCompany'});
13
+ const t = await getTranslations({ locale, namespace: 'RegisterCompany' });
14
14
  return {
15
15
  title: t('cardTitle'),
16
16
  };
@@ -32,11 +32,13 @@ async function RegisterCompanyContent() {
32
32
 
33
33
  export default function RegisterCompanyPage() {
34
34
  return (
35
- <Suspense fallback={
36
- <AuthPageShell>
37
- <p className="text-sm text-muted-foreground">Loading...</p>
38
- </AuthPageShell>
39
- }>
35
+ <Suspense
36
+ fallback={
37
+ <AuthPageShell>
38
+ <p className="text-sm text-muted-foreground">Loading...</p>
39
+ </AuthPageShell>
40
+ }
41
+ >
40
42
  <RegisterCompanyContent />
41
43
  </Suspense>
42
44
  );