@vendure-platform/create 0.4.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 (334) hide show
  1. package/CHANGELOG.md +8 -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/messages/de.json +2 -0
  9. package/dist/assets/storefront/messages/en.json +2 -0
  10. package/dist/assets/storefront/next.config.ts +5 -4
  11. package/dist/assets/storefront/package.json +1 -1
  12. package/dist/assets/storefront/postcss.config.mjs +1 -1
  13. package/dist/assets/storefront/src/app/[locale]/(catalog)/catalog/page.tsx +17 -21
  14. package/dist/assets/storefront/src/app/[locale]/(catalog)/collection/[slug]/page.tsx +64 -42
  15. package/dist/assets/storefront/src/app/[locale]/(catalog)/layout.tsx +1 -5
  16. package/dist/assets/storefront/src/app/[locale]/(catalog)/product/[slug]/actions.ts +69 -65
  17. package/dist/assets/storefront/src/app/[locale]/(catalog)/product/[slug]/page.tsx +68 -37
  18. package/dist/assets/storefront/src/app/[locale]/(catalog)/search/page.tsx +24 -27
  19. package/dist/assets/storefront/src/app/[locale]/(catalog)/search/search-results.tsx +11 -9
  20. package/dist/assets/storefront/src/app/[locale]/(catalog)/search/search-term.tsx +4 -4
  21. package/dist/assets/storefront/src/app/[locale]/(scenario)/[...path]/page.tsx +1 -1
  22. package/dist/assets/storefront/src/app/[locale]/accept-invitation/[token]/accept-invitation-client.tsx +8 -13
  23. package/dist/assets/storefront/src/app/[locale]/accept-invitation/[token]/actions.ts +11 -14
  24. package/dist/assets/storefront/src/app/[locale]/accept-invitation/[token]/page.tsx +30 -33
  25. package/dist/assets/storefront/src/app/[locale]/accept-invitation/[token]/sign-out-and-retry.tsx +6 -6
  26. package/dist/assets/storefront/src/app/[locale]/account/addresses/actions.ts +30 -45
  27. package/dist/assets/storefront/src/app/[locale]/account/addresses/address-form.tsx +166 -159
  28. package/dist/assets/storefront/src/app/[locale]/account/addresses/addresses-client.tsx +35 -26
  29. package/dist/assets/storefront/src/app/[locale]/account/addresses/loading.tsx +1 -3
  30. package/dist/assets/storefront/src/app/[locale]/account/addresses/page.tsx +16 -18
  31. package/dist/assets/storefront/src/app/[locale]/account/approvals/actions.ts +5 -8
  32. package/dist/assets/storefront/src/app/[locale]/account/approvals/page.tsx +77 -69
  33. package/dist/assets/storefront/src/app/[locale]/account/company/actions.ts +10 -11
  34. package/dist/assets/storefront/src/app/[locale]/account/company/addresses/actions.ts +6 -15
  35. package/dist/assets/storefront/src/app/[locale]/account/company/addresses/address-form.tsx +57 -49
  36. package/dist/assets/storefront/src/app/[locale]/account/company/addresses/addresses-client.tsx +23 -25
  37. package/dist/assets/storefront/src/app/[locale]/account/company/addresses/page.tsx +30 -30
  38. package/dist/assets/storefront/src/app/[locale]/account/company/business-units/actions.ts +20 -29
  39. package/dist/assets/storefront/src/app/[locale]/account/company/business-units/business-unit-form.tsx +32 -37
  40. package/dist/assets/storefront/src/app/[locale]/account/company/business-units/business-units-client.tsx +32 -25
  41. package/dist/assets/storefront/src/app/[locale]/account/company/business-units/page.tsx +24 -24
  42. package/dist/assets/storefront/src/app/[locale]/account/company/business-units/types.ts +7 -4
  43. package/dist/assets/storefront/src/app/[locale]/account/company/edit-company-form.tsx +11 -21
  44. package/dist/assets/storefront/src/app/[locale]/account/company/page.tsx +23 -28
  45. package/dist/assets/storefront/src/app/[locale]/account/company/payment-methods/page.tsx +24 -24
  46. package/dist/assets/storefront/src/app/[locale]/account/company/payment-methods/payment-methods-client.tsx +5 -7
  47. package/dist/assets/storefront/src/app/[locale]/account/company/roles/page.tsx +22 -25
  48. package/dist/assets/storefront/src/app/[locale]/account/company/roles/roles-client.tsx +11 -26
  49. package/dist/assets/storefront/src/app/[locale]/account/company/tax-ids/actions.ts +6 -10
  50. package/dist/assets/storefront/src/app/[locale]/account/company/tax-ids/page.tsx +18 -16
  51. package/dist/assets/storefront/src/app/[locale]/account/company/tax-ids/tax-ids-client.tsx +74 -67
  52. package/dist/assets/storefront/src/app/[locale]/account/company/users/actions.ts +16 -25
  53. package/dist/assets/storefront/src/app/[locale]/account/company/users/edit-user-form.tsx +27 -25
  54. package/dist/assets/storefront/src/app/[locale]/account/company/users/invite-user-form.tsx +27 -19
  55. package/dist/assets/storefront/src/app/[locale]/account/company/users/page.tsx +32 -29
  56. package/dist/assets/storefront/src/app/[locale]/account/company/users/users-client.tsx +35 -38
  57. package/dist/assets/storefront/src/app/[locale]/account/error.tsx +1 -3
  58. package/dist/assets/storefront/src/app/[locale]/account/layout.tsx +16 -22
  59. package/dist/assets/storefront/src/app/[locale]/account/orders/[code]/page.tsx +151 -103
  60. package/dist/assets/storefront/src/app/[locale]/account/orders/[code]/reorder-actions.ts +6 -7
  61. package/dist/assets/storefront/src/app/[locale]/account/orders/[code]/reorder-dialog.tsx +22 -48
  62. package/dist/assets/storefront/src/app/[locale]/account/orders/loading.tsx +8 -8
  63. package/dist/assets/storefront/src/app/[locale]/account/orders/page.tsx +101 -61
  64. package/dist/assets/storefront/src/app/[locale]/account/profile/actions.ts +32 -23
  65. package/dist/assets/storefront/src/app/[locale]/account/profile/change-password-form.tsx +6 -16
  66. package/dist/assets/storefront/src/app/[locale]/account/profile/edit-email-form.tsx +7 -17
  67. package/dist/assets/storefront/src/app/[locale]/account/profile/edit-profile-form.tsx +6 -16
  68. package/dist/assets/storefront/src/app/[locale]/account/profile/loading.tsx +12 -18
  69. package/dist/assets/storefront/src/app/[locale]/account/profile/page.tsx +15 -15
  70. package/dist/assets/storefront/src/app/[locale]/account/quick-order/file-upload-tab.tsx +2 -6
  71. package/dist/assets/storefront/src/app/[locale]/account/quick-order/manual-entry-tab.tsx +18 -15
  72. package/dist/assets/storefront/src/app/[locale]/account/quick-order/page.tsx +3 -6
  73. package/dist/assets/storefront/src/app/[locale]/account/quick-order/preview-table.tsx +10 -2
  74. package/dist/assets/storefront/src/app/[locale]/account/quick-order/save-to-list-dialog.tsx +24 -26
  75. package/dist/assets/storefront/src/app/[locale]/account/quick-order/sku-autocomplete.tsx +19 -10
  76. package/dist/assets/storefront/src/app/[locale]/account/quick-order/text-input-tab.tsx +3 -8
  77. package/dist/assets/storefront/src/app/[locale]/account/quotes/[id]/page.tsx +86 -59
  78. package/dist/assets/storefront/src/app/[locale]/account/quotes/actions.ts +38 -45
  79. package/dist/assets/storefront/src/app/[locale]/account/quotes/new/new-quote-form.tsx +3 -5
  80. package/dist/assets/storefront/src/app/[locale]/account/quotes/new/page.tsx +6 -6
  81. package/dist/assets/storefront/src/app/[locale]/account/quotes/page.tsx +92 -59
  82. package/dist/assets/storefront/src/app/[locale]/account/shared-carts/[id]/activity-feed.tsx +152 -0
  83. package/dist/assets/storefront/src/app/[locale]/account/shared-carts/[id]/add-item-search.tsx +132 -0
  84. package/dist/assets/storefront/src/app/[locale]/account/shared-carts/[id]/add-member-form.tsx +140 -0
  85. package/dist/assets/storefront/src/app/[locale]/account/shared-carts/[id]/members-panel.tsx +259 -0
  86. package/dist/assets/storefront/src/app/[locale]/account/shared-carts/[id]/page.tsx +55 -0
  87. package/dist/assets/storefront/src/app/[locale]/account/shared-carts/[id]/rename-dialog.tsx +117 -0
  88. package/dist/assets/storefront/src/app/[locale]/account/shared-carts/[id]/shared-cart-detail-client.tsx +555 -0
  89. package/dist/assets/storefront/src/app/[locale]/account/shared-carts/actions.ts +305 -0
  90. package/dist/assets/storefront/src/app/[locale]/account/shared-carts/new/new-shared-cart-form.tsx +84 -0
  91. package/dist/assets/storefront/src/app/[locale]/account/shared-carts/new/page.tsx +47 -0
  92. package/dist/assets/storefront/src/app/[locale]/account/shared-carts/page.tsx +276 -0
  93. package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/[id]/page.tsx +22 -8
  94. package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/[id]/shopping-list-detail-client.tsx +62 -49
  95. package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/actions.ts +9 -4
  96. package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/create-shopping-list-form.tsx +5 -11
  97. package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/loading.tsx +1 -1
  98. package/dist/assets/storefront/src/app/[locale]/account/shopping-lists/page.tsx +32 -42
  99. package/dist/assets/storefront/src/app/[locale]/account/store-credits/actions.ts +8 -8
  100. package/dist/assets/storefront/src/app/[locale]/account/store-credits/claim-form.tsx +6 -10
  101. package/dist/assets/storefront/src/app/[locale]/account/store-credits/page.tsx +76 -55
  102. package/dist/assets/storefront/src/app/[locale]/account/store-credits/reveal-code.tsx +10 -6
  103. package/dist/assets/storefront/src/app/[locale]/account/verify-email/page.tsx +32 -39
  104. package/dist/assets/storefront/src/app/[locale]/cart/actions.ts +29 -23
  105. package/dist/assets/storefront/src/app/[locale]/cart/cart-items.tsx +111 -40
  106. package/dist/assets/storefront/src/app/[locale]/cart/cart-line-actions.tsx +9 -9
  107. package/dist/assets/storefront/src/app/[locale]/cart/cart-quantity-control.tsx +61 -48
  108. package/dist/assets/storefront/src/app/[locale]/cart/cart-remove-button.tsx +15 -9
  109. package/dist/assets/storefront/src/app/[locale]/cart/cart.tsx +38 -41
  110. package/dist/assets/storefront/src/app/[locale]/cart/code-input.tsx +8 -8
  111. package/dist/assets/storefront/src/app/[locale]/cart/order-summary.tsx +70 -29
  112. package/dist/assets/storefront/src/app/[locale]/cart/page.tsx +11 -11
  113. package/dist/assets/storefront/src/app/[locale]/cart/promotion-code.tsx +48 -42
  114. package/dist/assets/storefront/src/app/[locale]/cart/reapproval-confirm.tsx +22 -20
  115. package/dist/assets/storefront/src/app/[locale]/cart/request-quote-button.tsx +7 -16
  116. package/dist/assets/storefront/src/app/[locale]/checkout/actions.ts +39 -65
  117. package/dist/assets/storefront/src/app/[locale]/checkout/cancel-quote-checkout-button.tsx +5 -5
  118. package/dist/assets/storefront/src/app/[locale]/checkout/checkout-flow.tsx +202 -202
  119. package/dist/assets/storefront/src/app/[locale]/checkout/checkout-provider.tsx +142 -142
  120. package/dist/assets/storefront/src/app/[locale]/checkout/order-summary.tsx +158 -139
  121. package/dist/assets/storefront/src/app/[locale]/checkout/page.tsx +56 -47
  122. package/dist/assets/storefront/src/app/[locale]/checkout/steps/delivery-step.tsx +86 -88
  123. package/dist/assets/storefront/src/app/[locale]/checkout/steps/payment-step.tsx +90 -91
  124. package/dist/assets/storefront/src/app/[locale]/checkout/steps/review-step.tsx +166 -161
  125. package/dist/assets/storefront/src/app/[locale]/checkout/steps/shipping-address-step.tsx +573 -494
  126. package/dist/assets/storefront/src/app/[locale]/error.tsx +3 -5
  127. package/dist/assets/storefront/src/app/[locale]/forgot-password/actions.ts +10 -7
  128. package/dist/assets/storefront/src/app/[locale]/forgot-password/forgot-password-form.tsx +10 -25
  129. package/dist/assets/storefront/src/app/[locale]/forgot-password/page.tsx +5 -5
  130. package/dist/assets/storefront/src/app/[locale]/globals.css +48 -48
  131. package/dist/assets/storefront/src/app/[locale]/layout.tsx +53 -47
  132. package/dist/assets/storefront/src/app/[locale]/not-found.tsx +3 -5
  133. package/dist/assets/storefront/src/app/[locale]/order-confirmation/[code]/order-confirmation.tsx +71 -44
  134. package/dist/assets/storefront/src/app/[locale]/order-confirmation/[code]/page.tsx +7 -5
  135. package/dist/assets/storefront/src/app/[locale]/page.tsx +33 -35
  136. package/dist/assets/storefront/src/app/[locale]/register/actions.ts +7 -7
  137. package/dist/assets/storefront/src/app/[locale]/register/page.tsx +22 -16
  138. package/dist/assets/storefront/src/app/[locale]/register/registration-form.tsx +22 -34
  139. package/dist/assets/storefront/src/app/[locale]/register-company/actions.ts +15 -19
  140. package/dist/assets/storefront/src/app/[locale]/register-company/page.tsx +17 -15
  141. package/dist/assets/storefront/src/app/[locale]/register-company/registration-form.tsx +9 -15
  142. package/dist/assets/storefront/src/app/[locale]/reset-password/actions.ts +7 -8
  143. package/dist/assets/storefront/src/app/[locale]/reset-password/page.tsx +18 -12
  144. package/dist/assets/storefront/src/app/[locale]/reset-password/reset-password-form.tsx +8 -16
  145. package/dist/assets/storefront/src/app/[locale]/shopping-list/[code]/add-to-cart-button.tsx +10 -4
  146. package/dist/assets/storefront/src/app/[locale]/shopping-list/[code]/page.tsx +62 -30
  147. package/dist/assets/storefront/src/app/[locale]/sign-in/actions.ts +14 -16
  148. package/dist/assets/storefront/src/app/[locale]/sign-in/login-form.tsx +17 -30
  149. package/dist/assets/storefront/src/app/[locale]/sign-in/page.tsx +35 -30
  150. package/dist/assets/storefront/src/app/[locale]/verify/actions.ts +8 -8
  151. package/dist/assets/storefront/src/app/[locale]/verify/page.tsx +18 -14
  152. package/dist/assets/storefront/src/app/[locale]/verify/verify-content.tsx +25 -27
  153. package/dist/assets/storefront/src/app/[locale]/verify-pending/page.tsx +23 -23
  154. package/dist/assets/storefront/src/app/api/clear-company-context/route.ts +6 -3
  155. package/dist/assets/storefront/src/app/api/revalidate/route.ts +19 -28
  156. package/dist/assets/storefront/src/app/api/search-analytics/route.ts +1 -1
  157. package/dist/assets/storefront/src/components/commerce/account-nav-items.ts +44 -17
  158. package/dist/assets/storefront/src/components/commerce/account-sidebar.tsx +30 -22
  159. package/dist/assets/storefront/src/components/commerce/active-filters.tsx +1 -1
  160. package/dist/assets/storefront/src/components/commerce/add-to-shared-cart.tsx +247 -0
  161. package/dist/assets/storefront/src/components/commerce/approval-decision-form.tsx +9 -13
  162. package/dist/assets/storefront/src/components/commerce/approval-status-badge.tsx +23 -15
  163. package/dist/assets/storefront/src/components/commerce/business-unit-switcher.tsx +11 -11
  164. package/dist/assets/storefront/src/components/commerce/catalog-search-bar.tsx +2 -2
  165. package/dist/assets/storefront/src/components/commerce/category-product-section.tsx +28 -16
  166. package/dist/assets/storefront/src/components/commerce/category-sidebar.tsx +31 -18
  167. package/dist/assets/storefront/src/components/commerce/collection-hero-banner.tsx +2 -4
  168. package/dist/assets/storefront/src/components/commerce/company-state-badge.tsx +10 -16
  169. package/dist/assets/storefront/src/components/commerce/company-switcher.tsx +12 -12
  170. package/dist/assets/storefront/src/components/commerce/configurator-form.tsx +188 -79
  171. package/dist/assets/storefront/src/components/commerce/facet-filters.tsx +29 -49
  172. package/dist/assets/storefront/src/components/commerce/gift-card-pdp.tsx +4 -4
  173. package/dist/assets/storefront/src/components/commerce/gift-card-product-info.tsx +20 -30
  174. package/dist/assets/storefront/src/components/commerce/instant-search-dropdown.tsx +258 -227
  175. package/dist/assets/storefront/src/components/commerce/order-status-badge.tsx +27 -19
  176. package/dist/assets/storefront/src/components/commerce/packaging-unit-selector.tsx +27 -26
  177. package/dist/assets/storefront/src/components/commerce/permission-gate.tsx +4 -4
  178. package/dist/assets/storefront/src/components/commerce/price-range-filter.tsx +5 -5
  179. package/dist/assets/storefront/src/components/commerce/price-tiers.tsx +38 -21
  180. package/dist/assets/storefront/src/components/commerce/price.tsx +3 -3
  181. package/dist/assets/storefront/src/components/commerce/product-card-list.tsx +35 -14
  182. package/dist/assets/storefront/src/components/commerce/product-card.tsx +31 -16
  183. package/dist/assets/storefront/src/components/commerce/product-carousel.tsx +20 -12
  184. package/dist/assets/storefront/src/components/commerce/product-grid.tsx +14 -13
  185. package/dist/assets/storefront/src/components/commerce/product-image-carousel.tsx +10 -8
  186. package/dist/assets/storefront/src/components/commerce/product-info.tsx +129 -72
  187. package/dist/assets/storefront/src/components/commerce/product-list-expansion.tsx +102 -74
  188. package/dist/assets/storefront/src/components/commerce/product-list-view.tsx +1 -1
  189. package/dist/assets/storefront/src/components/commerce/product-sidebar.tsx +36 -11
  190. package/dist/assets/storefront/src/components/commerce/product-view-switcher.tsx +33 -21
  191. package/dist/assets/storefront/src/components/commerce/quote-action-buttons.tsx +54 -36
  192. package/dist/assets/storefront/src/components/commerce/quote-activity-timeline.tsx +126 -50
  193. package/dist/assets/storefront/src/components/commerce/quote-comment-form.tsx +9 -13
  194. package/dist/assets/storefront/src/components/commerce/quote-csv-export-button.tsx +6 -6
  195. package/dist/assets/storefront/src/components/commerce/quote-product-search.tsx +22 -18
  196. package/dist/assets/storefront/src/components/commerce/quote-request-form.tsx +28 -27
  197. package/dist/assets/storefront/src/components/commerce/quote-status-badge.tsx +26 -18
  198. package/dist/assets/storefront/src/components/commerce/quote-validity-indicator.tsx +7 -7
  199. package/dist/assets/storefront/src/components/commerce/quote-version-comparison.tsx +50 -30
  200. package/dist/assets/storefront/src/components/commerce/related-products.tsx +37 -28
  201. package/dist/assets/storefront/src/components/commerce/shared-cart-role.ts +39 -0
  202. package/dist/assets/storefront/src/components/commerce/shared-cart-status-badge.tsx +28 -0
  203. package/dist/assets/storefront/src/components/commerce/shop-by-category.tsx +8 -7
  204. package/dist/assets/storefront/src/components/commerce/shopping-list-toggle.tsx +14 -20
  205. package/dist/assets/storefront/src/components/commerce/sort-dropdown.tsx +9 -16
  206. package/dist/assets/storefront/src/components/commerce/store-credit-summary.tsx +30 -32
  207. package/dist/assets/storefront/src/components/commerce/subcollection-tiles.tsx +11 -13
  208. package/dist/assets/storefront/src/components/layout/auth-page-shell.tsx +2 -2
  209. package/dist/assets/storefront/src/components/layout/draft-mode-indicator.tsx +2 -7
  210. package/dist/assets/storefront/src/components/layout/draft-mode-link.tsx +4 -2
  211. package/dist/assets/storefront/src/components/layout/footer.tsx +70 -28
  212. package/dist/assets/storefront/src/components/layout/navbar/actions.ts +9 -12
  213. package/dist/assets/storefront/src/components/layout/navbar/cart-icon.tsx +9 -9
  214. package/dist/assets/storefront/src/components/layout/navbar/channel-picker-wrapper.tsx +4 -9
  215. package/dist/assets/storefront/src/components/layout/navbar/channel-picker.tsx +13 -8
  216. package/dist/assets/storefront/src/components/layout/navbar/currency-picker-wrapper.tsx +4 -4
  217. package/dist/assets/storefront/src/components/layout/navbar/currency-picker.tsx +11 -6
  218. package/dist/assets/storefront/src/components/layout/navbar/language-picker.tsx +7 -7
  219. package/dist/assets/storefront/src/components/layout/navbar/login-button.tsx +24 -21
  220. package/dist/assets/storefront/src/components/layout/navbar/mobile-nav.tsx +8 -8
  221. package/dist/assets/storefront/src/components/layout/navbar/nav-menu-items.tsx +4 -6
  222. package/dist/assets/storefront/src/components/layout/navbar/navbar-cart.tsx +1 -1
  223. package/dist/assets/storefront/src/components/layout/navbar/navbar-collections.tsx +41 -42
  224. package/dist/assets/storefront/src/components/layout/navbar/navbar-link.tsx +7 -10
  225. package/dist/assets/storefront/src/components/layout/navbar/navbar-user.tsx +18 -23
  226. package/dist/assets/storefront/src/components/layout/navbar/theme-switcher.tsx +9 -9
  227. package/dist/assets/storefront/src/components/layout/navbar.tsx +36 -31
  228. package/dist/assets/storefront/src/components/layout/search-input.tsx +35 -32
  229. package/dist/assets/storefront/src/components/providers/awaiting-approval-banner.tsx +12 -10
  230. package/dist/assets/storefront/src/components/providers/cart-count-server.tsx +14 -12
  231. package/dist/assets/storefront/src/components/providers/company-context-guard.tsx +4 -4
  232. package/dist/assets/storefront/src/components/providers/company-permissions-server.tsx +2 -6
  233. package/dist/assets/storefront/src/components/providers/theme-provider.tsx +3 -3
  234. package/dist/assets/storefront/src/components/shared/breadcrumbs.tsx +4 -1
  235. package/dist/assets/storefront/src/components/shared/country-select.tsx +63 -67
  236. package/dist/assets/storefront/src/components/shared/pagination.tsx +15 -28
  237. package/dist/assets/storefront/src/components/shared/prefetch-link.tsx +1 -1
  238. package/dist/assets/storefront/src/components/shared/skeletons/search-input-skeleton.tsx +1 -3
  239. package/dist/assets/storefront/src/components/ui/accordion.tsx +46 -51
  240. package/dist/assets/storefront/src/components/ui/alert-dialog.tsx +94 -121
  241. package/dist/assets/storefront/src/components/ui/alert.tsx +48 -54
  242. package/dist/assets/storefront/src/components/ui/aspect-ratio.tsx +5 -7
  243. package/dist/assets/storefront/src/components/ui/avatar.tsx +29 -44
  244. package/dist/assets/storefront/src/components/ui/badge.tsx +28 -37
  245. package/dist/assets/storefront/src/components/ui/breadcrumb.tsx +82 -89
  246. package/dist/assets/storefront/src/components/ui/button.tsx +43 -49
  247. package/dist/assets/storefront/src/components/ui/calendar.tsx +157 -198
  248. package/dist/assets/storefront/src/components/ui/card.tsx +53 -76
  249. package/dist/assets/storefront/src/components/ui/carousel.tsx +194 -212
  250. package/dist/assets/storefront/src/components/ui/chart.tsx +274 -317
  251. package/dist/assets/storefront/src/components/ui/checkbox.tsx +24 -27
  252. package/dist/assets/storefront/src/components/ui/collapsible.tsx +9 -21
  253. package/dist/assets/storefront/src/components/ui/command.tsx +114 -159
  254. package/dist/assets/storefront/src/components/ui/context-menu.tsx +167 -199
  255. package/dist/assets/storefront/src/components/ui/dialog.tsx +97 -114
  256. package/dist/assets/storefront/src/components/ui/drawer.tsx +93 -107
  257. package/dist/assets/storefront/src/components/ui/dropdown-menu.tsx +171 -206
  258. package/dist/assets/storefront/src/components/ui/empty-state.tsx +5 -5
  259. package/dist/assets/storefront/src/components/ui/field.tsx +196 -208
  260. package/dist/assets/storefront/src/components/ui/form.tsx +115 -139
  261. package/dist/assets/storefront/src/components/ui/hover-card.tsx +27 -33
  262. package/dist/assets/storefront/src/components/ui/input-otp.tsx +50 -59
  263. package/dist/assets/storefront/src/components/ui/input.tsx +17 -17
  264. package/dist/assets/storefront/src/components/ui/kbd-shortcut.tsx +3 -1
  265. package/dist/assets/storefront/src/components/ui/label.tsx +16 -19
  266. package/dist/assets/storefront/src/components/ui/menubar.tsx +193 -223
  267. package/dist/assets/storefront/src/components/ui/navigation-menu.tsx +123 -130
  268. package/dist/assets/storefront/src/components/ui/pagination.tsx +87 -108
  269. package/dist/assets/storefront/src/components/ui/popover.tsx +29 -35
  270. package/dist/assets/storefront/src/components/ui/progress.tsx +19 -26
  271. package/dist/assets/storefront/src/components/ui/radio-group.tsx +32 -38
  272. package/dist/assets/storefront/src/components/ui/resizable.tsx +37 -42
  273. package/dist/assets/storefront/src/components/ui/scroll-area.tsx +41 -47
  274. package/dist/assets/storefront/src/components/ui/select.tsx +130 -152
  275. package/dist/assets/storefront/src/components/ui/separator.tsx +21 -21
  276. package/dist/assets/storefront/src/components/ui/sheet.tsx +90 -111
  277. package/dist/assets/storefront/src/components/ui/sidebar.tsx +611 -649
  278. package/dist/assets/storefront/src/components/ui/skeleton.tsx +10 -10
  279. package/dist/assets/storefront/src/components/ui/slider.tsx +50 -55
  280. package/dist/assets/storefront/src/components/ui/sonner.tsx +20 -20
  281. package/dist/assets/storefront/src/components/ui/switch.tsx +23 -26
  282. package/dist/assets/storefront/src/components/ui/table.tsx +65 -97
  283. package/dist/assets/storefront/src/components/ui/tabs.tsx +39 -55
  284. package/dist/assets/storefront/src/components/ui/textarea.tsx +14 -14
  285. package/dist/assets/storefront/src/components/ui/toggle-group.tsx +56 -62
  286. package/dist/assets/storefront/src/components/ui/toggle.tsx +37 -38
  287. package/dist/assets/storefront/src/components/ui/tooltip.tsx +38 -46
  288. package/dist/assets/storefront/src/config/scenario-meta.ts +2 -2
  289. package/dist/assets/storefront/src/config/scenario.ts +14 -16
  290. package/dist/assets/storefront/src/contexts/auth-context.tsx +5 -6
  291. package/dist/assets/storefront/src/graphql-env.d.ts +18 -5
  292. package/dist/assets/storefront/src/graphql.ts +5 -5
  293. package/dist/assets/storefront/src/hooks/use-mobile.ts +13 -13
  294. package/dist/assets/storefront/src/i18n/locale-utils.ts +3 -3
  295. package/dist/assets/storefront/src/i18n/navigation.ts +4 -4
  296. package/dist/assets/storefront/src/i18n/request.ts +4 -4
  297. package/dist/assets/storefront/src/i18n/routing.ts +5 -5
  298. package/dist/assets/storefront/src/i18n/server.ts +3 -3
  299. package/dist/assets/storefront/src/lib/actions/switch-channel.ts +9 -9
  300. package/dist/assets/storefront/src/lib/actions/switch-currency.ts +7 -7
  301. package/dist/assets/storefront/src/lib/auth.ts +1 -1
  302. package/dist/assets/storefront/src/lib/backend-health.ts +3 -3
  303. package/dist/assets/storefront/src/lib/cart-count-context.tsx +10 -4
  304. package/dist/assets/storefront/src/lib/cart-guard-utils.ts +2 -1
  305. package/dist/assets/storefront/src/lib/cart-guard.ts +7 -6
  306. package/dist/assets/storefront/src/lib/channel-server.ts +4 -4
  307. package/dist/assets/storefront/src/lib/company-context.ts +1 -1
  308. package/dist/assets/storefront/src/lib/company-permissions-context.tsx +1 -5
  309. package/dist/assets/storefront/src/lib/currency-server.ts +4 -4
  310. package/dist/assets/storefront/src/lib/format.ts +16 -7
  311. package/dist/assets/storefront/src/lib/metadata.ts +39 -44
  312. package/dist/assets/storefront/src/lib/quantity.ts +2 -4
  313. package/dist/assets/storefront/src/lib/search-bar-context.tsx +7 -4
  314. package/dist/assets/storefront/src/lib/use-recent-searches.ts +8 -6
  315. package/dist/assets/storefront/src/lib/utils.ts +3 -3
  316. package/dist/assets/storefront/src/lib/vendure/actions.ts +18 -16
  317. package/dist/assets/storefront/src/lib/vendure/api.ts +44 -27
  318. package/dist/assets/storefront/src/lib/vendure/approval-utils.ts +9 -8
  319. package/dist/assets/storefront/src/lib/vendure/cached.ts +20 -15
  320. package/dist/assets/storefront/src/lib/vendure/mutations.ts +96 -0
  321. package/dist/assets/storefront/src/lib/vendure/queries.ts +157 -5
  322. package/dist/assets/storefront/src/middleware.ts +1 -1
  323. package/dist/assets/storefront/src/scenarios/customer/hero.tsx +2 -2
  324. package/dist/assets/storefront/src/scenarios/customer/meta.ts +1 -1
  325. package/dist/assets/storefront/src/schema.graphql +134 -0
  326. package/dist/bin/run.js +1 -1
  327. package/dist/cli.d.ts +1 -1
  328. package/dist/index.d.ts +5 -5
  329. package/dist/index.js +1 -1
  330. package/dist/plugin-registry.js +1 -1
  331. package/dist/scaffold-storefront-only.js +1 -1
  332. package/dist/scaffolder.js +1 -1
  333. package/dist/template-renderer.js +1 -1
  334. package/package.json +2 -2
@@ -1,12 +1,12 @@
1
1
  'use client';
2
2
 
3
- import {useActionState} from 'react';
4
- import {useTranslations} from 'next-intl';
5
- import {registerCompanyAction} from './actions';
6
- import {Button} from '@/components/ui/button';
7
- import {Input} from '@/components/ui/input';
8
- import {Label} from '@/components/ui/label';
9
- import {Card, CardContent, CardDescription, CardHeader, CardTitle} from '@/components/ui/card';
3
+ import { Button } from '@/components/ui/button';
4
+ import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
5
+ import { Input } from '@/components/ui/input';
6
+ import { Label } from '@/components/ui/label';
7
+ import { useTranslations } from 'next-intl';
8
+ import { useActionState } from 'react';
9
+ import { registerCompanyAction } from './actions';
10
10
 
11
11
  export function RegistrationForm() {
12
12
  const t = useTranslations('RegisterCompany');
@@ -16,9 +16,7 @@ export function RegistrationForm() {
16
16
  <Card className="w-full max-w-md">
17
17
  <CardHeader>
18
18
  <CardTitle>{t('cardTitle')}</CardTitle>
19
- <CardDescription>
20
- {t('cardDescription')}
21
- </CardDescription>
19
+ <CardDescription>{t('cardDescription')}</CardDescription>
22
20
  </CardHeader>
23
21
  <form action={formAction}>
24
22
  <CardContent className="space-y-4">
@@ -33,11 +31,7 @@ export function RegistrationForm() {
33
31
  disabled={isPending}
34
32
  />
35
33
  </div>
36
- {state?.error && (
37
- <div className="text-sm text-destructive">
38
- {state.error}
39
- </div>
40
- )}
34
+ {state?.error && <div className="text-sm text-destructive">{state.error}</div>}
41
35
  <Button type="submit" disabled={isPending} className="w-full">
42
36
  {isPending ? t('registeringButton') : t('registerButton')}
43
37
  </Button>
@@ -1,9 +1,9 @@
1
1
  'use server';
2
2
 
3
- import {client} from '@/lib/vendure/api';
4
- import {ResetPasswordMutation} from '@/lib/vendure/mutations';
5
- import {setAuthToken} from '@/lib/auth';
6
- import {redirect} from '@/i18n/navigation';
3
+ import { redirect } from '@/i18n/navigation';
4
+ import { setAuthToken } from '@/lib/auth';
5
+ import { client } from '@/lib/vendure/api';
6
+ import { ResetPasswordMutation } from '@/lib/vendure/mutations';
7
7
 
8
8
  export async function resetPasswordAction(prevState: { error?: string } | undefined, formData: FormData) {
9
9
  const token = formData.get('token') as string;
@@ -11,14 +11,13 @@ export async function resetPasswordAction(prevState: { error?: string } | undefi
11
11
  const confirmPassword = formData.get('confirmPassword') as string;
12
12
 
13
13
  if (!token || !password || !confirmPassword) {
14
- return {error: 'All fields are required'};
14
+ return { error: 'All fields are required' };
15
15
  }
16
16
 
17
17
  if (password !== confirmPassword) {
18
- return {error: 'Passwords do not match'};
18
+ return { error: 'Passwords do not match' };
19
19
  }
20
20
 
21
-
22
21
  const [result, error] = await client.mutate(ResetPasswordMutation, {
23
22
  token,
24
23
  password,
@@ -28,7 +27,7 @@ export async function resetPasswordAction(prevState: { error?: string } | undefi
28
27
  const resetResult = result.data.resetPassword;
29
28
 
30
29
  if (resetResult.__typename !== 'CurrentUser') {
31
- return {error: resetResult.message};
30
+ return { error: resetResult.message };
32
31
  }
33
32
 
34
33
  // Store the token in a cookie if returned
@@ -1,29 +1,35 @@
1
- import type {Metadata} from 'next';
2
- import { Suspense } from 'react';
1
+ import { type Locale } from '@/i18n/routing';
3
2
  import { Loader2 } from 'lucide-react';
4
- import {getTranslations} from 'next-intl/server';
5
- import {locale as rootLocale} from 'next/root-params';
6
- import {type Locale} from '@/i18n/routing';
3
+ import type { Metadata } from 'next';
4
+ import { getTranslations } from 'next-intl/server';
5
+ import { locale as rootLocale } from 'next/root-params';
6
+ import { Suspense } from 'react';
7
7
  import { ResetPasswordForm } from './reset-password-form';
8
8
 
9
9
  export async function generateMetadata(): Promise<Metadata> {
10
10
  const locale = (await rootLocale()) as Locale;
11
- const t = await getTranslations({locale, namespace: 'Auth'});
11
+ const t = await getTranslations({ locale, namespace: 'Auth' });
12
12
  return {
13
13
  title: t('resetYourPassword'),
14
14
  description: t('resetYourPasswordDescription'),
15
15
  };
16
16
  }
17
17
 
18
- export default function ResetPasswordPage({searchParams}: {searchParams: Promise<Record<string, string | string[] | undefined>>}) {
18
+ export default function ResetPasswordPage({
19
+ searchParams,
20
+ }: {
21
+ searchParams: Promise<Record<string, string | string[] | undefined>>;
22
+ }) {
19
23
  return (
20
24
  <div className="container mx-auto px-4 py-16">
21
25
  <div className="max-w-md mx-auto">
22
- <Suspense fallback={
23
- <div className="flex justify-center">
24
- <Loader2 className="h-8 w-8 animate-spin text-muted-foreground" />
25
- </div>
26
- }>
26
+ <Suspense
27
+ fallback={
28
+ <div className="flex justify-center">
29
+ <Loader2 className="h-8 w-8 animate-spin text-muted-foreground" />
30
+ </div>
31
+ }
32
+ >
27
33
  <ResetPasswordForm searchParams={searchParams} />
28
34
  </Suspense>
29
35
  </div>
@@ -1,13 +1,13 @@
1
1
  'use client';
2
2
 
3
- import { use, useActionState } from 'react';
4
- import { useTranslations } from 'next-intl';
5
- import { resetPasswordAction } from './actions';
6
3
  import { Button } from '@/components/ui/button';
4
+ import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '@/components/ui/card';
7
5
  import { Input } from '@/components/ui/input';
8
6
  import { Label } from '@/components/ui/label';
9
- import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '@/components/ui/card';
10
- import {Link} from '@/i18n/navigation';
7
+ import { Link } from '@/i18n/navigation';
8
+ import { useTranslations } from 'next-intl';
9
+ import { use, useActionState } from 'react';
10
+ import { resetPasswordAction } from './actions';
11
11
 
12
12
  interface ResetPasswordFormProps {
13
13
  searchParams: Promise<{ token?: string }>;
@@ -25,9 +25,7 @@ export function ResetPasswordForm({ searchParams }: ResetPasswordFormProps) {
25
25
  <Card>
26
26
  <CardHeader>
27
27
  <CardTitle>{t('invalidResetLink')}</CardTitle>
28
- <CardDescription>
29
- {t('invalidResetLinkDescription')}
30
- </CardDescription>
28
+ <CardDescription>{t('invalidResetLinkDescription')}</CardDescription>
31
29
  </CardHeader>
32
30
  <CardFooter>
33
31
  <Link href="/forgot-password">
@@ -44,9 +42,7 @@ export function ResetPasswordForm({ searchParams }: ResetPasswordFormProps) {
44
42
  <Card>
45
43
  <CardHeader>
46
44
  <CardTitle>{t('resetYourPassword')}</CardTitle>
47
- <CardDescription>
48
- {t('resetYourPasswordDescription')}
49
- </CardDescription>
45
+ <CardDescription>{t('resetYourPasswordDescription')}</CardDescription>
50
46
  </CardHeader>
51
47
  <form action={formAction}>
52
48
  <input type="hidden" name="token" value={token} />
@@ -73,11 +69,7 @@ export function ResetPasswordForm({ searchParams }: ResetPasswordFormProps) {
73
69
  disabled={isPending}
74
70
  />
75
71
  </div>
76
- {state?.error && (
77
- <div className="text-sm text-destructive">
78
- {state.error}
79
- </div>
80
- )}
72
+ {state?.error && <div className="text-sm text-destructive">{state.error}</div>}
81
73
  </CardContent>
82
74
  <CardFooter className="flex flex-col space-y-4">
83
75
  <Button type="submit" className="w-full" disabled={isPending}>
@@ -1,13 +1,19 @@
1
1
  'use client';
2
2
 
3
- import { useTransition } from 'react';
4
- import { useTranslations } from 'next-intl';
3
+ import { addToCart } from '@/app/[locale]/(catalog)/product/[slug]/actions';
5
4
  import { Button } from '@/components/ui/button';
6
5
  import { ShoppingCart } from 'lucide-react';
7
- import { addToCart } from '@/app/[locale]/(catalog)/product/[slug]/actions';
6
+ import { useTranslations } from 'next-intl';
7
+ import { useTransition } from 'react';
8
8
  import { toast } from 'sonner';
9
9
 
10
- export function PublicShoppingListAddToCart({ variantId, outOfStock }: { variantId: string; outOfStock?: boolean }) {
10
+ export function PublicShoppingListAddToCart({
11
+ variantId,
12
+ outOfStock,
13
+ }: {
14
+ variantId: string;
15
+ outOfStock?: boolean;
16
+ }) {
11
17
  const t = useTranslations('SharedShoppingList');
12
18
  const [isPending, startTransition] = useTransition();
13
19
 
@@ -1,24 +1,26 @@
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
1
  import { getPublicShoppingList } from '@/app/[locale]/account/shopping-lists/actions';
7
- import Image from 'next/image';
8
- import {Link} from '@/i18n/navigation';
9
2
  import { Price } from '@/components/commerce/price';
10
3
  import { Badge } from '@/components/ui/badge';
11
4
  import { Button } from '@/components/ui/button';
12
- import { SITE_NAME, buildCanonicalUrl, buildAlternates } from '@/lib/metadata';
13
- import { getActiveChannelCached } from '@/lib/vendure/cached';
5
+ import { Link } from '@/i18n/navigation';
6
+ import type { Locale } from '@/i18n/routing';
14
7
  import { getActiveChannelToken } from '@/lib/channel-server';
8
+ import { SITE_NAME, buildAlternates, buildCanonicalUrl } from '@/lib/metadata';
9
+ import { getActiveChannelCached } from '@/lib/vendure/cached';
10
+ import type { Metadata } from 'next';
11
+ import { getTranslations } from 'next-intl/server';
12
+ import Image from 'next/image';
13
+ import { locale as rootLocale } from 'next/root-params';
14
+ import { Suspense } from 'react';
15
15
  import { PublicShoppingListAddToCart } from './add-to-cart-button';
16
16
 
17
17
  export async function generateMetadata({
18
18
  params,
19
- }: { params: Promise<{ locale: string; code: string }> }): Promise<Metadata> {
19
+ }: {
20
+ params: Promise<{ locale: string; code: string }>;
21
+ }): Promise<Metadata> {
20
22
  const locale = (await rootLocale()) as Locale;
21
- const t = await getTranslations({locale, namespace: 'SharedShoppingList'});
23
+ const t = await getTranslations({ locale, namespace: 'SharedShoppingList' });
22
24
  const { code } = await params;
23
25
  const shoppingList = await getPublicShoppingList(code);
24
26
 
@@ -27,7 +29,9 @@ export async function generateMetadata({
27
29
  }
28
30
 
29
31
  const title = `${shoppingList.name} - ${t('sharedSuffix')}`;
30
- const description = shoppingList.description || t('itemsSharedOn', {count: shoppingList.totalItems, siteName: SITE_NAME});
32
+ const description =
33
+ shoppingList.description ||
34
+ t('itemsSharedOn', { count: shoppingList.totalItems, siteName: SITE_NAME });
31
35
  const listPath = `/shopping-list/${code}`;
32
36
 
33
37
  return {
@@ -43,9 +47,19 @@ export async function generateMetadata({
43
47
  };
44
48
  }
45
49
 
46
- export default async function PublicShoppingListPage({ params }: { params: Promise<{ locale: string; code: string }> }) {
50
+ export default async function PublicShoppingListPage({
51
+ params,
52
+ }: {
53
+ params: Promise<{ locale: string; code: string }>;
54
+ }) {
47
55
  return (
48
- <Suspense fallback={<div className="container mx-auto px-4 py-30"><p className="text-sm text-muted-foreground">Loading...</p></div>}>
56
+ <Suspense
57
+ fallback={
58
+ <div className="container mx-auto px-4 py-30">
59
+ <p className="text-sm text-muted-foreground">Loading...</p>
60
+ </div>
61
+ }
62
+ >
49
63
  <PublicShoppingListContent params={params} />
50
64
  </Suspense>
51
65
  );
@@ -66,9 +80,7 @@ async function PublicShoppingListContent({ params }: { params: Promise<{ locale:
66
80
  <div className="container mx-auto px-4 py-30">
67
81
  <div className="max-w-3xl mx-auto text-center space-y-4">
68
82
  <h1 className="text-3xl font-bold">{t('notFoundTitle')}</h1>
69
- <p className="text-muted-foreground">
70
- {t('notFoundMessage')}
71
- </p>
83
+ <p className="text-muted-foreground">{t('notFoundMessage')}</p>
72
84
  <Button asChild variant="outline">
73
85
  <Link href="/">{t('browseProducts')}</Link>
74
86
  </Button>
@@ -88,7 +100,7 @@ async function PublicShoppingListContent({ params }: { params: Promise<{ locale:
88
100
  <p className="text-muted-foreground mt-2">{shoppingList.description}</p>
89
101
  )}
90
102
  <p className="text-sm text-muted-foreground mt-1">
91
- {t('itemCount', {count: shoppingList.totalItems})}
103
+ {t('itemCount', { count: shoppingList.totalItems })}
92
104
  </p>
93
105
  </div>
94
106
 
@@ -99,14 +111,17 @@ async function PublicShoppingListContent({ params }: { params: Promise<{ locale:
99
111
  ) : (
100
112
  <div className="space-y-4">
101
113
  {items.map((item) => (
102
- <div
103
- key={item.id}
104
- className="flex items-center gap-4 border rounded-lg p-4"
105
- >
106
- <Link href={`/product/${item.productVariant.product.slug}`} className="shrink-0">
114
+ <div key={item.id} className="flex items-center gap-4 border rounded-lg p-4">
115
+ <Link
116
+ href={`/product/${item.productVariant.product.slug}`}
117
+ className="shrink-0"
118
+ >
107
119
  {item.productVariant.product.featuredAsset ? (
108
120
  <Image
109
- src={item.productVariant.product.featuredAsset.preview + '?preset=thumb'}
121
+ src={
122
+ item.productVariant.product.featuredAsset.preview +
123
+ '?preset=thumb'
124
+ }
110
125
  alt={item.productVariant.product.name}
111
126
  width={80}
112
127
  height={80}
@@ -124,11 +139,18 @@ async function PublicShoppingListContent({ params }: { params: Promise<{ locale:
124
139
  >
125
140
  {item.productVariant.product.name}
126
141
  </Link>
127
- <p className="text-sm text-muted-foreground">{item.productVariant.name}</p>
142
+ <p className="text-sm text-muted-foreground">
143
+ {item.productVariant.name}
144
+ </p>
128
145
  <div className="flex items-center gap-2 mt-1">
129
- <Price value={item.productVariant.priceWithTax} currencyCode={currencyCode} />
146
+ <Price
147
+ value={item.productVariant.priceWithTax}
148
+ currencyCode={currencyCode}
149
+ />
130
150
  {item.quantity > 1 && (
131
- <span className="text-sm text-muted-foreground">x{item.quantity}</span>
151
+ <span className="text-sm text-muted-foreground">
152
+ x{item.quantity}
153
+ </span>
132
154
  )}
133
155
  {item.purchased && (
134
156
  <Badge variant="secondary">{t('purchasedBadge')}</Badge>
@@ -136,16 +158,26 @@ async function PublicShoppingListContent({ params }: { params: Promise<{ locale:
136
158
  {item.productVariant.stockLevel === 'OUT_OF_STOCK' ? (
137
159
  <Badge variant="destructive">{t('outOfStockBadge')}</Badge>
138
160
  ) : (
139
- <Badge variant="outline" className="text-green-600 border-green-600">{t('inStockBadge')}</Badge>
161
+ <Badge
162
+ variant="outline"
163
+ className="text-green-600 border-green-600"
164
+ >
165
+ {t('inStockBadge')}
166
+ </Badge>
140
167
  )}
141
168
  </div>
142
169
  {item.note && (
143
- <p className="text-sm text-muted-foreground mt-1 italic">{item.note}</p>
170
+ <p className="text-sm text-muted-foreground mt-1 italic">
171
+ {item.note}
172
+ </p>
144
173
  )}
145
174
  </div>
146
175
 
147
176
  <div className="shrink-0">
148
- <PublicShoppingListAddToCart variantId={item.productVariant.id} outOfStock={item.productVariant.stockLevel === 'OUT_OF_STOCK'} />
177
+ <PublicShoppingListAddToCart
178
+ variantId={item.productVariant.id}
179
+ outOfStock={item.productVariant.stockLevel === 'OUT_OF_STOCK'}
180
+ />
149
181
  </div>
150
182
  </div>
151
183
  ))}
@@ -1,14 +1,14 @@
1
1
  'use server';
2
2
 
3
- import {client} from '@/lib/vendure/api';
4
- import {LoginMutation, LogoutMutation} from '@/lib/vendure/mutations';
5
- import {GetCompanyAccountQuery} from '@/lib/vendure/queries';
6
- import {removeAuthToken, setAuthToken} from '@/lib/auth';
7
- import {setCompanyId, setBusinessUnitId, clearCompanyContext} from '@/lib/company-context';
8
- import {readFragment} from '@/graphql';
9
- import {CompanyFragment, CompanyBusinessUnitFragment} from '@/lib/vendure/fragments';
10
- import {revalidatePath, revalidateTag} from "next/cache";
11
- import {redirect} from "@/i18n/navigation";
3
+ import { readFragment } from '@/graphql';
4
+ import { redirect } from '@/i18n/navigation';
5
+ import { removeAuthToken, setAuthToken } from '@/lib/auth';
6
+ import { clearCompanyContext, setBusinessUnitId, setCompanyId } from '@/lib/company-context';
7
+ import { client } from '@/lib/vendure/api';
8
+ import { CompanyBusinessUnitFragment, CompanyFragment } from '@/lib/vendure/fragments';
9
+ import { LoginMutation, LogoutMutation } from '@/lib/vendure/mutations';
10
+ import { GetCompanyAccountQuery } from '@/lib/vendure/queries';
11
+ import { revalidatePath, revalidateTag } from 'next/cache';
12
12
 
13
13
  export async function loginAction(prevState: { error?: string } | undefined, formData: FormData) {
14
14
  const username = formData.get('username') as string;
@@ -52,13 +52,11 @@ export async function loginAction(prevState: { error?: string } | undefined, for
52
52
  }
53
53
  // Company context is optional — don't block login if it fails
54
54
 
55
- revalidateTag('active-customer', {expire: 0});
55
+ revalidateTag('active-customer', { expire: 0 });
56
56
  revalidatePath('/', 'layout');
57
57
 
58
58
  // Validate redirectTo is a safe internal path
59
- const safeRedirect = redirectTo?.startsWith('/') && !redirectTo.startsWith('//')
60
- ? redirectTo
61
- : '/';
59
+ const safeRedirect = redirectTo?.startsWith('/') && !redirectTo.startsWith('//') ? redirectTo : '/';
62
60
 
63
61
  await redirect(safeRedirect);
64
62
  }
@@ -67,9 +65,9 @@ export async function logoutAction() {
67
65
  await client.mutate(LogoutMutation);
68
66
  await removeAuthToken();
69
67
  await clearCompanyContext();
70
- revalidateTag('active-customer', {expire: 0});
71
- revalidateTag('cart', {expire: 0});
72
- revalidateTag('active-order', {expire: 0});
68
+ revalidateTag('active-customer', { expire: 0 });
69
+ revalidateTag('cart', { expire: 0 });
70
+ revalidateTag('active-order', { expire: 0 });
73
71
  revalidatePath('/', 'layout');
74
72
 
75
73
  return { redirectTo: '/' };
@@ -1,23 +1,16 @@
1
1
  'use client';
2
2
 
3
- import {useState, useTransition} from 'react';
4
- import {useForm} from 'react-hook-form';
5
- import {zodResolver} from '@hookform/resolvers/zod';
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';
10
+ import { useState, useTransition } from 'react';
11
+ import { useForm } from 'react-hook-form';
6
12
  import * as z from 'zod';
7
- import {useTranslations} from 'next-intl';
8
- import {loginAction} 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';
13
+ import { loginAction } from './actions';
21
14
 
22
15
  function useLoginSchema() {
23
16
  const t = useTranslations('Auth');
@@ -33,7 +26,7 @@ interface LoginFormProps {
33
26
  redirectTo?: string;
34
27
  }
35
28
 
36
- export function LoginForm({redirectTo}: LoginFormProps) {
29
+ export function LoginForm({ redirectTo }: LoginFormProps) {
37
30
  const t = useTranslations('Auth');
38
31
  const [isPending, startTransition] = useTransition();
39
32
  const [serverError, setServerError] = useState<string | null>(null);
@@ -65,9 +58,7 @@ export function LoginForm({redirectTo}: LoginFormProps) {
65
58
  });
66
59
  };
67
60
 
68
- const registerHref = redirectTo
69
- ? `/register?redirectTo=${encodeURIComponent(redirectTo)}`
70
- : '/register';
61
+ const registerHref = redirectTo ? `/register?redirectTo=${encodeURIComponent(redirectTo)}` : '/register';
71
62
 
72
63
  return (
73
64
  <Card>
@@ -77,7 +68,7 @@ export function LoginForm({redirectTo}: LoginFormProps) {
77
68
  <FormField
78
69
  control={form.control}
79
70
  name="username"
80
- render={({field}) => (
71
+ render={({ field }) => (
81
72
  <FormItem>
82
73
  <FormLabel>{t('email')}</FormLabel>
83
74
  <FormControl>
@@ -88,7 +79,7 @@ export function LoginForm({redirectTo}: LoginFormProps) {
88
79
  {...field}
89
80
  />
90
81
  </FormControl>
91
- <FormMessage/>
82
+ <FormMessage />
92
83
  </FormItem>
93
84
  )}
94
85
  />
@@ -96,7 +87,7 @@ export function LoginForm({redirectTo}: LoginFormProps) {
96
87
  <FormField
97
88
  control={form.control}
98
89
  name="password"
99
- render={({field}) => (
90
+ render={({ field }) => (
100
91
  <FormItem>
101
92
  <div className="flex items-center justify-between">
102
93
  <FormLabel>{t('password')}</FormLabel>
@@ -116,16 +107,12 @@ export function LoginForm({redirectTo}: LoginFormProps) {
116
107
  {...field}
117
108
  />
118
109
  </FormControl>
119
- <FormMessage/>
110
+ <FormMessage />
120
111
  </FormItem>
121
112
  )}
122
113
  />
123
114
 
124
- {serverError && (
125
- <div className="text-sm text-destructive">
126
- {serverError}
127
- </div>
128
- )}
115
+ {serverError && <div className="text-sm text-destructive">{serverError}</div>}
129
116
  <Button type="submit" className="w-full" disabled={isPending}>
130
117
  {isPending ? t('signingIn') : t('signIn')}
131
118
  </Button>
@@ -1,18 +1,18 @@
1
- import type {Metadata} from 'next';
2
- import {redirect} from 'next/navigation';
3
- import {Suspense} from 'react';
4
- import {getTranslations} from 'next-intl/server';
5
- import {LoginForm} from "./login-form";
6
- import {Card, CardContent, CardFooter} from "@/components/ui/card";
7
- import {Skeleton} from "@/components/ui/skeleton";
8
- import {getActiveCustomer} from "@/lib/vendure/actions";
9
- import {locale as rootLocale} from 'next/root-params';
10
- import {type Locale} from '@/i18n/routing';
11
- 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 { getActiveCustomer } from '@/lib/vendure/actions';
6
+ import type { Metadata } from 'next';
7
+ import { getTranslations } from 'next-intl/server';
8
+ import { redirect } from 'next/navigation';
9
+ import { locale as rootLocale } from 'next/root-params';
10
+ import { Suspense } from 'react';
11
+ import { LoginForm } from './login-form';
12
12
 
13
13
  export async function generateMetadata(): Promise<Metadata> {
14
14
  const locale = (await rootLocale()) as Locale;
15
- const t = await getTranslations({locale, namespace: 'Auth'});
15
+ const t = await getTranslations({ locale, namespace: 'Auth' });
16
16
  return {
17
17
  title: t('pageTitle'),
18
18
  description: t('welcomeBack'),
@@ -24,31 +24,34 @@ function LoginFormSkeleton() {
24
24
  <Card>
25
25
  <CardContent className="space-y-4 pt-6">
26
26
  <div className="space-y-2">
27
- <Skeleton className="h-4 w-12"/>
28
- <Skeleton className="h-10 w-full"/>
27
+ <Skeleton className="h-4 w-12" />
28
+ <Skeleton className="h-10 w-full" />
29
29
  </div>
30
30
  <div className="space-y-2">
31
- <Skeleton className="h-4 w-16"/>
32
- <Skeleton className="h-10 w-full"/>
31
+ <Skeleton className="h-4 w-16" />
32
+ <Skeleton className="h-10 w-full" />
33
33
  </div>
34
- <Skeleton className="h-10 w-full"/>
34
+ <Skeleton className="h-10 w-full" />
35
35
  </CardContent>
36
36
  <CardFooter className="flex flex-col space-y-4">
37
-
38
37
  <div className="flex flex-col items-center space-y-2">
39
- <Skeleton className="h-4 w-40"/>
38
+ <Skeleton className="h-4 w-40" />
40
39
  </div>
41
40
  </CardFooter>
42
41
  </Card>
43
42
  );
44
43
  }
45
44
 
46
- async function SignInContent({searchParams, locale}: { searchParams: Promise<Record<string, string | string[] | undefined>>; locale: string }) {
45
+ async function SignInContent({
46
+ searchParams,
47
+ locale,
48
+ }: {
49
+ searchParams: Promise<Record<string, string | string[] | undefined>>;
50
+ locale: string;
51
+ }) {
47
52
  const resolvedParams = await searchParams;
48
53
  const redirectTo = resolvedParams?.redirectTo as string | undefined;
49
- const safeRedirect = redirectTo?.startsWith('/') && !redirectTo.startsWith('//')
50
- ? redirectTo
51
- : '/';
54
+ const safeRedirect = redirectTo?.startsWith('/') && !redirectTo.startsWith('//') ? redirectTo : '/';
52
55
 
53
56
  const customer = await getActiveCustomer();
54
57
  if (customer) {
@@ -58,22 +61,24 @@ async function SignInContent({searchParams, locale}: { searchParams: Promise<Rec
58
61
  return <LoginForm redirectTo={redirectTo} />;
59
62
  }
60
63
 
61
- export default async function SignInPage({searchParams}: {searchParams: Promise<Record<string, string | string[] | undefined>>}) {
64
+ export default async function SignInPage({
65
+ searchParams,
66
+ }: {
67
+ searchParams: Promise<Record<string, string | string[] | undefined>>;
68
+ }) {
62
69
  // Use explicit {locale, namespace} form — the namespace-only form reads
63
70
  // from request context (headers), which is forbidden at page level with
64
71
  // cacheComponents/dynamicIO outside a Suspense boundary.
65
72
  const locale = (await rootLocale()) as Locale;
66
- const t = await getTranslations({locale, namespace: 'Auth'});
73
+ const t = await getTranslations({ locale, namespace: 'Auth' });
67
74
  return (
68
75
  <AuthPageShell>
69
76
  <div className="space-y-2 text-center">
70
77
  <h1 className="text-3xl font-bold">{t('signIn')}</h1>
71
- <p className="text-muted-foreground">
72
- {t('enterCredentials')}
73
- </p>
78
+ <p className="text-muted-foreground">{t('enterCredentials')}</p>
74
79
  </div>
75
- <Suspense fallback={<LoginFormSkeleton/>}>
76
- <SignInContent searchParams={searchParams} locale={locale}/>
80
+ <Suspense fallback={<LoginFormSkeleton />}>
81
+ <SignInContent searchParams={searchParams} locale={locale} />
77
82
  </Suspense>
78
83
  </AuthPageShell>
79
84
  );