import type { ComponentType } from 'react'; import type { Locale } from './i18n/types'; import type { ShopSummaryPeriod } from './shop-summary'; import { WelcomeEmail } from './welcome'; import { PasswordResetEmail } from './password-reset'; import { EmailVerifyEmail } from './email-verify'; import { UserInviteEmail } from './user-invite'; import { OrderConfirmationEmail } from './order-confirmation'; import { OrderPackingEmail } from './order-packing'; import { OrderOutForDeliveryEmail } from './order-out-for-delivery'; import { OrderDeliveredEmail } from './order-delivered'; import { OrderCancelledEmail } from './order-cancelled'; import { OrgInviteEmail } from './org-invite'; import { JoinCodeEmail } from './join-code'; import { ApprovalNeededEmail } from './approval-needed'; import { StatementReadyEmail } from './statement-ready'; import { CreditAlertEmail } from './credit-alert'; import { OrganisationVerifiedEmail } from './organisation-verified'; import { PrescriptionSubmittedEmail } from './prescription-submitted'; import { PrescriptionDecisionEmail } from './prescription-decision'; import { PrescriptionReadyEmail } from './prescription-ready'; import { LowStockEmail } from './low-stock'; import { DispatchAssignedEmail } from './dispatch-assigned'; import { ProcurementAlertEmail } from './procurement-alert'; import { PromotionalEmail } from './promotional'; import { ShopSummaryEmail } from './shop-summary'; export type TemplateCategory = | 'Auth' | 'Orders' | 'B2B' | 'Prescriptions' | 'Admin ops' | 'Marketing' | 'Analytics'; export interface TemplateMeta { id: string; name: string; category: TemplateCategory; component: ComponentType<{ locale?: Locale; period?: ShopSummaryPeriod }>; defaultProps?: Record; } export const templateCatalog: TemplateMeta[] = [ { id: 'welcome', name: 'Welcome', category: 'Auth', component: WelcomeEmail }, { id: 'password-reset', name: 'Password reset', category: 'Auth', component: PasswordResetEmail }, { id: 'email-verify', name: 'Email verify', category: 'Auth', component: EmailVerifyEmail }, { id: 'user-invite', name: 'User invite', category: 'Auth', component: UserInviteEmail }, { id: 'order-confirmation', name: 'Order confirmation', category: 'Orders', component: OrderConfirmationEmail }, { id: 'order-packing', name: 'Order packing', category: 'Orders', component: OrderPackingEmail }, { id: 'order-out-for-delivery', name: 'Out for delivery', category: 'Orders', component: OrderOutForDeliveryEmail }, { id: 'order-delivered', name: 'Order delivered', category: 'Orders', component: OrderDeliveredEmail }, { id: 'order-cancelled', name: 'Order cancelled', category: 'Orders', component: OrderCancelledEmail }, { id: 'org-invite', name: 'Organisation invite', category: 'B2B', component: OrgInviteEmail }, { id: 'join-code', name: 'Join code', category: 'B2B', component: JoinCodeEmail }, { id: 'approval-needed', name: 'Approval needed', category: 'B2B', component: ApprovalNeededEmail }, { id: 'statement-ready', name: 'Statement ready', category: 'B2B', component: StatementReadyEmail }, { id: 'credit-alert', name: 'Credit alert', category: 'B2B', component: CreditAlertEmail }, { id: 'organisation-verified', name: 'Organisation verified', category: 'B2B', component: OrganisationVerifiedEmail }, { id: 'prescription-submitted', name: 'Prescription submitted', category: 'Prescriptions', component: PrescriptionSubmittedEmail }, { id: 'prescription-decision', name: 'Prescription decision', category: 'Prescriptions', component: PrescriptionDecisionEmail }, { id: 'prescription-ready', name: 'Prescription ready', category: 'Prescriptions', component: PrescriptionReadyEmail }, { id: 'low-stock', name: 'Low stock', category: 'Admin ops', component: LowStockEmail }, { id: 'dispatch-assigned', name: 'Dispatch assigned', category: 'Admin ops', component: DispatchAssignedEmail }, { id: 'procurement-alert', name: 'Procurement alert', category: 'Admin ops', component: ProcurementAlertEmail }, { id: 'promotional', name: 'Promotional', category: 'Marketing', component: PromotionalEmail }, { id: 'shop-summary', name: 'Shop summary', category: 'Analytics', component: ShopSummaryEmail, defaultProps: { period: 'weekly' as ShopSummaryPeriod }, }, ]; export const templateMap = Object.fromEntries( templateCatalog.map((t) => [t.id, t]) ) as Record;