@@ -40,7 +40,7 @@ exports.handler = async (event) => {
4040 console.log('Template render request:', JSON.stringify(event, null, 2));
4141
4242 try {
43- const { templateId, data, locale, timezone } = JSON.parse(event.body || '{}');
43+ const { templateId, data, locale: _locale , timezone: _timezone } = JSON.parse(event.body || '{}');
4444
4545 if (!templateId) {
4646 return {
@@ -91,19 +91,19 @@ function renderTemplate(template, data) {
9191 });
9292
9393 // Handle {{#if condition}}...{{/if}} syntax
94- result = result.replace(/\\{\\{#if\\s+([\\w.]+)\\}\\}([\\s\\S]*?)\\{\\{\\/if\\}\\}/g, (match , key, content) => {
94+ result = result.replace(/\\{\\{#if\\s+([\\w.]+)\\}\\}([\\s\\S]*?)\\{\\{\\/if\\}\\}/g, (_match , key, content) => {
9595 const value = getNestedValue(data, key);
9696 return value ? content : '';
9797 });
9898
9999 // Handle {{#unless condition}}...{{/unless}} syntax
100- result = result.replace(/\\{\\{#unless\\s+([\\w.]+)\\}\\}([\\s\\S]*?)\\{\\{\\/unless\\}\\}/g, (match , key, content) => {
100+ result = result.replace(/\\{\\{#unless\\s+([\\w.]+)\\}\\}([\\s\\S]*?)\\{\\{\\/unless\\}\\}/g, (_match , key, content) => {
101101 const value = getNestedValue(data, key);
102102 return !value ? content : '';
103103 });
104104
105105 // Handle {{#each array}}...{{/each}} syntax
106- result = result.replace(/\\{\\{#each\\s+([\\w.]+)\\}\\}([\\s\\S]*?)\\{\\{\\/each\\}\\}/g, (match , key, content) => {
106+ result = result.replace(/\\{\\{#each\\s+([\\w.]+)\\}\\}([\\s\\S]*?)\\{\\{\\/each\\}\\}/g, (_match , key, content) => {
107107 const array = getNestedValue(data, key);
108108 if (!Array.isArray(array)) return '';
109109 return array.map((item, index) => {
@@ -393,19 +393,19 @@ The {{appName}} Team`,
393393 } )
394394
395395 // Handle {{#if condition}}...{{/if}} syntax
396- result = result . replace ( / \{ \{ # i f \s + ( [ \w . ] + ) \} \} ( [ \s \S ] * ?) \{ \{ \/ i f \} \} / g, ( match , key , content ) => {
396+ result = result . replace ( / \{ \{ # i f \s + ( [ \w . ] + ) \} \} ( [ \s \S ] * ?) \{ \{ \/ i f \} \} / g, ( _match , key , content ) => {
397397 const value = EmailTemplates . getNestedValue ( data , key )
398398 return value ? content : ''
399399 } )
400400
401401 // Handle {{#unless condition}}...{{/unless}} syntax
402- result = result . replace ( / \{ \{ # u n l e s s \s + ( [ \w . ] + ) \} \} ( [ \s \S ] * ?) \{ \{ \/ u n l e s s \} \} / g, ( match , key , content ) => {
402+ result = result . replace ( / \{ \{ # u n l e s s \s + ( [ \w . ] + ) \} \} ( [ \s \S ] * ?) \{ \{ \/ u n l e s s \} \} / g, ( _match , key , content ) => {
403403 const value = EmailTemplates . getNestedValue ( data , key )
404404 return ! value ? content : ''
405405 } )
406406
407407 // Handle {{#each array}}...{{/each}} syntax
408- result = result . replace ( / \{ \{ # e a c h \s + ( [ \w . ] + ) \} \} ( [ \s \S ] * ?) \{ \{ \/ e a c h \} \} / g, ( match , key , content ) => {
408+ result = result . replace ( / \{ \{ # e a c h \s + ( [ \w . ] + ) \} \} ( [ \s \S ] * ?) \{ \{ \/ e a c h \} \} / g, ( _match , key , content ) => {
409409 const array = EmailTemplates . getNestedValue ( data , key )
410410 if ( ! Array . isArray ( array ) ) return ''
411411 return array . map ( ( item , index ) => {
0 commit comments