| 171 | } |
| 172 | |
| 173 | configure( |
| 174 | { |
| 175 | headerTitle = '', |
| 176 | rightHeader = {"text": "", "link": ""}, |
| 177 | readme = '',}:{ |
| 178 | headerTitle?: string; |
| 179 | rightHeader?: { text?: string; link?: string }; |
| 180 | readme?: string; |
| 181 | } |
| 182 | ): void { |
| 183 | if (!isObject(rightHeader)) { |
| 184 | throw new Error('rightHeader must be an object'); |
| 185 | } |
| 186 | |
| 187 | const validKeys = ['text', 'link']; |
| 188 | if (!Object.keys(rightHeader).every((key) => validKeys.includes(key))) { |
| 189 | throw new Error("rightHeader can only contain 'text' and 'link' keys"); |
| 190 | } |
| 191 | |
| 192 | if (!readme || readme.trim() === '') { |
| 193 | readme = getReadme(); |
| 194 | } |
| 195 | |
| 196 | this.config = { |
| 197 | "header_title":headerTitle, |
| 198 | "right_header":rightHeader, |
| 199 | "readme":readme, |
| 200 | }; |
| 201 | } |
| 202 | |
| 203 | addWhatsAppSupport(options: WhatsAppSupportOptions) { |
| 204 | if (options.number.length !== 10) { |