Commit Graph

13 Commits

Author SHA1 Message Date
Unchained
646d057970 Merge branch 'feature/saleor-emails' into dev 2026-03-25 19:58:17 +02:00
Unchained
a0fa0f5401 fix(analytics): add OpenPanel revenue tracking to webhooks
Add OpenPanel import and initialization that was missing from webhook route.
Add order_received and revenue tracking when orders are confirmed.
Revenue tracking uses op.revenue() method with amount, currency,
order_id, and order_number properties.
2026-03-25 19:57:43 +02:00
Unchained
aa7a0ed3c8 fix(webhook): remove incorrect /100 division from formatPrice
Saleor stores amounts as actual currency values (e.g., 5479 RSD),
not as cents (e.g., 547900). The formatPrice function was incorrectly
dividing by 100, causing prices like 5479 RSD to display as 55 RSD.
2026-03-25 19:53:08 +02:00
Unchained
15a65758d7 fix(webhook): remove incorrect /100 division from formatPrice
Saleor stores amounts as actual currency values (e.g., 5479 RSD),
not as cents (e.g., 547900). The formatPrice function was incorrectly
dividing by 100, causing prices like 5479 RSD to display as 55 RSD.
2026-03-25 19:51:27 +02:00
Unchained
b5f8ddbaaa fix(analytics): add OpenPanel client secret and server-side tracking
Some checks failed
Build and Deploy / build (push) Has been cancelled
- Add OPENPANEL_CLIENT_SECRET for server-side tracking
- Add OPENPANEL_API_URL environment variable
- Add server-side OpenPanel tracking for orders
- Track order_received and revenue events on webhook,description:Commit OpenPanel fixes
2026-03-25 19:15:48 +02:00
Unchained
bf628f873f fix(webhook): prevent duplicate customer emails by only sending on ORDER_CONFIRMED
Some checks failed
Build and Deploy / build (push) Has been cancelled
Both ORDER_CREATED and ORDER_CONFIRMED were sending customer emails,
causing duplicates. Now only ORDER_CONFIRMED sends customer emails,
while both events still notify admins.
2026-03-25 16:17:35 +02:00
Unchained
eb311568db fix(webhook): get currency from channel.currency_code instead of top-level
Some checks failed
Build and Deploy / build (push) Has been cancelled
Saleor webhook payload stores currency in channel.currency_code,
not as a top-level currency field. Updated interfaces and conversion
function to use the correct location.
2026-03-25 15:32:49 +02:00
Unchained
c9aaacc452 fix(webhook): handle Saleor legacy webhook payload format with snake_case fields
Some checks failed
Build and Deploy / build (push) Has been cancelled
Saleor sends webhook payloads as arrays with snake_case fields:
- user_email instead of userEmail
- billing_address instead of billingAddress
- total_gross_amount instead of total.gross.amount
- etc.

Added convertPayloadToOrder() function to transform snake_case payload
to camelCase format expected by our email templates.
2026-03-25 15:22:40 +02:00
Unchained
e08e919e83 fix(webhook): handle Saleor subscription payload format (array)
Some checks failed
Build and Deploy / build (push) Has been cancelled
Saleor sends webhook payloads as arrays in subscription format.
This fix extracts the order from the array or object format.
2026-03-25 15:10:45 +02:00
Unchained
923f805d47 fix(webhook): normalize event names to uppercase for case-insensitive matching
Some checks failed
Build and Deploy / build (push) Has been cancelled
Saleor sends event names in lowercase (order_created) but our code
expects uppercase (ORDER_CREATED). This fix normalizes the event
name before checking supported events.
2026-03-25 14:59:32 +02:00
Unchained
5576946829 feat(emails): implement transactional email system with Resend
Some checks failed
Build and Deploy / build (push) Has been cancelled
- Add Resend email integration with @react-email/render
- Create email templates: OrderConfirmation, OrderShipped, OrderCancelled, OrderPaid
- Implement webhook handler for ORDER_CREATED and other events
- Add multi-language support for customer emails
- Admin emails in English with order details
- Update checkout page with auto-scroll on order completion
- Configure DASHBOARD_URL environment variable
2026-03-25 14:13:34 +02:00
Unchained
4fcd4b3ba8 refactor: abstract site URL across email templates
- Add NEXT_PUBLIC_SITE_URL to .env.local
- Update email templates to accept siteUrl prop
- Update webhook handler to pass siteUrl from env var
- Update create-webhooks.graphql with placeholder URL
2026-03-25 10:33:03 +02:00
Unchained
b8b3a57e6f feat: Add Saleor webhook handler with Resend email integration
- Add Resend SDK for transactional emails
- Create React Email templates for order events:
  - OrderConfirmation
  - OrderShipped
  - OrderCancelled
  - OrderPaid
- Multi-language support (SR, EN, DE, FR)
- Customer emails in their language
- Admin emails in English to me@hytham.me and tamara@hytham.me
- Webhook handler at /api/webhooks/saleor
- Supports: ORDER_CONFIRMED, ORDER_FULLY_PAID, ORDER_CANCELLED, ORDER_FULFILLED
- Add GraphQL mutation to create webhooks in Saleor
- Add Resend API key to .env.local
2026-03-25 10:10:57 +02:00