File tree Expand file tree Collapse file tree 1 file changed +2
-9
lines changed Expand file tree Collapse file tree 1 file changed +2
-9
lines changed Original file line number Diff line number Diff line change @@ -23,16 +23,9 @@ class Template {
23
23
if ( ! name ) throw new Error ( "Template must have a name" ) ;
24
24
if ( ! language ) throw new Error ( "Template must have a language" ) ;
25
25
26
- const temp = [ ] ;
27
- for ( let component of components ) {
28
- if ( component instanceof ButtonComponent ) temp . push ( ...component . build ( ) ) ;
29
- else temp . push ( component ) ;
30
- }
31
- components = temp ;
32
-
33
26
this . name = name ;
34
27
this . language = language instanceof Language ? language : new Language ( language ) ;
35
- if ( components ) this . components = components ;
28
+ if ( components ) this . components = components . map ( c => c . build ? c . build ( ) : c ) . flat ( ) ; ;
36
29
37
30
this . _ = "template" ;
38
31
}
@@ -233,7 +226,7 @@ class Parameter {
233
226
* For Document parameter, only PDF documents are supported for document-based message templates.
234
227
*
235
228
* @param {(Text|Currency|DateTime|Image|Document|Video) } parameter The parameter to be used in the template
236
- * @param {String } [ whoami] The parent component, used to check if a Text object is too long. Can be either 'header' or 'body'
229
+ * @param {String } whoami The parent component, used to check if a Text object is too long. Can be either 'header' or 'body'
237
230
* @throws {Error } If parameter is not provided
238
231
* @throws {Error } If parameter is a Text and the parent component (whoami) is "header" and the text over 60 characters
239
232
* @throws {Error } If parameter is a Text and the parent component (whoami) is "body" and the text over 1024 characters
You can’t perform that action at this time.
0 commit comments