@sphoro/bugcatch-web-sdk 0.14.2 → 0.14.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sphoro/bugcatch-web-sdk",
3
- "version": "0.14.2",
3
+ "version": "0.14.3",
4
4
  "description": "Drop-in browser SDK — report bugs with console, network and environment context, without the extension.",
5
5
  "type": "module",
6
6
  "main": "dist/bugcatch.es.js",
package/src/widget.js CHANGED
@@ -623,6 +623,15 @@ button.primary .spinner { border-color: rgba(255,255,255,.4); border-top-color:
623
623
  .att .file .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
624
624
  .att .file .sz { flex: none; color: var(--bc-faint); font-size: 11px; }
625
625
 
626
+ /* Quick answers under the confirm question — only on the latest message. */
627
+ .msg-row .quick { display: none; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
628
+ .msg-row:last-child .quick { display: flex; }
629
+ .quick button {
630
+ font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 999px; cursor: pointer;
631
+ border: 1px solid var(--bc-accent); background: transparent; color: var(--bc-accent);
632
+ }
633
+ .quick button:hover { background: color-mix(in srgb, var(--bc-accent) 12%, transparent); }
634
+
626
635
  /* ---------- the composer ---------- */
627
636
  .composer {
628
637
  position: sticky; bottom: 0; margin-top: auto;
@@ -2398,6 +2407,14 @@ function openPanel({ root, host, dock, client, onClose }) {
2398
2407
 
2399
2408
  sendBtn.addEventListener('click', send);
2400
2409
 
2410
+ // The confirm question's quick answers: the same as typing and sending.
2411
+ thread.addEventListener('click', (e) => {
2412
+ const quick = e.target.closest?.('[data-quick]');
2413
+ if (!quick || sending) return;
2414
+ input.value = quick.dataset.quick;
2415
+ send();
2416
+ });
2417
+
2401
2418
  async function send() {
2402
2419
  const text = input.value.trim();
2403
2420
  const ready = files.filter((f) => f.storageKey);
@@ -2621,10 +2638,21 @@ function messageHtml(message, state = '') {
2621
2638
  if (automated) who = '<span class="msg-who auto">Automatic reply</span>';
2622
2639
  else if (!mine && message.author) who = `<span class="msg-who">${escapeHtml(message.author)}</span>`;
2623
2640
 
2641
+ // "Is this the problem you are facing?" — the confirm question the
2642
+ // investigation asks (bugcatch-workers check-loop). One tap answers it; the
2643
+ // buttons only show on the latest message, so an answered question has none.
2644
+ const confirm = automated && /reply "yes" or "no"/i.test(body)
2645
+ ? `<div class="quick" role="group" aria-label="Answer">
2646
+ <button type="button" data-quick="Yes, this is the problem">Yes, that's it</button>
2647
+ <button type="button" data-quick="No, that is not the problem">No, it's something else</button>
2648
+ </div>`
2649
+ : '';
2650
+
2624
2651
  return `
2625
2652
  <div class="msg-row ${mine ? 'mine' : 'theirs'} ${automated ? 'auto' : ''} ${state}">
2626
2653
  ${who}
2627
2654
  <div class="bubble ${body ? '' : 'silent'}">${text}${files}</div>
2655
+ ${confirm}
2628
2656
  <span class="msg-when">${escapeHtml(relativeDay(message.at))}</span>
2629
2657
  </div>`;
2630
2658
  }