Files
saleor-core-extensions/README.md
Unchained 7b52ab585a refactor: make app portable for open source
- Remove hardcoded api.manoonoils.com fetch patch
- Make allowedSaleorUrls configurable via ALLOWED_SALEOR_URLS env var
- Make email logo/company configurable via EMAIL_LOGO_URL, EMAIL_COMPANY_NAME
- Add comprehensive README with deployment docs
- Keep internal networking preference via SALEOR_API_URL env var
2026-03-27 06:23:54 +02:00

141 lines
4.6 KiB
Markdown

# Saleor Core Extensions
A Saleor app that sends email notifications for order events (created, fulfilled, cancelled) using React Email templates.
## Features
- **Order Created** - Sends confirmation emails to customer and admin
- **Order Fulfilled** - Sends shipping notification with tracking
- **Order Cancelled** - Sends cancellation notification
- **Multi-language** - Supports EN, SR, DE, FR
- **React Email** - Professional HTML emails with responsive design
## Installation
### Option 1: Install via Manifest URL
In your Saleor Dashboard, go to Apps → Install App → Enter manifest URL:
```
https://your-app-domain.com/api/manifest
```
### Option 2: Manual Installation
```bash
# Clone the repository
git clone https://github.com/your-org/saleor-core-extensions.git
cd saleor-core-extensions
# Install dependencies
pnpm install
# Build Docker image
docker build -t ghcr.io/your-org/saleor-core-extensions:latest .
# Deploy to your K8s cluster
kubectl apply -f deployment.yaml
```
## Configuration
### Environment Variables
| Variable | Required | Default | Description |
|----------|----------|---------|-------------|
| `SALEOR_API_URL` | Yes | - | Internal K8s URL for Saleor API (e.g., `http://saleor-api.saleor:8000/graphql/`) |
| `ALLOWED_SALEOR_URLS` | No | `http://localhost:3000` | Comma-separated list of allowed Saleor API URLs |
| `RESEND_API_KEY` | Yes | - | API key from [Resend.com](https://resend.com) |
| `FROM_EMAIL` | No | `support@mail.manoonoils.com` | Sender email address |
| `FROM_NAME` | No | `ManoonOils` | Sender name |
| `ADMIN_EMAILS` | Yes | - | Comma-separated admin emails for notifications |
| `SITE_URL` | No | `https://dev.manoonoils.com` | Public store URL |
| `DASHBOARD_URL` | No | `https://dashboard.manoonoils.com` | Saleor dashboard URL |
| `APP_IFRAME_BASE_URL` | Yes | - | Public URL where app is hosted |
| `APP_API_BASE_URL` | Yes | - | Same as APP_IFRAME_BASE_URL |
| `AUTH_DATA_FILE_PATH` | No | `/tmp/.auth-data.json` | Path for auth data storage |
| `EMAIL_LOGO_URL` | No | - | URL to company logo for emails |
| `EMAIL_COMPANY_NAME` | No | `Store` | Company name in emails |
| `EMAIL_FOOTER` | No | auto | Footer text in emails |
### Kubernetes Deployment
```yaml
env:
- name: SALEOR_API_URL
value: "http://saleor-api.saleor:8000/graphql/"
- name: APP_IFRAME_BASE_URL
value: "https://your-app.domain.com"
- name: APP_API_BASE_URL
value: "https://your-app.domain.com"
- name: RESEND_API_KEY
valueFrom:
secretKeyRef:
name: core-extensions-secrets
key: resend-api-key
- name: ADMIN_EMAILS
value: "admin@example.com"
```
## Architecture
```
┌─────────────────┐ Webhooks ┌──────────────────┐
│ Saleor Cloud │ ───────────────► │ Core Extensions │
│ │ │ App │
└─────────────────┘ └────────┬─────────┘
▲ │
│ ▼
│ ┌──────────────┐
│ │ Resend │
└────── GraphQL API ───────────│ (Email) │
└──────────────┘
```
### Internal Networking
The app uses `SALEOR_API_URL` to communicate with Saleor API internally, avoiding Cloudflare HTTP restrictions. The stored auth token is reused while the env var controls the API endpoint.
## Development
```bash
# Install dependencies
pnpm install
# Start development server
pnpm dev
# Generate GraphQL types
pnpm generate
# Build for production
pnpm build
```
## Project Structure
```
src/
├── emails/
│ ├── BaseLayout.tsx # Email layout with logo/footer
│ ├── OrderConfirmation.tsx # Order confirmation email
│ ├── OrderShipped.tsx # Order shipped email
│ └── OrderCancelled.tsx # Order cancelled email
├── lib/
│ ├── resend.ts # Email sending logic
│ └── create-graphq-client.ts
├── pages/
│ ├── api/
│ │ ├── manifest.ts # App manifest
│ │ └── register.ts # App registration
│ └── webhooks/
│ ├── order-created.ts
│ ├── order-fulfilled.ts
│ └── order-cancelled.ts
└── saleor-app.ts # APL configuration
```
## License
MIT