fix: typo naming

This commit is contained in:
Mohamed Marrouchi 2025-03-24 11:11:37 +01:00
parent 3ca4ca0e2b
commit 481851f713
4 changed files with 9 additions and 9 deletions

View File

@ -34,7 +34,7 @@ The envelope helpers introduces two key components to streamline outgoing messag
- **Template Conversion & Compilation:**
- **toHandlebars:** Converts legacy single-curly brace templates (e.g., `{context.user.name}`) into Handlebars-style (`{{context.user.name}}`).
- **compileHandlerbarsTemplate:** Compiles and processes these templates by injecting contextual data, allowing dynamic content generation.
- **compileHandlebarsTemplate:** Compiles and processes these templates by injecting contextual data, allowing dynamic content generation.
- **Localization:**
Processes input text for localization using an integrated i18n service, ensuring that messages are tailored to the user's language settings.

View File

@ -92,12 +92,12 @@ describe('EnvelopeFactory', () => {
});
});
describe('compileHandlerbarsTemplate', () => {
describe('compileHandlebarsTemplate', () => {
it('should replace tokens with context variables correctly', () => {
const text =
'Hello {{context.user.first_name}} {{context.user.last_name}}, your phone is {{context.vars.phone}}';
const result = EnvelopeFactory.compileHandlerbarsTemplate(
const result = EnvelopeFactory.compileHandlebarsTemplate(
text,
context,
settings,
@ -121,7 +121,7 @@ describe('EnvelopeFactory', () => {
contact: {},
} as unknown as Settings;
const result = EnvelopeFactory.compileHandlerbarsTemplate(
const result = EnvelopeFactory.compileHandlebarsTemplate(
text,
context,
settings,
@ -133,7 +133,7 @@ describe('EnvelopeFactory', () => {
it('should use contact from settings if provided', () => {
const text = 'You can reach us at {{contact.company_email}}';
const result = EnvelopeFactory.compileHandlerbarsTemplate(
const result = EnvelopeFactory.compileHandlebarsTemplate(
text,
context,
settings,
@ -143,7 +143,7 @@ describe('EnvelopeFactory', () => {
it('should handle no placeholders gracefully', () => {
const text = 'No placeholders here.';
const result = EnvelopeFactory.compileHandlerbarsTemplate(
const result = EnvelopeFactory.compileHandlebarsTemplate(
text,
context,
settings,

View File

@ -68,7 +68,7 @@ export class EnvelopeFactory {
*
* @returns Text message with the tokens being replaced
*/
static compileHandlerbarsTemplate(
static compileHandlebarsTemplate(
text: string,
context: Context,
settings: Settings,
@ -99,7 +99,7 @@ export class EnvelopeFactory {
lang: this.context.user.language,
defaultValue: result,
});
result = EnvelopeFactory.compileHandlerbarsTemplate(
result = EnvelopeFactory.compileHandlebarsTemplate(
result,
this.context,
this.settings,

View File

@ -390,7 +390,7 @@ export class BlockService extends BaseService<
subscriberContext: SubscriberContext,
settings: Settings,
): string {
return EnvelopeFactory.compileHandlerbarsTemplate(
return EnvelopeFactory.compileHandlebarsTemplate(
text,
{
...context,