57 lines
3.0 KiB
TypeScript
57 lines
3.0 KiB
TypeScript
import type { NotificationChannel } from '@rentaldrivego/database';
|
|
import { prisma } from '../lib/prisma';
|
|
export declare const SUPPORTED_NOTIFICATION_LOCALES: readonly ["en", "fr", "ar"];
|
|
export type NotificationLocale = (typeof SUPPORTED_NOTIFICATION_LOCALES)[number];
|
|
export declare const DEFAULT_NOTIFICATION_LOCALE: NotificationLocale;
|
|
type TemplateDateValue = {
|
|
type: 'date';
|
|
value: Date | string | number;
|
|
options?: Intl.DateTimeFormatOptions;
|
|
};
|
|
type TemplateCurrencyValue = {
|
|
type: 'currency';
|
|
amountMinor: number;
|
|
currency: string;
|
|
};
|
|
type TemplateSubscriptionStatusValue = {
|
|
type: 'subscription_status';
|
|
status: string;
|
|
};
|
|
type TemplateInvoiceStatusValue = {
|
|
type: 'invoice_status';
|
|
status: string;
|
|
};
|
|
export type NotificationTemplateValue = string | number | boolean | Date | null | undefined | TemplateDateValue | TemplateCurrencyValue | TemplateSubscriptionStatusValue | TemplateInvoiceStatusValue;
|
|
export type NotificationTemplateVariables = Record<string, NotificationTemplateValue>;
|
|
type NotificationLocalizationDb = Pick<typeof prisma, 'brandSettings' | 'billingAccount' | 'employee' | 'notificationTemplate' | 'renter'>;
|
|
export declare function coerceNotificationLocale(locale?: string | null): NotificationLocale;
|
|
export declare function getNotificationTextDirection(locale: NotificationLocale): "ltr" | "rtl";
|
|
export declare function formatLocalizedDate(value: Date | string | number, locale: NotificationLocale, options?: Intl.DateTimeFormatOptions): string;
|
|
export declare function formatLocalizedCurrency(amountMinor: number, currency: string, locale: NotificationLocale): string;
|
|
export declare function localizeSubscriptionStatus(status: string, locale: NotificationLocale): string;
|
|
export declare function localizeInvoiceStatus(status: string, locale: NotificationLocale): string;
|
|
export declare function localizeBillingPeriod(period: string, locale: NotificationLocale): string;
|
|
export declare function localizePlanName(plan: string, locale: NotificationLocale): string;
|
|
export declare function resolveNotificationLocale(input: {
|
|
companyId?: string | null;
|
|
employeeId?: string | null;
|
|
renterId?: string | null;
|
|
billingAccountId?: string | null;
|
|
locale?: string | null;
|
|
}, db?: NotificationLocalizationDb): Promise<NotificationLocale>;
|
|
export declare function resolveNotificationTemplate(input: {
|
|
templateKey: string;
|
|
channel: NotificationChannel;
|
|
locale: NotificationLocale;
|
|
variables?: NotificationTemplateVariables;
|
|
}, db?: NotificationLocalizationDb): Promise<{
|
|
locale: "en" | "fr" | "ar";
|
|
subject: string | null;
|
|
body: string | null;
|
|
templateKey: string;
|
|
usedFallback: boolean;
|
|
}>;
|
|
export declare function renderNotificationText(template: string | null, variables: NotificationTemplateVariables | undefined, requiredVariables: string[] | undefined, locale: NotificationLocale): string | null;
|
|
export declare function renderLocalizedEmailHtml(body: string, locale: NotificationLocale): string;
|
|
export {};
|
|
//# sourceMappingURL=notificationLocalizationService.d.ts.map
|