mirror of
https://github.com/hexastack/hexabot
synced 2025-04-10 07:45:57 +00:00
fix: typo naming
This commit is contained in:
parent
3ca4ca0e2b
commit
481851f713
@ -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.
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -390,7 +390,7 @@ export class BlockService extends BaseService<
|
||||
subscriberContext: SubscriberContext,
|
||||
settings: Settings,
|
||||
): string {
|
||||
return EnvelopeFactory.compileHandlerbarsTemplate(
|
||||
return EnvelopeFactory.compileHandlebarsTemplate(
|
||||
text,
|
||||
{
|
||||
...context,
|
||||
|
Loading…
Reference in New Issue
Block a user