Unchained ab7dfbe48b refactor(webhook): modularize email and analytics code
Create service-oriented architecture for better maintainability:

- AnalyticsService: Centralized analytics tracking with OpenPanel
  - trackOrderReceived(), trackRevenue(), track()
  - Error handling that doesn't break main flow
  - Singleton pattern for single instance

- OrderNotificationService: Encapsulates all order email logic
  - sendOrderConfirmation() - customer + admin
  - sendOrderShipped() - with tracking info
  - sendOrderCancelled() - with reason
  - sendOrderPaid() - payment confirmation
  - Translation logic moved from webhook to service
  - Email formatting utilities encapsulated

- Webhook route refactored:
  - Reduced from 605 lines to ~250 lines
  - No business logic - only HTTP handling
  - Delegates to services for emails and analytics
  - Cleaner separation of concerns

- New utils file: formatPrice() shared between services

This prevents future bugs by:
1. Centralizing email logic in one place
2. Making code testable (services can be unit tested)
3. Easier to add new webhook handlers
4. Translation logic not mixed with HTTP code
5. Analytics failures don't break order processing
2026-03-25 20:22:55 +02:00

This is a Next.js project bootstrapped with create-next-app.

Getting Started

First, run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev

Open http://localhost:3000 with your browser to see the result.

You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.

This project uses next/font to automatically optimize and load Geist, a new font family for Vercel.

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.

CI/CD Test

// Flux auto-deploy test - Sat Mar 7 10:55:48 AM EET 2026 // Auto-deploy test: 2026-03-07T09:02:49Z // Auto-deploy test: 2026-03-07T10:33:23Z // Auto-deploy test 2: 2026-03-07T10:37:05Z

Description
ManoonOils Headless Store
Readme 2.1 MiB
Languages
TypeScript 70.6%
Python 27.5%
CSS 1.7%
JavaScript 0.1%
Dockerfile 0.1%