Extract admin dashboard from ghabilee-frontend2 into a dedicated Next.js app for backoffice.ghabilee.ir (no SEO indexing / Clarity).
10 lines
498 B
TypeScript
10 lines
498 B
TypeScript
export const renderNotificationTemplate = (template: string, variables: Record<string, string>) =>
|
|
template.replace(/\{\{([a-zA-Z0-9_]+)\}\}/g, (_match, key: string) => variables[key] ?? `{{${key}}}`)
|
|
|
|
export const renderNotificationActionUrlPreview = (template: string, variables: Record<string, string>) =>
|
|
template.replace(/\{\{([a-zA-Z0-9_]+)\}\}/g, (_match, key: string) => {
|
|
const value = variables[key]
|
|
|
|
return value === undefined ? `{{${key}}}` : encodeURIComponent(value)
|
|
})
|