Piattaforma ITI TECHNOLOGY: monorepo, Medusa, API, sito, area riservata e deploy
Deploy stack su Proxmox / deploy (push) Failing after 3s
Deploy stack su Proxmox / deploy (push) Failing after 3s
Monorepo npm con apps/public (Angular SSR), apps/private (Angular SPA), apps/api (Fastify), packages/shared e packages/styles; Medusa 2.21 in medusa/; infrastruttura Docker (Postgres PostGIS+pgvector, Redis, Caddy, backup) e workflow Gitea Actions per il deploy via SSH a ogni push su master. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018jQyT6dR9czzGwqb7FkG6u
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
import { registerExisting, type RegisterExistingData, resetPassword, type ResetPasswordData, verifyEmail, type VerifyEmailData } from "./auth.js"
|
||||
import {
|
||||
installerApproved,
|
||||
type InstallerApprovedData,
|
||||
installerRejected,
|
||||
type InstallerRejectedData,
|
||||
quoteRequestAdmin,
|
||||
type QuoteRequestAdminData,
|
||||
quoteRequestReceived,
|
||||
type QuoteRequestReceivedData,
|
||||
quoteSent,
|
||||
type QuoteSentData,
|
||||
showroomBookingConfirmed,
|
||||
type ShowroomBookingConfirmedData,
|
||||
staffNotification,
|
||||
type StaffNotificationData,
|
||||
ticketReply,
|
||||
type TicketReplyData,
|
||||
} from "./business.js"
|
||||
import type { RenderedEmail } from "./layout.js"
|
||||
import {
|
||||
orderCanceled,
|
||||
type OrderCanceledData,
|
||||
orderConfirmation,
|
||||
type OrderConfirmationData,
|
||||
orderPlacedAdmin,
|
||||
type OrderPlacedAdminData,
|
||||
orderShipped,
|
||||
type OrderShippedData,
|
||||
} from "./orders.js"
|
||||
|
||||
export type { RenderedEmail } from "./layout.js"
|
||||
export type { OrderEmailData } from "./orders.js"
|
||||
|
||||
/** Dati richiesti da ogni template (il nome è anche il tag inviato al provider). */
|
||||
export type EmailTemplates = {
|
||||
"verify-email": VerifyEmailData
|
||||
"reset-password": ResetPasswordData
|
||||
"register-existing": RegisterExistingData
|
||||
"order-confirmation": OrderConfirmationData
|
||||
"order-placed-admin": OrderPlacedAdminData
|
||||
"order-canceled": OrderCanceledData
|
||||
"order-shipped": OrderShippedData
|
||||
"quote-request-admin": QuoteRequestAdminData
|
||||
"quote-request-received": QuoteRequestReceivedData
|
||||
"quote-sent": QuoteSentData
|
||||
"ticket-reply": TicketReplyData
|
||||
"showroom-booking-confirmed": ShowroomBookingConfirmedData
|
||||
"staff-notification": StaffNotificationData
|
||||
"installer-approved": InstallerApprovedData
|
||||
"installer-rejected": InstallerRejectedData
|
||||
}
|
||||
export type EmailTemplate = keyof EmailTemplates
|
||||
|
||||
const renderers: { [K in EmailTemplate]: (data: EmailTemplates[K]) => RenderedEmail } = {
|
||||
"verify-email": verifyEmail,
|
||||
"reset-password": resetPassword,
|
||||
"register-existing": registerExisting,
|
||||
"order-confirmation": orderConfirmation,
|
||||
"order-placed-admin": orderPlacedAdmin,
|
||||
"order-canceled": orderCanceled,
|
||||
"order-shipped": orderShipped,
|
||||
"quote-request-admin": quoteRequestAdmin,
|
||||
"quote-request-received": quoteRequestReceived,
|
||||
"quote-sent": quoteSent,
|
||||
"ticket-reply": ticketReply,
|
||||
"showroom-booking-confirmed": showroomBookingConfirmed,
|
||||
"staff-notification": staffNotification,
|
||||
"installer-approved": installerApproved,
|
||||
"installer-rejected": installerRejected,
|
||||
}
|
||||
|
||||
export const EMAIL_TEMPLATES = Object.keys(renderers) as EmailTemplate[]
|
||||
|
||||
/** Renderizza un template (oggetto, HTML con layout comune, testo). */
|
||||
export function renderEmail<T extends EmailTemplate>(template: T, data: EmailTemplates[T]): RenderedEmail {
|
||||
return renderers[template](data)
|
||||
}
|
||||
Reference in New Issue
Block a user