import { GenericTemplate } from './templates' ; module author Christos Panagiotakopoulos <chrispanag@gmail.com>
 *  copyright license typedef SerializedButton property { string } type property { ... string } params /** A General button class */ export class Button { public type : string ; public params : Record < string , unknown > ; param { string } type param { object } params constructor ( type , params = { } ) { this . type = type ; this . params = params ; } returns { SerializedButton } public serialize ( ) { const basicButton = { type : this . type } ; return Object . assign ( basicButton , this . params ) ; } } extends Button export class UrlButton extends Button { param { string } title param { string } url param { ? string } webview_height_ratio constructor ( title , url , webview_height_ratio = 'full' , messenger_extensions = false ) { super ( 'web_url' , { title , url , webview_height_ratio , messenger_extensions } ) ; } } extends Button export class CallButton extends Button { param { string } title param { string } payload constructor ( title , payload ) { super ( 'phone_number' , { title , payload } ) ; } } extends Button export class PostbackButton extends Button { param { string } title param { object | string } payload constructor ( title , payload = '' ) { let serializedPayload = payload ; if ( typeof payload === 'object' ) { serializedPayload = JSON . stringify ( payload ) ; } super ( 'postback' , { title , payload : serializedPayload } ) ; } }