/** * Custom Handlebars Helpers for Template Rendering * * Provides helpers for: * - Currency formatting * - Date formatting * - Number formatting * - Percentage formatting * - Conditional logic * - Mathematical operations * - String manipulation * - Invoice calculations */ import type Handlebars from 'handlebars'; import type { StorageTemplateInvoiceTotalArgs } from '@plyaz/types/storage'; /** * Format a number as currency * * @example * {{formatCurrency 1234.56}} -> $1,234.56 * {{formatCurrency 1000 'EUR' 'de-DE'}} -> 1.000,00 € */ export declare function formatCurrency(value: number, currency?: string | Handlebars.HelperOptions, locale?: string | Handlebars.HelperOptions): string; /** * Format a date * * @example * {{formatDate myDate}} -> January 1, 2025 * {{formatDate myDate 'short'}} -> 1/1/2025 * {{formatDate myDate 'long' 'es-ES'}} -> 1 de enero de 2025 */ export declare function formatDate(value: Date | string | number, style?: 'full' | 'long' | 'medium' | 'short' | Handlebars.HelperOptions, locale?: string | Handlebars.HelperOptions): string; /** * Format a number with thousands separators * * @example * {{formatNumber 1234567}} -> 1,234,567 * {{formatNumber 1234.5 2}} -> 1,234.50 */ export declare function formatNumber(value: number, decimals?: number | Handlebars.HelperOptions, locale?: string | Handlebars.HelperOptions): string; /** * Format a number as percentage * * @example * {{formatPercentage 0.15}} -> 15% * {{formatPercentage 0.1234 2}} -> 12.34% */ export declare function formatPercentage(value: number, decimals?: number | Handlebars.HelperOptions, locale?: string | Handlebars.HelperOptions): string; /** * Add two numbers * * @example * {{add 5 3}} -> 8 */ export declare function add(a: number, b: number): number; /** * Subtract two numbers * * @example * {{subtract 10 3}} -> 7 */ export declare function subtract(a: number, b: number): number; /** * Multiply two numbers * * @example * {{multiply 5 3}} -> 15 */ export declare function multiply(a: number, b: number): number; /** * Divide two numbers * * @example * {{divide 10 2}} -> 5 */ export declare function divide(a: number, b: number): number; /** * Check if value equals another value * * @example * {{#eq status 'paid'}}Payment received{{/eq}} */ export declare function eq(this: unknown, a: unknown, b: unknown, options: Handlebars.HelperOptions): string; /** * Check if value does not equal another value * * @example * {{#neq status 'paid'}}Payment pending{{/neq}} */ export declare function neq(this: unknown, a: unknown, b: unknown, options: Handlebars.HelperOptions): string; /** * Check if value is greater than another value * * @example * {{#gt total 1000}}Large order{{/gt}} */ export declare function gt(this: unknown, a: number, b: number, options: Handlebars.HelperOptions): string; /** * Check if value is less than another value * * @example * {{#lt total 100}}Small order{{/lt}} */ export declare function lt(this: unknown, a: number, b: number, options: Handlebars.HelperOptions): string; /** * Check if value is greater than or equal to another value * * @example * {{#gte total 1000}}Eligible for discount{{/gte}} */ export declare function gte(this: unknown, a: number, b: number, options: Handlebars.HelperOptions): string; /** * Check if value is less than or equal to another value * * @example * {{#lte items.length 5}}Few items{{/lte}} */ export declare function lte(this: unknown, a: number, b: number, options: Handlebars.HelperOptions): string; /** * Logical AND * * @example * {{#and isPaid isShipped}}Order complete{{/and}} */ export declare function and(this: unknown, a: unknown, b: unknown, options: Handlebars.HelperOptions): string; /** * Logical OR * * @example * {{#or isPending isFailed}}Needs attention{{/or}} */ export declare function or(this: unknown, a: unknown, b: unknown, options: Handlebars.HelperOptions): string; /** * Uppercase a string * * @example * {{uppercase 'hello'}} -> HELLO */ export declare function uppercase(value: string): string; /** * Lowercase a string * * @example * {{lowercase 'HELLO'}} -> hello */ export declare function lowercase(value: string): string; /** * Capitalize first letter * * @example * {{capitalize 'hello world'}} -> Hello world */ export declare function capitalize(value: string): string; /** * Calculate invoice totals (subtotal, discount, tax, or total) * * This helper is designed for Handlebars templates and accepts positional arguments. * * @example * {{invoiceTotal items taxRate discountPercent shippingCost "subtotal"}} * {{invoiceTotal items taxRate discountPercent shippingCost "discount"}} * {{invoiceTotal items taxRate discountPercent shippingCost "tax"}} * {{invoiceTotal items taxRate discountPercent shippingCost "total"}} */ export declare function invoiceTotal(...args: StorageTemplateInvoiceTotalArgs): number; /** * Truncate string to length * * @example * {{truncate description 50}} -> Truncates to 50 characters... */ export declare function truncate(value: string, length?: number | Handlebars.HelperOptions): string; /** * Get default helpers map * * @returns Map of helper name to function */ export declare function getDefaultHelpers(): Record;