(items)
| 500 | } |
| 501 | |
| 502 | function setSuggestions(items) { |
| 503 | if (!suggestionsEl) return; |
| 504 | suggestionsEl.textContent = ''; |
| 505 | const list = Array.isArray(items) ? items.filter(Boolean).slice(0, 4) : []; |
| 506 | if (!list.length) { |
| 507 | suggestionsEl.hidden = true; |
| 508 | return; |
| 509 | } |
| 510 | suggestionsEl.hidden = false; |
| 511 | list.forEach((item) => { |
| 512 | const btn = document.createElement('button'); |
| 513 | btn.type = 'button'; |
| 514 | btn.className = 'fr-share-pill'; |
| 515 | btn.textContent = String(item); |
| 516 | btn.addEventListener('click', function () { |
| 517 | if (inputEl) inputEl.value = String(item); |
| 518 | if (inputEl) inputEl.focus(); |
| 519 | }); |
| 520 | suggestionsEl.appendChild(btn); |
| 521 | }); |
| 522 | } |
| 523 | |
| 524 | async function sendMessage(message) { |
| 525 | const text = String(message || '').trim(); |
no outgoing calls
no test coverage detected