Commit d8b1563
Complete migration to @spree/next package (#7)
* Complete migration to @spree/next package
Migrate all server-side data layer from direct @spree/sdk usage to @spree/next, which provides Server Actions for authentication, cart, checkout, and customer operations with built-in cookie-based auth and token refresh.
Changes:
- Add @spree/next@0.1.1 as dependency and configure transpilePackages
- Delete src/lib/spree.ts (client initialization now internal to @spree/next)
- Delete src/lib/data/auth-request.ts (token refresh now internal to @spree/next)
- Simplify src/lib/data/cookies.ts to only isAuthenticated() check
- Rewrite all data layer files to delegate to @spree/next Server Actions
- Fix React 19 hook ordering in CheckoutPage (use() before other hooks)
- Fix nested form issue in AddressStep component
Result: Reduced data layer from 867 to 252 lines while maintaining all functionality.
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
* Fix inconsistent error handling in cart and add return type to getCreditCards
Wrap addToCart, updateCartItem, removeCartItem in try/catch with structured
{ success, cart, error } returns for consistency with associateCartWithUser.
Update CartContext to handle the new structured return type. Add explicit
return type annotation to getCreditCards.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Wrap clearCart in structured error handling for consistency
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add Vitest test suite and GitHub Actions CI
Set up Vitest with React Testing Library and jsdom for unit/integration
testing. Add 58 tests across 5 test files covering the data layer (cart,
checkout, customer), CartContext, and ProductCard component. Add GitHub
Actions CI workflow with parallel lint, typecheck, and test jobs.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix Biome lint errors in test files and vitest config
Use node: protocol for path import, fix import ordering, and auto-format.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>1 parent b98856f commit d8b1563
File tree
29 files changed
+4492
-1226
lines changed- .github/workflows
- src
- __tests__
- app/[country]/[locale]/(checkout)/checkout/[id]
- components
- checkout
- products/__tests__
- contexts
- __tests__
- lib
- data
- __tests__
29 files changed
+4492
-1226
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
0 commit comments