create-brainerce-store 1.50.5 → 1.52.0

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 (230) hide show
  1. package/README.md +72 -0
  2. package/dist/index.js +146 -100
  3. package/messages/en.json +36 -1
  4. package/messages/he.json +36 -1
  5. package/package.json +1 -1
  6. package/templates/nextjs/base/.claude/commands/design.md +60 -0
  7. package/templates/nextjs/base/.env.local.ejs +5 -0
  8. package/templates/nextjs/base/.eslintrc.json +57 -3
  9. package/templates/nextjs/base/AGENTS.md +41 -0
  10. package/templates/nextjs/base/AI-GUIDE.md +143 -0
  11. package/templates/nextjs/base/CLAUDE.md +52 -0
  12. package/templates/nextjs/base/TRANSLATIONS.md +1 -1
  13. package/templates/nextjs/base/next.config.ts +2 -2
  14. package/templates/nextjs/base/package.json.ejs +52 -39
  15. package/templates/nextjs/base/src/app/account/page.tsx +5 -5
  16. package/templates/nextjs/base/src/app/api/auth/logout/route.ts +1 -1
  17. package/templates/nextjs/base/src/app/api/auth/reset-password/route.ts +2 -2
  18. package/templates/nextjs/base/src/app/api/store/[...path]/route.ts +1 -1
  19. package/templates/nextjs/base/src/app/auth/callback/page.tsx +4 -4
  20. package/templates/nextjs/base/src/app/blog/[slug]/page.tsx.ejs +4 -4
  21. package/templates/nextjs/base/src/app/blog/page.tsx.ejs +2 -2
  22. package/templates/nextjs/base/src/app/cart/page.tsx +2 -173
  23. package/templates/nextjs/base/src/app/checkout/page.tsx +12 -11
  24. package/templates/nextjs/base/src/app/contact/page.tsx +3 -3
  25. package/templates/nextjs/base/src/app/faq/page.tsx.ejs +2 -2
  26. package/templates/nextjs/base/src/app/forgot-password/page.tsx +4 -4
  27. package/templates/nextjs/base/src/app/globals.css +36 -30
  28. package/templates/nextjs/base/src/app/layout.tsx.ejs +12 -12
  29. package/templates/nextjs/base/src/app/login/page.tsx +4 -4
  30. package/templates/nextjs/base/src/app/order-confirmation/page.tsx +19 -12
  31. package/templates/nextjs/base/src/app/page.tsx +4 -4
  32. package/templates/nextjs/base/src/app/pages/[slug]/page.tsx.ejs +3 -3
  33. package/templates/nextjs/base/src/app/payment-complete/page.tsx +1 -1
  34. package/templates/nextjs/base/src/app/products/[slug]/page.tsx +6 -6
  35. package/templates/nextjs/base/src/app/products/page.tsx +4 -623
  36. package/templates/nextjs/base/src/app/register/page.tsx +4 -4
  37. package/templates/nextjs/base/src/app/reset-password/page.tsx +5 -5
  38. package/templates/nextjs/base/src/app/sitemap.ts +1 -1
  39. package/templates/nextjs/base/src/app/verify-email/page.tsx +5 -5
  40. package/templates/nextjs/base/src/components/account/address-book.tsx +3 -3
  41. package/templates/nextjs/base/src/components/account/order-customizations.tsx +3 -3
  42. package/templates/nextjs/base/src/components/account/order-history.tsx +13 -5
  43. package/templates/nextjs/base/src/components/account/order-payment-block.tsx +2 -2
  44. package/templates/nextjs/base/src/components/account/order-shipping-block.tsx +2 -2
  45. package/templates/nextjs/base/src/components/account/order-status-timeline.tsx +2 -2
  46. package/templates/nextjs/base/src/components/account/profile-section.tsx +3 -3
  47. package/templates/nextjs/base/src/components/auth/login-form.tsx +4 -4
  48. package/templates/nextjs/base/src/components/auth/oauth-buttons.tsx +4 -4
  49. package/templates/nextjs/base/src/components/auth/register-form.tsx +4 -4
  50. package/templates/nextjs/base/src/components/brainerce-bot.tsx +2 -2
  51. package/templates/nextjs/base/src/components/checkout/checkout-form.tsx +24 -3
  52. package/templates/nextjs/base/src/components/checkout/custom-fields-step.tsx +2 -2
  53. package/templates/nextjs/base/src/components/checkout/delivery-method-step.tsx +2 -2
  54. package/templates/nextjs/base/src/components/checkout/order-bump-card.tsx +4 -4
  55. package/templates/nextjs/base/src/components/checkout/payment-step.tsx +20 -16
  56. package/templates/nextjs/base/src/components/checkout/pickup-step.tsx +3 -3
  57. package/templates/nextjs/base/src/components/checkout/shipping-step.tsx +3 -3
  58. package/templates/nextjs/base/src/components/checkout/tax-display.tsx +3 -3
  59. package/templates/nextjs/base/src/components/seo/organization-json-ld.tsx +2 -2
  60. package/templates/nextjs/base/src/components/seo/product-json-ld.tsx +3 -3
  61. package/templates/nextjs/base/src/components/ui/accordion.tsx +53 -0
  62. package/templates/nextjs/base/src/components/ui/badge.tsx +32 -0
  63. package/templates/nextjs/base/src/components/ui/button.tsx +49 -0
  64. package/templates/nextjs/base/src/components/ui/card.tsx +55 -0
  65. package/templates/nextjs/base/src/components/ui/checkbox.tsx +28 -0
  66. package/templates/nextjs/base/src/components/ui/dialog.tsx +107 -0
  67. package/templates/nextjs/base/src/components/ui/input.tsx +22 -0
  68. package/templates/nextjs/base/src/components/ui/label.tsx +21 -0
  69. package/templates/nextjs/base/src/components/ui/radio-group.tsx +38 -0
  70. package/templates/nextjs/base/src/components/ui/select.tsx +153 -0
  71. package/templates/nextjs/base/src/components/ui/separator.tsx +26 -0
  72. package/templates/nextjs/base/src/components/ui/sheet.tsx +125 -0
  73. package/templates/nextjs/base/src/components/ui/skeleton.tsx +7 -0
  74. package/templates/nextjs/base/src/components/ui/tabs.tsx +55 -0
  75. package/templates/nextjs/base/src/components/ui/textarea.tsx +21 -0
  76. package/templates/nextjs/base/src/components/ui/tooltip.tsx +32 -0
  77. package/templates/nextjs/base/src/core/hooks/use-cart-page.ts +58 -0
  78. package/templates/nextjs/base/src/core/hooks/use-home-data.ts +51 -0
  79. package/templates/nextjs/base/src/core/hooks/use-product-listing.ts +295 -0
  80. package/templates/nextjs/base/src/core/hooks/use-product-page.ts +278 -0
  81. package/templates/nextjs/base/src/{hooks → core/hooks}/use-search.ts +1 -1
  82. package/templates/nextjs/base/src/{lib → core/lib}/brainerce.ts.ejs +1 -1
  83. package/templates/nextjs/base/src/core/lib/product-options.ts +121 -0
  84. package/templates/nextjs/base/src/{lib → core/lib}/resolve-currency.ts +1 -1
  85. package/templates/nextjs/base/src/{lib → core/lib}/safe-redirect.ts +1 -1
  86. package/templates/nextjs/base/src/{lib → core/lib}/sanitize.ts.ejs +1 -1
  87. package/templates/nextjs/base/src/{lib → core/lib}/use-currency.ts +1 -1
  88. package/templates/nextjs/base/src/{providers → core/providers}/store-provider.tsx.ejs +4 -4
  89. package/templates/nextjs/base/src/{components → ui}/cart/cart-bundle-offer.tsx +22 -16
  90. package/templates/nextjs/base/src/{components → ui}/cart/cart-item.tsx +8 -14
  91. package/templates/nextjs/base/src/{components → ui}/cart/cart-nudges.tsx +28 -39
  92. package/templates/nextjs/base/src/{components → ui}/cart/cart-summary.tsx +7 -5
  93. package/templates/nextjs/base/src/{components → ui}/cart/cart-upgrade-banner.tsx +13 -28
  94. package/templates/nextjs/base/src/ui/cart/cart-view.tsx +140 -0
  95. package/templates/nextjs/base/src/{components → ui}/cart/coupon-input.tsx +14 -25
  96. package/templates/nextjs/base/src/{components → ui}/cart/free-shipping-bar.tsx +6 -7
  97. package/templates/nextjs/base/src/{components → ui}/cart/reservation-countdown.tsx +95 -103
  98. package/templates/nextjs/base/src/ui/home/discount-banner-strip.tsx +20 -0
  99. package/templates/nextjs/base/src/ui/home/featured-products-section.tsx +24 -0
  100. package/templates/nextjs/base/src/ui/home/hero-section.tsx +27 -0
  101. package/templates/nextjs/base/src/ui/home/home-client.tsx +29 -0
  102. package/templates/nextjs/base/src/{components/content → ui/layout}/announcement-bar.tsx.ejs +116 -125
  103. package/templates/nextjs/base/src/ui/layout/faq-section.tsx.ejs +90 -0
  104. package/templates/nextjs/base/src/{components/content → ui/layout}/header-account.tsx +5 -20
  105. package/templates/nextjs/base/src/ui/layout/language-switcher.tsx.ejs +80 -0
  106. package/templates/nextjs/base/src/{components/content → ui/layout}/rich-text-block.tsx.ejs +1 -1
  107. package/templates/nextjs/base/src/{components/content → ui/layout}/site-footer.tsx.ejs +144 -164
  108. package/templates/nextjs/base/src/{components/content → ui/layout}/site-header.tsx.ejs +152 -182
  109. package/templates/nextjs/base/src/{components/products → ui/product}/customization-fields.tsx +457 -478
  110. package/templates/nextjs/base/src/{components/products → ui/product}/discount-badge.tsx +18 -22
  111. package/templates/nextjs/base/src/{components/products → ui/product}/frequently-bought-together.tsx +21 -33
  112. package/templates/nextjs/base/src/ui/product/modifier-group-selector.tsx +206 -0
  113. package/templates/nextjs/base/src/{components/shared → ui/product}/price-display.tsx +5 -4
  114. package/templates/nextjs/base/src/{components/products → ui/product}/product-card.tsx +238 -271
  115. package/templates/nextjs/base/src/{app/products/[slug] → ui/product}/product-client-section.tsx +455 -631
  116. package/templates/nextjs/base/src/{components/products → ui/product}/product-grid.tsx +3 -3
  117. package/templates/nextjs/base/src/ui/product/product-listing.tsx +446 -0
  118. package/templates/nextjs/base/src/{components/products → ui/product}/recommendation-section.tsx +102 -107
  119. package/templates/nextjs/base/src/{components/reviews → ui/product}/review-form.tsx +46 -45
  120. package/templates/nextjs/base/src/{components/reviews/reviews-section.tsx → ui/product/reviews-section.tsx.ejs} +38 -15
  121. package/templates/nextjs/base/src/{components/products → ui/product}/stock-badge.tsx +61 -63
  122. package/templates/nextjs/base/src/{components/products → ui/product}/variant-selector.tsx +3 -3
  123. package/templates/nextjs/base/src/{components → ui}/shared/cdn-image.tsx +1 -1
  124. package/templates/nextjs/base/src/{components → ui}/shared/loading-spinner.tsx +2 -2
  125. package/templates/nextjs/base/tailwind.config.ts +69 -30
  126. package/templates/nextjs/designs/atelier/app-overlay/layout.tsx.ejs +251 -0
  127. package/templates/nextjs/designs/atelier/globals.css +396 -0
  128. package/templates/nextjs/designs/atelier/messages-patch/en.json +99 -0
  129. package/templates/nextjs/designs/atelier/messages-patch/he.json +99 -0
  130. package/templates/nextjs/designs/atelier/ui/cart/cart-bundle-offer.tsx +110 -0
  131. package/templates/nextjs/designs/atelier/ui/cart/cart-drawer.tsx +163 -0
  132. package/templates/nextjs/designs/atelier/ui/cart/cart-item.tsx +140 -0
  133. package/templates/nextjs/designs/atelier/ui/cart/cart-nudges.tsx +34 -0
  134. package/templates/nextjs/designs/atelier/ui/cart/cart-summary.tsx +107 -0
  135. package/templates/nextjs/designs/atelier/ui/cart/cart-upgrade-banner.tsx +123 -0
  136. package/templates/nextjs/designs/atelier/ui/cart/cart-view.tsx +147 -0
  137. package/templates/nextjs/designs/atelier/ui/cart/coupon-input.tsx +142 -0
  138. package/templates/nextjs/designs/atelier/ui/cart/free-shipping-bar.tsx +77 -0
  139. package/templates/nextjs/designs/atelier/ui/cart/reservation-countdown.tsx +89 -0
  140. package/templates/nextjs/designs/atelier/ui/home/benefits-band.tsx +34 -0
  141. package/templates/nextjs/designs/atelier/ui/home/category-tiles.tsx +148 -0
  142. package/templates/nextjs/designs/atelier/ui/home/discount-banner-strip.tsx +27 -0
  143. package/templates/nextjs/designs/atelier/ui/home/editorial-band.tsx +73 -0
  144. package/templates/nextjs/designs/atelier/ui/home/featured-products-section.tsx +36 -0
  145. package/templates/nextjs/designs/atelier/ui/home/hero-section.tsx +148 -0
  146. package/templates/nextjs/designs/atelier/ui/home/home-client.tsx +54 -0
  147. package/templates/nextjs/designs/atelier/ui/home/newsletter-section.tsx +78 -0
  148. package/templates/nextjs/designs/atelier/ui/home/testimonials-band.tsx +46 -0
  149. package/templates/nextjs/designs/atelier/ui/layout/announcement-bar.tsx +118 -0
  150. package/templates/nextjs/designs/atelier/ui/layout/faq-section.tsx +96 -0
  151. package/templates/nextjs/designs/atelier/ui/layout/header-account.tsx +36 -0
  152. package/templates/nextjs/designs/atelier/ui/layout/header-cart.tsx +36 -0
  153. package/templates/nextjs/designs/atelier/ui/layout/language-switcher.tsx.ejs +137 -0
  154. package/templates/nextjs/designs/atelier/ui/layout/nav-url.ts +14 -0
  155. package/templates/nextjs/designs/atelier/ui/layout/rich-text-block.tsx +34 -0
  156. package/templates/nextjs/designs/atelier/ui/layout/site-footer.tsx.ejs +141 -0
  157. package/templates/nextjs/designs/atelier/ui/layout/site-header.tsx.ejs +138 -0
  158. package/templates/nextjs/designs/atelier/ui/product/customization-fields.tsx +466 -0
  159. package/templates/nextjs/designs/atelier/ui/product/discount-badge.tsx +17 -0
  160. package/templates/nextjs/designs/atelier/ui/product/frequently-bought-together.tsx +196 -0
  161. package/templates/nextjs/designs/atelier/ui/product/modifier-group-selector.tsx +193 -0
  162. package/templates/nextjs/designs/atelier/ui/product/price-display.tsx +69 -0
  163. package/templates/nextjs/designs/atelier/ui/product/product-card.tsx +260 -0
  164. package/templates/nextjs/designs/atelier/ui/product/product-client-section.tsx +471 -0
  165. package/templates/nextjs/designs/atelier/ui/product/product-grid.tsx +47 -0
  166. package/templates/nextjs/designs/atelier/ui/product/product-listing.tsx +260 -0
  167. package/templates/nextjs/designs/atelier/ui/product/recommendation-section.tsx +95 -0
  168. package/templates/nextjs/designs/atelier/ui/product/review-form.tsx +267 -0
  169. package/templates/nextjs/designs/atelier/ui/product/reviews-section.tsx.ejs +148 -0
  170. package/templates/nextjs/designs/atelier/ui/product/stock-badge.tsx +66 -0
  171. package/templates/nextjs/designs/atelier/ui/product/variant-selector.tsx +206 -0
  172. package/templates/nextjs/designs/atelier/ui/shared/cdn-image.tsx +29 -0
  173. package/templates/nextjs/designs/atelier/ui/shared/fly-to-cart.ts +86 -0
  174. package/templates/nextjs/designs/atelier/ui/shared/icons.tsx +269 -0
  175. package/templates/nextjs/designs/atelier/ui/shared/loading-spinner.tsx +64 -0
  176. package/templates/nextjs/designs/atelier/ui/shared/reveal.tsx +71 -0
  177. package/templates/nextjs/designs/atelier/ui/shared/select-menu.tsx +125 -0
  178. package/templates/nextjs/themes/luxury/globals.css +405 -399
  179. package/templates/nextjs/themes/minimal/globals.css +36 -30
  180. package/templates/nextjs/themes/playful/globals.css +406 -400
  181. package/templates/nextjs/ui-canvas/cart/cart-bundle-offer.tsx +89 -0
  182. package/templates/nextjs/ui-canvas/cart/cart-item.tsx +123 -0
  183. package/templates/nextjs/ui-canvas/cart/cart-nudges.tsx +27 -0
  184. package/templates/nextjs/ui-canvas/cart/cart-summary.tsx +99 -0
  185. package/templates/nextjs/ui-canvas/cart/cart-upgrade-banner.tsx +105 -0
  186. package/templates/nextjs/ui-canvas/cart/cart-view.tsx +106 -0
  187. package/templates/nextjs/ui-canvas/cart/coupon-input.tsx +119 -0
  188. package/templates/nextjs/ui-canvas/cart/free-shipping-bar.tsx +54 -0
  189. package/templates/nextjs/ui-canvas/cart/reservation-countdown.tsx +81 -0
  190. package/templates/nextjs/ui-canvas/home/discount-banner-strip.tsx +19 -0
  191. package/templates/nextjs/ui-canvas/home/featured-products-section.tsx +23 -0
  192. package/templates/nextjs/ui-canvas/home/hero-section.tsx +21 -0
  193. package/templates/nextjs/ui-canvas/home/home-client.tsx +26 -0
  194. package/templates/nextjs/ui-canvas/layout/announcement-bar.tsx.ejs +101 -0
  195. package/templates/nextjs/ui-canvas/layout/faq-section.tsx.ejs +71 -0
  196. package/templates/nextjs/ui-canvas/layout/header-account.tsx +31 -0
  197. package/templates/nextjs/{base/src/components → ui-canvas}/layout/language-switcher.tsx.ejs +76 -70
  198. package/templates/nextjs/ui-canvas/layout/rich-text-block.tsx.ejs +36 -0
  199. package/templates/nextjs/ui-canvas/layout/site-footer.tsx.ejs +82 -0
  200. package/templates/nextjs/ui-canvas/layout/site-header.tsx.ejs +119 -0
  201. package/templates/nextjs/ui-canvas/product/customization-fields.tsx +445 -0
  202. package/templates/nextjs/ui-canvas/product/discount-badge.tsx +19 -0
  203. package/templates/nextjs/ui-canvas/product/frequently-bought-together.tsx +168 -0
  204. package/templates/nextjs/ui-canvas/product/modifier-group-selector.tsx +165 -0
  205. package/templates/nextjs/ui-canvas/product/price-display.tsx +52 -0
  206. package/templates/nextjs/ui-canvas/product/product-card.tsx +197 -0
  207. package/templates/nextjs/ui-canvas/product/product-client-section.tsx +352 -0
  208. package/templates/nextjs/ui-canvas/product/product-grid.tsx +27 -0
  209. package/templates/nextjs/ui-canvas/product/product-listing.tsx +224 -0
  210. package/templates/nextjs/ui-canvas/product/recommendation-section.tsx +99 -0
  211. package/templates/nextjs/ui-canvas/product/review-form.tsx +266 -0
  212. package/templates/nextjs/ui-canvas/product/reviews-section.tsx.ejs +96 -0
  213. package/templates/nextjs/ui-canvas/product/stock-badge.tsx +45 -0
  214. package/templates/nextjs/ui-canvas/product/variant-selector.tsx +212 -0
  215. package/templates/nextjs/ui-canvas/shared/cdn-image.tsx +31 -0
  216. package/templates/nextjs/ui-canvas/shared/loading-spinner.tsx +27 -0
  217. package/templates/nextjs/base/src/app/home-client.tsx +0 -98
  218. package/templates/nextjs/base/src/components/content/faq-section.tsx.ejs +0 -103
  219. package/templates/nextjs/base/src/components/products/modifier-group-selector.tsx +0 -238
  220. /package/templates/nextjs/base/src/{lib → core/lib}/auth.ts +0 -0
  221. /package/templates/nextjs/base/src/{lib → core/lib}/csrf.ts +0 -0
  222. /package/templates/nextjs/base/src/{lib → core/lib}/image-hosts.ts +0 -0
  223. /package/templates/nextjs/base/src/{lib → core/lib}/navigation.tsx.ejs +0 -0
  224. /package/templates/nextjs/base/src/{lib → core/lib}/nonce.ts +0 -0
  225. /package/templates/nextjs/base/src/{lib → core/lib}/sanitize-html.ts +0 -0
  226. /package/templates/nextjs/base/src/{lib → core/lib}/seo.ts +0 -0
  227. /package/templates/nextjs/base/src/{lib → core/lib}/store-info.ts +0 -0
  228. /package/templates/nextjs/base/src/{lib → core/lib}/translations.ts.ejs +0 -0
  229. /package/templates/nextjs/base/src/{lib → core/lib}/utils.ts +0 -0
  230. /package/templates/nextjs/base/src/{lib → core/lib}/validation.ts +0 -0
@@ -1,178 +1,7 @@
1
1
  'use client';
2
2
 
3
- import { useEffect, useState } from 'react';
4
- import { Link } from '@/lib/navigation';
5
- import type {
6
- CartRecommendationsResponse,
7
- CartUpgradesResponse,
8
- CartBundlesResponse,
9
- } from 'brainerce';
10
- import { getClient } from '@/lib/brainerce';
11
- import { useCart } from '@/providers/store-provider';
12
- import { CartItem } from '@/components/cart/cart-item';
13
- import { CartUpgradeBanner } from '@/components/cart/cart-upgrade-banner';
14
- import { CartBundleOfferCard } from '@/components/cart/cart-bundle-offer';
15
- import { CartSummary } from '@/components/cart/cart-summary';
16
- import { CouponInput } from '@/components/cart/coupon-input';
17
- import { CartNudges } from '@/components/cart/cart-nudges';
18
- import { FreeShippingBar } from '@/components/cart/free-shipping-bar';
19
- import { ReservationCountdown } from '@/components/cart/reservation-countdown';
20
- import { CartRecommendationSection } from '@/components/products/recommendation-section';
21
- import { LoadingSpinner } from '@/components/shared/loading-spinner';
22
- import { useTranslations } from '@/lib/translations';
3
+ import { CartView } from '@/ui/cart/cart-view';
23
4
 
24
5
  export default function CartPage() {
25
- const { cart, cartLoading, refreshCart, itemCount } = useCart();
26
- const t = useTranslations('cart');
27
- const tc = useTranslations('common');
28
- const [cartRecs, setCartRecs] = useState<CartRecommendationsResponse | null>(null);
29
- const [upgrades, setUpgrades] = useState<CartUpgradesResponse | null>(null);
30
- const [bundles, setBundles] = useState<CartBundlesResponse | null>(null);
31
-
32
- // Load recommendations, upgrades, and bundles in a single request
33
- useEffect(() => {
34
- if (!cart?.id || cart.items.length === 0) {
35
- setCartRecs(null);
36
- setUpgrades(null);
37
- setBundles(null);
38
- return;
39
- }
40
- const client = getClient();
41
- client
42
- .getCart(cart.id, { include: ['recommendations', 'upgrades', 'bundles'] })
43
- .then((enriched) => {
44
- setCartRecs(enriched.recommendations ?? null);
45
- setUpgrades(enriched.upgrades ?? null);
46
- setBundles(enriched.bundles ?? null);
47
- })
48
- .catch(() => {});
49
- }, [cart?.id, cart?.items.length]);
50
-
51
- if (cartLoading) {
52
- return (
53
- <div className="flex min-h-[60vh] items-center justify-center">
54
- <LoadingSpinner size="lg" />
55
- </div>
56
- );
57
- }
58
-
59
- // Empty cart state
60
- if (!cart || cart.items.length === 0) {
61
- return (
62
- <div className="mx-auto max-w-7xl px-4 py-16 text-center sm:px-6 lg:px-8">
63
- <svg
64
- className="text-muted-foreground mx-auto mb-4 h-16 w-16"
65
- fill="none"
66
- viewBox="0 0 24 24"
67
- stroke="currentColor"
68
- >
69
- <path
70
- strokeLinecap="round"
71
- strokeLinejoin="round"
72
- strokeWidth={1.5}
73
- d="M16 11V7a4 4 0 00-8 0v4M5 9h14l1 12H4L5 9z"
74
- />
75
- </svg>
76
- <h1 className="text-foreground text-2xl font-bold">{t('emptyTitle')}</h1>
77
- <p className="text-muted-foreground mt-2">{t('emptySubtitle')}</p>
78
- <Link
79
- href="/products"
80
- className="bg-primary text-primary-foreground mt-6 inline-flex items-center rounded px-6 py-3 font-medium transition-opacity hover:opacity-90"
81
- >
82
- {tc('continueShopping')}
83
- </Link>
84
- </div>
85
- );
86
- }
87
-
88
- return (
89
- <div className="mx-auto max-w-7xl px-4 py-8 sm:px-6 lg:px-8">
90
- <h1 className="text-foreground mb-6 text-2xl font-bold">
91
- {t('title')} ({itemCount} {itemCount === 1 ? tc('item') : tc('items')})
92
- </h1>
93
-
94
- {/* Reservation countdown */}
95
- {cart.reservation?.hasReservation && (
96
- <ReservationCountdown reservation={cart.reservation} className="mb-6" />
97
- )}
98
-
99
- <div className="grid grid-cols-1 gap-8 lg:grid-cols-3">
100
- {/* Cart Items */}
101
- <div className="lg:col-span-2">
102
- {/* Nudges */}
103
- {cart.nudges && cart.nudges.length > 0 && (
104
- <CartNudges nudges={cart.nudges} className="mb-4" />
105
- )}
106
-
107
- {/* Cart items */}
108
- <div>
109
- {cart.items.map((item) => (
110
- <div key={item.id}>
111
- <CartItem item={item} onUpdate={refreshCart} />
112
- {upgrades?.upgrades?.[item.productId] && (
113
- <CartUpgradeBanner
114
- suggestion={upgrades.upgrades[item.productId]}
115
- cartItem={item}
116
- onUpgrade={refreshCart}
117
- className="mb-2 ms-24"
118
- />
119
- )}
120
- </div>
121
- ))}
122
- </div>
123
-
124
- {/* Bundle offers */}
125
- {bundles?.bundles && bundles.bundles.length > 0 && (
126
- <div className="mt-6 space-y-3">
127
- <h3 className="text-foreground text-sm font-semibold">{t('bundleOffers')}</h3>
128
- {bundles.bundles.map((offer) => (
129
- <CartBundleOfferCard
130
- key={offer.id}
131
- offer={offer}
132
- cartId={cart.id}
133
- onAdd={refreshCart}
134
- />
135
- ))}
136
- </div>
137
- )}
138
-
139
- {/* Coupon input */}
140
- <div className="border-border mt-6 border-t pt-4">
141
- <CouponInput cart={cart} onUpdate={refreshCart} />
142
- </div>
143
- </div>
144
-
145
- {/* Summary sidebar */}
146
- <div className="lg:col-span-1">
147
- <div className="bg-muted/50 border-border sticky top-24 rounded-lg border p-6">
148
- <FreeShippingBar className="mb-4" />
149
- <CartSummary />
150
-
151
- <Link
152
- href="/checkout"
153
- className="bg-primary text-primary-foreground mt-6 inline-flex w-full items-center justify-center rounded px-6 py-3 text-sm font-medium transition-opacity hover:opacity-90"
154
- >
155
- {t('proceedToCheckout')}
156
- </Link>
157
-
158
- <Link
159
- href="/products"
160
- className="text-muted-foreground hover:text-foreground mt-3 inline-flex w-full items-center justify-center px-6 py-2 text-sm transition-colors"
161
- >
162
- {tc('continueShopping')}
163
- </Link>
164
- </div>
165
- </div>
166
- </div>
167
-
168
- {/* Cross-sell recommendations */}
169
- {cartRecs?.recommendations && cartRecs.recommendations.length > 0 && (
170
- <CartRecommendationSection
171
- title={t('youMightAlsoNeed')}
172
- items={cartRecs.recommendations}
173
- className="mt-10"
174
- />
175
- )}
176
- </div>
177
- );
6
+ return <CartView />;
178
7
  }
@@ -2,8 +2,8 @@
2
2
 
3
3
  import { Suspense, useEffect, useState, useCallback, useRef } from 'react';
4
4
  import { useSearchParams } from 'next/navigation';
5
- import { CdnImage as Image } from '@/components/shared/cdn-image';
6
- import { Link } from '@/lib/navigation';
5
+ import { CdnImage as Image } from '@/ui/shared/cdn-image';
6
+ import { Link } from '@/core/lib/navigation';
7
7
  import type {
8
8
  Checkout,
9
9
  ShippingRate,
@@ -14,9 +14,9 @@ import type {
14
14
  CheckoutCustomFieldDefinition,
15
15
  } from 'brainerce';
16
16
  import { formatPrice } from 'brainerce';
17
- import { getClient } from '@/lib/brainerce';
18
- import { useStoreInfo, useCart, useAuth } from '@/providers/store-provider';
19
- import { useCurrency } from '@/lib/use-currency';
17
+ import { getClient } from '@/core/lib/brainerce';
18
+ import { useStoreInfo, useCart, useAuth } from '@/core/providers/store-provider';
19
+ import { useCurrency } from '@/core/lib/use-currency';
20
20
  import { CheckoutForm } from '@/components/checkout/checkout-form';
21
21
  import { ShippingStep } from '@/components/checkout/shipping-step';
22
22
  import { PaymentStep } from '@/components/checkout/payment-step';
@@ -25,12 +25,12 @@ import { PickupStep } from '@/components/checkout/pickup-step';
25
25
  import { CustomFieldsStep } from '@/components/checkout/custom-fields-step';
26
26
  import { TaxDisplay } from '@/components/checkout/tax-display';
27
27
  import { OrderBumpCard } from '@/components/checkout/order-bump-card';
28
- import { CouponInput } from '@/components/cart/coupon-input';
29
- import { ReservationCountdown } from '@/components/cart/reservation-countdown';
30
- import { LoadingSpinner } from '@/components/shared/loading-spinner';
31
- import { useTranslations } from '@/lib/translations';
32
- import { cn } from '@/lib/utils';
33
- import { isValidCheckoutId } from '@/lib/safe-redirect';
28
+ import { CouponInput } from '@/ui/cart/coupon-input';
29
+ import { ReservationCountdown } from '@/ui/cart/reservation-countdown';
30
+ import { LoadingSpinner } from '@/ui/shared/loading-spinner';
31
+ import { useTranslations } from '@/core/lib/translations';
32
+ import { cn } from '@/core/lib/utils';
33
+ import { isValidCheckoutId } from '@/core/lib/safe-redirect';
34
34
 
35
35
  type CheckoutStep = 'method' | 'address' | 'shipping' | 'pickup' | 'custom-fields' | 'payment';
36
36
 
@@ -261,6 +261,7 @@ function CheckoutContent() {
261
261
  lastName: address.lastName,
262
262
  phone: address.phone,
263
263
  acceptsMarketing: consent.acceptsMarketing,
264
+ notes: address.notes,
264
265
  });
265
266
  setCheckout(updated);
266
267
  setStep('payment');
@@ -34,9 +34,9 @@
34
34
 
35
35
  import { useEffect, useMemo, useState } from 'react';
36
36
  import type { ContactFormPublic, ContactFormPublicField } from 'brainerce';
37
- import { getClient } from '@/lib/brainerce';
38
- import { LoadingSpinner } from '@/components/shared/loading-spinner';
39
- import { useTranslations } from '@/lib/translations';
37
+ import { getClient } from '@/core/lib/brainerce';
38
+ import { LoadingSpinner } from '@/ui/shared/loading-spinner';
39
+ import { useTranslations } from '@/core/lib/translations';
40
40
 
41
41
  type FieldValue = string | string[] | boolean;
42
42
 
@@ -11,8 +11,8 @@
11
11
  import * as React from 'react';
12
12
  import type { Metadata } from 'next';
13
13
 
14
- import { getServerClient } from '@/lib/brainerce';
15
- import { FaqSection } from '@/components/content/faq-section';
14
+ import { getServerClient } from '@/core/lib/brainerce';
15
+ import { FaqSection } from '@/ui/layout/faq-section';
16
16
  <% if (i18nEnabled) { %>
17
17
  type PageProps = {
18
18
  params: Promise<{ locale: string }>;
@@ -1,10 +1,10 @@
1
1
  'use client';
2
2
 
3
3
  import { useState } from 'react';
4
- import { Link } from '@/lib/navigation';
5
- import { getClient } from '@/lib/brainerce';
6
- import { LoadingSpinner } from '@/components/shared/loading-spinner';
7
- import { useTranslations } from '@/lib/translations';
4
+ import { Link } from '@/core/lib/navigation';
5
+ import { getClient } from '@/core/lib/brainerce';
6
+ import { LoadingSpinner } from '@/ui/shared/loading-spinner';
7
+ import { useTranslations } from '@/core/lib/translations';
8
8
 
9
9
  export default function ForgotPasswordPage() {
10
10
  const t = useTranslations('auth');
@@ -1,30 +1,36 @@
1
- @tailwind base;
2
- @tailwind components;
3
- @tailwind utilities;
4
-
5
- @layer base {
6
- :root {
7
- --background: 0 0% 100%;
8
- --foreground: 0 0% 9%;
9
- --primary: 0 0% 9%;
10
- --primary-foreground: 0 0% 98%;
11
- --secondary: 0 0% 96%;
12
- --secondary-foreground: 0 0% 9%;
13
- --muted: 0 0% 96%;
14
- --muted-foreground: 0 0% 45%;
15
- --accent: 0 0% 96%;
16
- --accent-foreground: 0 0% 9%;
17
- --destructive: 0 84% 60%;
18
- --destructive-foreground: 0 0% 98%;
19
- --border: 0 0% 90%;
20
- --radius: 0.5rem;
21
- }
22
-
23
- * {
24
- @apply border-border;
25
- }
26
-
27
- body {
28
- @apply bg-background text-foreground antialiased;
29
- }
30
- }
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
4
+
5
+ @layer base {
6
+ :root {
7
+ --background: 0 0% 100%;
8
+ --foreground: 0 0% 9%;
9
+ --primary: 0 0% 9%;
10
+ --primary-foreground: 0 0% 98%;
11
+ --secondary: 0 0% 96%;
12
+ --secondary-foreground: 0 0% 9%;
13
+ --muted: 0 0% 96%;
14
+ --muted-foreground: 0 0% 45%;
15
+ --accent: 0 0% 96%;
16
+ --accent-foreground: 0 0% 9%;
17
+ --destructive: 0 84% 60%;
18
+ --destructive-foreground: 0 0% 98%;
19
+ --border: 0 0% 90%;
20
+ --input: 0 0% 90%;
21
+ --ring: 0 0% 9%;
22
+ --card: 0 0% 100%;
23
+ --card-foreground: 0 0% 9%;
24
+ --popover: 0 0% 100%;
25
+ --popover-foreground: 0 0% 9%;
26
+ --radius: 0.5rem;
27
+ }
28
+
29
+ * {
30
+ @apply border-border;
31
+ }
32
+
33
+ body {
34
+ @apply bg-background text-foreground antialiased;
35
+ }
36
+ }
@@ -1,14 +1,14 @@
1
1
  <% if (i18nEnabled) { %>
2
2
  import type { Metadata } from 'next';
3
3
  <%- fontImport %>
4
- import { StoreProvider } from '@/providers/store-provider';
5
- import { AnnouncementBar } from '@/components/content/announcement-bar';
6
- import { SiteHeader } from '@/components/content/site-header';
7
- import { SiteFooter } from '@/components/content/site-footer';
4
+ import { StoreProvider } from '@/core/providers/store-provider';
5
+ import { AnnouncementBar } from '@/ui/layout/announcement-bar';
6
+ import { SiteHeader } from '@/ui/layout/site-header';
7
+ import { SiteFooter } from '@/ui/layout/site-footer';
8
8
  import { BrainerceBotWidget } from '@/components/brainerce-bot';
9
- import { getServerClient, fetchStoreInfo } from '@/lib/brainerce';
9
+ import { getServerClient, fetchStoreInfo } from '@/core/lib/brainerce';
10
10
  import { getDirection, supportedLocales } from '@/i18n';
11
- import { getNonce } from '@/lib/nonce';
11
+ import { getNonce } from '@/core/lib/nonce';
12
12
  import '../globals.css';
13
13
 
14
14
  <%- fontVariable %>
@@ -116,13 +116,13 @@ export default async function RootLayout({
116
116
  <% } else { %>
117
117
  import type { Metadata } from 'next';
118
118
  <%- fontImport %>
119
- import { StoreProvider } from '@/providers/store-provider';
120
- import { AnnouncementBar } from '@/components/content/announcement-bar';
121
- import { SiteHeader } from '@/components/content/site-header';
122
- import { SiteFooter } from '@/components/content/site-footer';
119
+ import { StoreProvider } from '@/core/providers/store-provider';
120
+ import { AnnouncementBar } from '@/ui/layout/announcement-bar';
121
+ import { SiteHeader } from '@/ui/layout/site-header';
122
+ import { SiteFooter } from '@/ui/layout/site-footer';
123
123
  import { BrainerceBotWidget } from '@/components/brainerce-bot';
124
- import { getServerClient, fetchStoreInfo } from '@/lib/brainerce';
125
- import { getNonce } from '@/lib/nonce';
124
+ import { getServerClient, fetchStoreInfo } from '@/core/lib/brainerce';
125
+ import { getNonce } from '@/core/lib/nonce';
126
126
  import './globals.css';
127
127
 
128
128
  <%- fontVariable %>
@@ -1,12 +1,12 @@
1
1
  'use client';
2
2
 
3
3
  import { useState } from 'react';
4
- import { useRouter, Link } from '@/lib/navigation';
5
- import { useAuth } from '@/providers/store-provider';
6
- import { proxyLogin } from '@/lib/auth';
4
+ import { useRouter, Link } from '@/core/lib/navigation';
5
+ import { useAuth } from '@/core/providers/store-provider';
6
+ import { proxyLogin } from '@/core/lib/auth';
7
7
  import { LoginForm } from '@/components/auth/login-form';
8
8
  import { OAuthButtons } from '@/components/auth/oauth-buttons';
9
- import { useTranslations } from '@/lib/translations';
9
+ import { useTranslations } from '@/core/lib/translations';
10
10
 
11
11
  export default function LoginPage() {
12
12
  const router = useRouter();
@@ -2,12 +2,12 @@
2
2
 
3
3
  import { Suspense, useEffect, useState } from 'react';
4
4
  import { useSearchParams } from 'next/navigation';
5
- import { Link } from '@/lib/navigation';
5
+ import { Link } from '@/core/lib/navigation';
6
6
  import type { WaitForOrderResult, OrderDownloadLink } from 'brainerce';
7
- import { getClient } from '@/lib/brainerce';
8
- import { useCart } from '@/providers/store-provider';
9
- import { LoadingSpinner } from '@/components/shared/loading-spinner';
10
- import { useTranslations } from '@/lib/translations';
7
+ import { getClient } from '@/core/lib/brainerce';
8
+ import { useCart } from '@/core/providers/store-provider';
9
+ import { LoadingSpinner } from '@/ui/shared/loading-spinner';
10
+ import { useTranslations } from '@/core/lib/translations';
11
11
 
12
12
  function OrderConfirmationContent() {
13
13
  const searchParams = useSearchParams();
@@ -35,20 +35,27 @@ function OrderConfirmationContent() {
35
35
  client.handlePaymentSuccess(checkoutId!);
36
36
  await refreshCart();
37
37
 
38
- // For redirect-based payment providers (e.g. CardCom), the customer
39
- // returns with provider params in the URL (lowprofilecode, etc.).
40
- // Send these to the backend for server-side verification via the
41
- // provider's API (e.g. GetLpResult) never trust URL params alone.
38
+ // For redirect-based payment providers, the customer returns with
39
+ // provider params in the URL — CardCom: lowprofilecode; PayPal:
40
+ // token + PayerID. Send these to the backend for server-side
41
+ // verification via the provider's API (e.g. GetLpResult / PayPal
42
+ // capture) — never trust URL params alone. For PayPal this call is
43
+ // what actually captures the approved payment.
42
44
  const lowProfileCode =
43
45
  searchParams.get('lowprofilecode') || searchParams.get('LowProfileCode');
44
- if (lowProfileCode) {
46
+ const paypalOrderToken =
47
+ searchParams.get('token') && searchParams.get('PayerID')
48
+ ? searchParams.get('token')
49
+ : null;
50
+ const redirectReturnToken = lowProfileCode || paypalOrderToken;
51
+ if (redirectReturnToken) {
45
52
  try {
46
53
  await client.confirmSdkPayment(checkoutId!, {
47
- paymentIntentId: lowProfileCode,
54
+ paymentIntentId: redirectReturnToken,
48
55
  });
49
56
  } catch (err) {
50
57
  console.warn('Redirect payment confirmation failed:', err);
51
- // Don't block — webhook may still process the payment
58
+ // Don't block — payment-status polling re-verifies server-side
52
59
  }
53
60
  }
54
61
 
@@ -1,9 +1,9 @@
1
1
  import type { Metadata } from 'next';
2
- import { getServerClient } from '@/lib/brainerce';
3
- import { buildMetaDescription } from '@/lib/seo';
2
+ import { getServerClient } from '@/core/lib/brainerce';
3
+ import { buildMetaDescription } from '@/core/lib/seo';
4
4
  import { OrganizationJsonLd } from '@/components/seo/organization-json-ld';
5
- import { RichTextBlock } from '@/components/content/rich-text-block';
6
- import { HomeClient } from './home-client';
5
+ import { RichTextBlock } from '@/ui/layout/rich-text-block';
6
+ import { HomeClient } from '@/ui/home/home-client';
7
7
 
8
8
  // Build homepage metadata server-side so Google, Facebook, WhatsApp etc.
9
9
  // see a real <meta name="description"> on first request. Falls back to the
@@ -15,9 +15,9 @@ import * as React from 'react';
15
15
  import type { Metadata } from 'next';
16
16
  import { notFound } from 'next/navigation';
17
17
 
18
- import { getServerClient } from '@/lib/brainerce';
19
- import { sanitizeHtml } from '@/lib/sanitize';
20
- import { decodeSlug } from '@/lib/utils';
18
+ import { getServerClient } from '@/core/lib/brainerce';
19
+ import { sanitizeHtml } from '@/core/lib/sanitize';
20
+ import { decodeSlug } from '@/core/lib/utils';
21
21
 
22
22
  <% if (i18nEnabled) { %>
23
23
  type PageProps = {
@@ -3,7 +3,7 @@
3
3
  import { useEffect } from 'react';
4
4
  import { useSearchParams } from 'next/navigation';
5
5
  import { Suspense } from 'react';
6
- import { LoadingSpinner } from '@/components/shared/loading-spinner';
6
+ import { LoadingSpinner } from '@/ui/shared/loading-spinner';
7
7
 
8
8
  /**
9
9
  * Lightweight callback page for iframe-based payment providers (e.g. CardCom).
@@ -1,13 +1,13 @@
1
1
  import type { Metadata } from 'next';
2
2
  import { notFound } from 'next/navigation';
3
3
  import { getProductPriceInfo } from 'brainerce';
4
- import { getServerClient, fetchStoreInfo } from '@/lib/brainerce';
5
- import { resolveCurrency } from '@/lib/resolve-currency';
6
- import { buildMetaDescription } from '@/lib/seo';
7
- import { decodeSlug } from '@/lib/utils';
4
+ import { getServerClient, fetchStoreInfo } from '@/core/lib/brainerce';
5
+ import { resolveCurrency } from '@/core/lib/resolve-currency';
6
+ import { buildMetaDescription } from '@/core/lib/seo';
7
+ import { decodeSlug } from '@/core/lib/utils';
8
8
  import { ProductJsonLd } from '@/components/seo/product-json-ld';
9
- import { ReviewsSection } from '@/components/reviews/reviews-section';
10
- import { ProductClientSection } from './product-client-section';
9
+ import { ReviewsSection } from '@/ui/product/reviews-section';
10
+ import { ProductClientSection } from '@/ui/product/product-client-section';
11
11
 
12
12
  type Props = {
13
13
  params: Promise<{ slug: string; locale?: string }>;