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:** - **Template Conversion & Compilation:**
- **toHandlebars:** Converts legacy single-curly brace templates (e.g., `{context.user.name}`) into Handlebars-style (`{{context.user.name}}`). - **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:** - **Localization:**
Processes input text for localization using an integrated i18n service, ensuring that messages are tailored to the user's language settings. 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', () => { it('should replace tokens with context variables correctly', () => {
const text = const text =
'Hello {{context.user.first_name}} {{context.user.last_name}}, your phone is {{context.vars.phone}}'; 'Hello {{context.user.first_name}} {{context.user.last_name}}, your phone is {{context.vars.phone}}';
const result = EnvelopeFactory.compileHandlerbarsTemplate( const result = EnvelopeFactory.compileHandlebarsTemplate(
text, text,
context, context,
settings, settings,
@ -121,7 +121,7 @@ describe('EnvelopeFactory', () => {
contact: {}, contact: {},
} as unknown as Settings; } as unknown as Settings;
const result = EnvelopeFactory.compileHandlerbarsTemplate( const result = EnvelopeFactory.compileHandlebarsTemplate(
text, text,
context, context,
settings, settings,
@ -133,7 +133,7 @@ describe('EnvelopeFactory', () => {
it('should use contact from settings if provided', () => { it('should use contact from settings if provided', () => {
const text = 'You can reach us at {{contact.company_email}}'; const text = 'You can reach us at {{contact.company_email}}';
const result = EnvelopeFactory.compileHandlerbarsTemplate( const result = EnvelopeFactory.compileHandlebarsTemplate(
text, text,
context, context,
settings, settings,
@ -143,7 +143,7 @@ describe('EnvelopeFactory', () => {
it('should handle no placeholders gracefully', () => { it('should handle no placeholders gracefully', () => {
const text = 'No placeholders here.'; const text = 'No placeholders here.';
const result = EnvelopeFactory.compileHandlerbarsTemplate( const result = EnvelopeFactory.compileHandlebarsTemplate(
text, text,
context, context,
settings, settings,

View File

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

View File

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