create-heresay 0.2.22 → 0.2.23

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.
@@ -33,7 +33,7 @@
33
33
  * a report; see "the trail" below. data-heresay-private on any element
34
34
  * keeps its text out of click records.
35
35
  * Offering help: data-nudge off (default) | on | the signals to watch, e.g. "clicks errors"
36
- * (clicks, errors, requests). When someone seems stuck, a small note
36
+ * (clicks, errors, requests; stalled, circles, refused). When someone seems stuck, a small note
37
37
  * by the button asks if they want to tell the team. See "offering
38
38
  * help" below.
39
39
  * Optional calls, any time after the script runs:
@@ -43,7 +43,7 @@
43
43
  * Feedback.open({ type, text }) type and text optional: starts a report already filled in
44
44
  * Feedback.on("sent", fn) fn({ id, type }) after each report is sent; returns an off()
45
45
  * Feedback.introduce({ title, body }) once per device: a bubble saying the button is there
46
- * Feedback.nudge() the app saw trouble itself: offer to report it, as data-nudge does
46
+ * Feedback.nudge({ stuck }) the app saw trouble itself: offer to report it, as data-nudge does
47
47
  * data-preview for the dashboard's designer: nothing is sent or stored
48
48
  * Feedback.openPreferences() a note about their setup, and a name and email if not signed in
49
49
  *
@@ -116,7 +116,7 @@
116
116
  trailHint: 'Recent pages, clicks and errors in this app. Never what you typed.',
117
117
  seeTrail: 'See it', alsoSent: 'Also sent: ',
118
118
  trail: { page: ['page', 'pages'], click: ['click', 'clicks'], request: ['failed request', 'failed requests'], error: ['error', 'errors'], warn: ['warning', 'warnings'], state: ['device event', 'device events'] },
119
- nudgeAria: 'Offer to report a problem', nudgeTitle: 'Something not working?', nudgeBody: 'Tell the team what happened. A real person reads it.', nudgeYes: 'Tell the team', nudgeNo: 'Not now',
119
+ nudgeStuckTitle: 'Stuck on something?', nudgeStuckBody: 'If something here isn’t clear, tell the team. A real person reads it.', nudgeAria: 'Offer to report a problem', nudgeTitle: 'Something not working?', nudgeBody: 'Tell the team what happened. A real person reads it.', nudgeYes: 'Tell the team', nudgeNo: 'Not now',
120
120
  sentTo: 'Sent to this app’s team', powered: 'Powered by Heresay',
121
121
  },
122
122
  fr: {
@@ -154,7 +154,7 @@
154
154
  trailHint: 'Pages, clics et erreurs récents dans cette app. Jamais ce que vous avez saisi.',
155
155
  seeTrail: 'Voir', alsoSent: 'Aussi envoyé : ',
156
156
  trail: { page: ['page', 'pages'], click: ['clic', 'clics'], request: ['requête échouée', 'requêtes échouées'], error: ['erreur', 'erreurs'], warn: ['avertissement', 'avertissements'], state: ['événement de l’appareil', 'événements de l’appareil'] },
157
- nudgeAria: 'Proposition de signaler un problème', nudgeTitle: 'Quelque chose ne marche pas ?', nudgeBody: 'Dites à l’équipe ce qui s’est passé. Une vraie personne le lit.', nudgeYes: 'Signaler', nudgeNo: 'Pas maintenant',
157
+ nudgeStuckTitle: 'Bloqué quelque part ?', nudgeStuckBody: 'Si quelque chose n’est pas clair ici, dites-le à l’équipe. Une vraie personne le lit.', nudgeAria: 'Proposition de signaler un problème', nudgeTitle: 'Quelque chose ne marche pas ?', nudgeBody: 'Dites à l’équipe ce qui s’est passé. Une vraie personne le lit.', nudgeYes: 'Signaler', nudgeNo: 'Pas maintenant',
158
158
  sentTo: 'Envoyé à l’équipe de cette app', powered: 'Propulsé par Heresay',
159
159
  },
160
160
  ta: {
@@ -192,7 +192,7 @@
192
192
  trailHint: 'இந்த ஆப்பில் சமீபத்திய பக்கங்கள், கிளிக்குகள், பிழைகள். நீங்கள் தட்டச்சு செய்தது ஒருபோதும் இல்லை.',
193
193
  seeTrail: 'பார்', alsoSent: 'இவையும் அனுப்பப்படும்: ',
194
194
  trail: { page: ['பக்கம்', 'பக்கங்கள்'], click: ['கிளிக்', 'கிளிக்குகள்'], request: ['தோல்வியடைந்த கோரிக்கை', 'தோல்வியடைந்த கோரிக்கைகள்'], error: ['பிழை', 'பிழைகள்'], warn: ['எச்சரிக்கை', 'எச்சரிக்கைகள்'], state: ['சாதன நிகழ்வு', 'சாதன நிகழ்வுகள்'] },
195
- nudgeAria: 'சிக்கலைத் தெரிவிக்க ஒரு அழைப்பு', nudgeTitle: 'ஏதாவது வேலை செய்யவில்லையா?', nudgeBody: 'என்ன நடந்தது என்று குழுவிடம் சொல்லுங்கள். ஒருவர் அதைப் படிப்பார்.', nudgeYes: 'குழுவிடம் சொல்', nudgeNo: 'இப்போது வேண்டாம்',
195
+ nudgeStuckTitle: 'எங்காவது சிக்கிக்கொண்டீர்களா?', nudgeStuckBody: 'இங்கே ஏதாவது புரியவில்லை என்றால், குழுவிடம் சொல்லுங்கள். ஒருவர் அதைப் படிப்பார்.', nudgeAria: 'சிக்கலைத் தெரிவிக்க ஒரு அழைப்பு', nudgeTitle: 'ஏதாவது வேலை செய்யவில்லையா?', nudgeBody: 'என்ன நடந்தது என்று குழுவிடம் சொல்லுங்கள். ஒருவர் அதைப் படிப்பார்.', nudgeYes: 'குழுவிடம் சொல்', nudgeNo: 'இப்போது வேண்டாம்',
196
196
  sentTo: 'இந்த ஆப்பின் குழுவுக்கு அனுப்பப்படும்', powered: 'Heresay மூலம் இயங்குகிறது',
197
197
  },
198
198
  hi: {
@@ -230,7 +230,7 @@
230
230
  trailHint: 'इस ऐप में हाल के पेज, क्लिक और त्रुटियाँ। आपने जो टाइप किया, वह कभी नहीं।',
231
231
  seeTrail: 'देखें', alsoSent: 'यह भी भेजा जाता है: ',
232
232
  trail: { page: ['पेज', 'पेज'], click: ['क्लिक', 'क्लिक'], request: ['विफल अनुरोध', 'विफल अनुरोध'], error: ['त्रुटि', 'त्रुटियाँ'], warn: ['चेतावनी', 'चेतावनियाँ'], state: ['डिवाइस घटना', 'डिवाइस घटनाएँ'] },
233
- nudgeAria: 'समस्या बताने का सुझाव', nudgeTitle: 'कुछ काम नहीं कर रहा?', nudgeBody: 'टीम को बताइए क्या हुआ। इसे कोई इंसान पढ़ता है।', nudgeYes: 'टीम को बताएँ', nudgeNo: 'अभी नहीं',
233
+ nudgeStuckTitle: 'कहीं अटक गए?', nudgeStuckBody: 'अगर यहाँ कुछ साफ़ नहीं है, तो टीम को बताइए। इसे कोई इंसान पढ़ता है।', nudgeAria: 'समस्या बताने का सुझाव', nudgeTitle: 'कुछ काम नहीं कर रहा?', nudgeBody: 'टीम को बताइए क्या हुआ। इसे कोई इंसान पढ़ता है।', nudgeYes: 'टीम को बताएँ', nudgeNo: 'अभी नहीं',
234
234
  sentTo: 'इस ऐप की टीम को भेजा जाता है', powered: 'Heresay द्वारा संचालित',
235
235
  },
236
236
  };
@@ -450,8 +450,8 @@
450
450
 
451
451
  /**
452
452
  * What happened in the app before a report: pages, clicks, requests that failed, errors. Kept
453
- * in memory on this device only (the newest 50, for 5 minutes) and sent only with a report,
454
- * only if the reporter leaves "Attach what happened" on. Never what anyone typed, never request
453
+ * on this device only, in memory and this tab's sessionStorage (the newest 50, for 5 minutes),
454
+ * and sent only with a report, only if the reporter leaves "Attach what happened" on. Never what anyone typed, never request
455
455
  * or response bodies or headers, never query strings. Nothing is recorded inside the widget.
456
456
  */
457
457
  var TRAIL_PARTS = { pages: 'page', clicks: 'click', requests: 'request', errors: 'error' };
@@ -465,8 +465,11 @@
465
465
  return on;
466
466
  })();
467
467
  var TRAIL_MAX = 50, TRAIL_AGE = 5 * 60000;
468
+ // Pages visited and when someone last typed, for data-nudge ("offering help"). Here because the
469
+ // page watcher below records the first page before that part of the script runs.
470
+ var visits = [], typedAt = 0;
468
471
  // data-nudge, read here because the request watchers below serve both. See "offering help".
469
- var NUDGE_SIGNALS = ['clicks', 'errors', 'requests'];
472
+ var NUDGE_SIGNALS = ['clicks', 'errors', 'requests', 'stalled', 'circles', 'refused'];
470
473
  var NUDGE = (function () {
471
474
  var v = attr('nudge').toLowerCase(), on = {};
472
475
  if (PREVIEW || !v || /^(off|none|false|no)$/.test(v)) return on;
@@ -501,6 +504,7 @@
501
504
  text = scrub(text, 200);
502
505
  if (!text) return;
503
506
  var now = Date.now(), last = trail[trail.length - 1];
507
+ keep();
504
508
  if (last && last.kind === kind && last.text === text) { last.n++; last.at = now; return last; }
505
509
  var e = { kind: kind, at: now, text: text, detail: detail ? scrub(detail, 600) : null, n: 1 };
506
510
  trail.push(e);
@@ -508,6 +512,38 @@
508
512
  return e;
509
513
  } catch (x) { /* never break the app over a record */ } finally { noting = false; }
510
514
  }
515
+
516
+ // The trail outlives a reload or a new page in this tab: kept in sessionStorage, which only this
517
+ // tab can read and the browser clears when it closes. So a page that froze or went blank and was
518
+ // reloaded still has what happened before it, and so does a site whose pages are separate loads.
519
+ var TRAIL_KEY = 'fbsdk.trail.' + KEY, keepTimer = null;
520
+ function keep() {
521
+ if (PREVIEW || keepTimer) return;
522
+ keepTimer = setTimeout(keepNow, 300);
523
+ }
524
+ function keepNow() {
525
+ clearTimeout(keepTimer); keepTimer = null;
526
+ try { sessionStorage.setItem(TRAIL_KEY, JSON.stringify(recentTrail())); } catch (e) { /* full or blocked */ }
527
+ }
528
+ if (!PREVIEW && Object.keys(TRAIL).length) {
529
+ try {
530
+ var kept = JSON.parse(sessionStorage.getItem(TRAIL_KEY) || '[]'), cut = Date.now() - TRAIL_AGE;
531
+ trail = (Array.isArray(kept) ? kept : []).filter(function (e) {
532
+ return e && typeof e.text === 'string' && TRAIL[e.kind] && e.at >= cut && e.at <= Date.now();
533
+ }).slice(-TRAIL_MAX);
534
+ } catch (e) { trail = []; }
535
+ var nav = window.performance && performance.getEntriesByType && performance.getEntriesByType('navigation')[0];
536
+ if (trail.length && nav && nav.type === 'reload') note('state', 'The page was reloaded');
537
+ window.addEventListener('pagehide', keepNow);
538
+ }
539
+
540
+ /** The first visit after the app's version changed: what broke often broke with the update. */
541
+ function versionSeen(v) {
542
+ if (!v || PREVIEW) return;
543
+ var k = 'fbsdk.version.' + KEY, seen = load(k);
544
+ if (seen && seen !== v) note('state', 'First visit since the app updated from ' + seen + ' to ' + v);
545
+ save(k, v);
546
+ }
511
547
  function recentTrail() {
512
548
  var cut = Date.now() - TRAIL_AGE;
513
549
  return trail.filter(function (e) { return e.at >= cut; });
@@ -529,7 +565,9 @@
529
565
  return (x.origin === location.origin ? '' : x.origin) + x.pathname;
530
566
  } catch (e) { return String(u).split(/[?#]/)[0]; }
531
567
  }
532
- function ours(u) { try { return new URL(u, location.href).href.indexOf(API) === 0; } catch (e) { return false; } }
568
+ // data-api may be relative ('/v1'), so both sides are made absolute before comparing.
569
+ var API_ABS = (function () { try { return new URL(API, location.href).href; } catch (e) { return API; } })();
570
+ function ours(u) { try { return new URL(u, location.href).href.indexOf(API_ABS) === 0; } catch (e) { return false; } }
533
571
  function frames(err) {
534
572
  var s = err && err.stack ? String(err.stack) : '';
535
573
  var f = s.split('\n').filter(function (l) { return /^\s*at\s|@/.test(l); }).slice(0, 3)
@@ -559,13 +597,14 @@
559
597
  var w = location.pathname + location.hash;
560
598
  if (w === lastWhere) return;
561
599
  lastWhere = w;
600
+ visited(w);
562
601
  if (first === true) { note('page', titled(w)); return; }
563
602
  // Single-page apps set the title just after the address: the entry goes in now, in order,
564
603
  // and gets the title a moment later.
565
604
  var e = note('page', w);
566
605
  if (e) setTimeout(function () { var t = scrub(titled(w), 200); if (t) e.text = t; }, 150);
567
606
  }
568
- if (TRAIL.page) {
607
+ if (TRAIL.page || NUDGE.circles) {
569
608
  onPage(true);
570
609
  ['pushState', 'replaceState'].forEach(function (m) {
571
610
  var orig = history[m];
@@ -653,7 +692,7 @@
653
692
  function slow(method, url, status, t0) {
654
693
  if (Date.now() - t0 >= 3000) note('warn', 'Slow request: ' + method + ' ' + shortUrl(url) + ' → ' + status + took(t0), null, 'request');
655
694
  }
656
- if ((TRAIL.request || NUDGE.requests) && window.fetch) {
695
+ if ((TRAIL.request || NUDGE.requests || NUDGE.stalled || NUDGE.circles) && window.fetch) {
657
696
  var ofetch = window.fetch;
658
697
  window.fetch = function (input, init) {
659
698
  var p = ofetch.apply(window, arguments);
@@ -664,7 +703,7 @@
664
703
  var t0 = Date.now();
665
704
  p.then(function (res) {
666
705
  if (!res.ok && res.type !== 'opaque') { note('request', method + ' ' + shortUrl(url) + ' → ' + res.status + took(t0)); requestFailed(res.status); }
667
- else slow(method, url, res.status, t0);
706
+ else { slow(method, url, res.status, t0); if (method !== 'GET' && method !== 'HEAD') sentSomething(); }
668
707
  }, function (err) {
669
708
  if (err && err.name === 'AbortError') return;
670
709
  note('request', method + ' ' + shortUrl(url) + ' → failed (' + (navigator.onLine === false ? 'offline' : 'network error') + ')' + took(t0));
@@ -675,7 +714,7 @@
675
714
  return p;
676
715
  };
677
716
  }
678
- if ((TRAIL.request || NUDGE.requests) && window.XMLHttpRequest) {
717
+ if ((TRAIL.request || NUDGE.requests || NUDGE.stalled || NUDGE.circles) && window.XMLHttpRequest) {
679
718
  var XP = XMLHttpRequest.prototype, xopen = XP.open, xsend = XP.send;
680
719
  XP.open = function (m, u) {
681
720
  try { this.__heresay = { m: String(m || 'GET').toUpperCase(), u: String(u) }; } catch (e) { /* ignore */ }
@@ -690,7 +729,7 @@
690
729
  x.addEventListener('loadend', function () {
691
730
  if (x.status >= 400) { note('request', r.m + ' ' + shortUrl(r.u) + ' → ' + x.status + took(t0)); requestFailed(x.status); }
692
731
  else if (x.status === 0 && !aborted) { note('request', r.m + ' ' + shortUrl(r.u) + ' → failed (network error)' + took(t0)); requestFailed(0); }
693
- else if (x.status) slow(r.m, r.u, x.status, t0);
732
+ else if (x.status) { slow(r.m, r.u, x.status, t0); if (r.m !== 'GET' && r.m !== 'HEAD') sentSomething(); }
694
733
  });
695
734
  }
696
735
  } catch (e) { /* ignore */ }
@@ -786,6 +825,15 @@
786
825
  * errors an uncaught error or failed promise within 5 s of a click
787
826
  * requests 2 requests failing (5xx or no answer) within 30 s, while online
788
827
  *
828
+ * And when someone seems unsure rather than blocked ("Stuck on something?", opening as Confusing):
829
+ *
830
+ * stalled typed in a field, then 45 s with no more typing and nothing sent, while still
831
+ * on the page and moving or scrolling (not away). Search boxes don't count.
832
+ * circles 6 page changes in a minute among at most 3 pages, one of them seen 3 times,
833
+ * with nothing sent
834
+ * refused the same field refused 3 times in 2 minutes (the browser's check, or the app
835
+ * setting aria-invalid)
836
+ *
789
837
  * At most once per tab, and not for 7 days after "Not now".
790
838
  */
791
839
  var DEAD_WAIT = 1500, DEAD_SPAN = 10000, DEAD_COUNT = 3;
@@ -860,7 +908,70 @@
860
908
  fails = fails.filter(function (t) { return now - t < 30000; }).concat(now);
861
909
  if (fails.length >= 2) { fails = []; trouble('requests'); }
862
910
  }
863
- function trouble(why) { if (NUDGE[why]) offerHelp(); }
911
+ function trouble(why) { if (NUDGE[why]) offerHelp(/^(stalled|circles|refused)$/.test(why) ? 'stuck' : 'broken'); }
912
+
913
+ // Unsure, not blocked. Anything sent (a form, a request that changes something) means they
914
+ // got there, so it starts these over.
915
+ var sentAt = 0;
916
+ function sentSomething() { sentAt = Date.now(); visits = []; typedAt = 0; }
917
+ document.addEventListener('submit', function (e) { if (!host.contains(e.target)) sentSomething(); }, true);
918
+
919
+ // Going in circles: a few pages, over and over, inside a minute.
920
+ function visited(where) {
921
+ if (!NUDGE.circles) return;
922
+ var now = Date.now();
923
+ visits = visits.filter(function (v) { return now - v.at < 60000; }).concat({ at: now, where: where });
924
+ if (visits.length < 6) return;
925
+ var count = {};
926
+ visits.forEach(function (v) { count[v.where] = (count[v.where] || 0) + 1; });
927
+ var pages = Object.keys(count);
928
+ if (pages.length <= 3 && pages.some(function (k) { return count[k] >= 3; })) { visits = []; trouble('circles'); }
929
+ }
930
+
931
+ // Typing that stopped: 45 s after the last keystroke, still here (moved or scrolled in the last
932
+ // 15 s), on the same page, and nothing sent.
933
+ var typedWhere = null, hereAt = 0, stallTimer = null;
934
+ var SEARCH = 'input[type=search],[role=search] input,[role=searchbox],[role=combobox]';
935
+ if (NUDGE.stalled) {
936
+ document.addEventListener('input', function (e) {
937
+ var t = e.target;
938
+ if (!t || !t.closest || host.contains(t) || t === host) return;
939
+ if (!/^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName) && !t.isContentEditable) return;
940
+ if (t.matches(SEARCH) || /search/i.test((t.name || '') + ' ' + (t.id || '') + ' ' + (t.getAttribute('placeholder') || ''))) return;
941
+ typedAt = Date.now();
942
+ typedWhere = location.pathname + location.hash;
943
+ if (!stallTimer) stallTimer = setInterval(checkStall, 5000);
944
+ }, true);
945
+ ['pointermove', 'scroll', 'wheel', 'touchmove'].forEach(function (ev) {
946
+ window.addEventListener(ev, function () { hereAt = Date.now(); }, { passive: true, capture: true });
947
+ });
948
+ }
949
+ function checkStall() {
950
+ var now = Date.now();
951
+ if (!typedAt || typedWhere !== location.pathname + location.hash) { clearInterval(stallTimer); stallTimer = null; typedAt = 0; return; }
952
+ if (now - typedAt < 45000 || now - hereAt > 15000 || document.visibilityState === 'hidden') return;
953
+ clearInterval(stallTimer); stallTimer = null; typedAt = 0;
954
+ trouble('stalled');
955
+ }
956
+
957
+ // The same field refused again and again: the browser's own check, or the app marking it
958
+ // aria-invalid.
959
+ var refusals = typeof WeakMap === 'function' ? new WeakMap() : null;
960
+ function refused(t) {
961
+ if (!NUDGE.refused || !refusals || !t || host.contains(t)) return;
962
+ var now = Date.now();
963
+ var r = (refusals.get(t) || []).filter(function (at) { return now - at < 120000; }).concat(now);
964
+ refusals.set(t, r);
965
+ if (r.length >= 3) { refusals.set(t, []); trouble('refused'); }
966
+ }
967
+ if (NUDGE.refused) {
968
+ document.addEventListener('invalid', function (e) { refused(e.target); }, true);
969
+ if (window.MutationObserver) {
970
+ new MutationObserver(function (ms) {
971
+ ms.forEach(function (m) { if (m.target.getAttribute && m.target.getAttribute('aria-invalid') === 'true') refused(m.target); });
972
+ }).observe(document.documentElement, { subtree: true, attributes: true, attributeFilter: ['aria-invalid'] });
973
+ }
974
+ }
864
975
 
865
976
  // ---- network ---------------------------------------------------------------------------
866
977
 
@@ -1437,7 +1548,9 @@
1437
1548
  }
1438
1549
  return false;
1439
1550
  }
1440
- function offerHelp() {
1551
+ /** `kind`: 'broken' (something failed; opens as Broken) or 'stuck' (they seem unsure; Confusing). */
1552
+ function offerHelp(kind) {
1553
+ var stuck = kind === 'stuck';
1441
1554
  if (dead || scrim || bubble || nudgeEl || !host.isConnected || hiddenHere() || document.visibilityState === 'hidden') return false;
1442
1555
  if (Date.now() - (+load(NUDGE_NO) || 0) < NUDGE_REST) return false;
1443
1556
  if (offeredInTab()) return false;
@@ -1455,13 +1568,14 @@
1455
1568
  onpointerenter: stay, onpointerleave: later, onfocusin: stay, onfocusout: later,
1456
1569
  onkeydown: function (e) { if (e.key === 'Escape') done(true); },
1457
1570
  }, [
1458
- el('b', { text: S.nudgeTitle }),
1459
- el('p', { text: S.nudgeBody }),
1571
+ el('b', { text: stuck ? S.nudgeStuckTitle : S.nudgeTitle }),
1572
+ el('p', { text: stuck ? S.nudgeStuckBody : S.nudgeBody }),
1460
1573
  el('div', { class: 'row' }, [
1461
1574
  el('button', { class: 'link', type: 'button', text: S.nudgeNo, onclick: function () { done(true); } }),
1462
1575
  el('button', { class: 'send', type: 'button', text: S.nudgeYes, onclick: function () {
1463
1576
  done(false);
1464
- if (!state.type && OFFERED.some(function (t) { return t.id === 'broken'; })) state.type = 'broken';
1577
+ var as = stuck ? 'confusing' : 'broken';
1578
+ if (!state.type && OFFERED.some(function (t) { return t.id === as; })) state.type = as;
1465
1579
  open('new');
1466
1580
  } }),
1467
1581
  ]),
@@ -1474,6 +1588,7 @@
1474
1588
 
1475
1589
  function mount() {
1476
1590
  if (dead) return;
1591
+ versionSeen(state.version);
1477
1592
  if (!host.isConnected) document.body.appendChild(host);
1478
1593
  placeFab();
1479
1594
  refresh();
@@ -1490,10 +1605,10 @@
1490
1605
  state.userEmail = u.email != null ? String(u.email) : null;
1491
1606
  if (scrim && view === 'prefs') renderPanel();
1492
1607
  },
1493
- setVersion: function (v) { state.version = v != null ? String(v) : null; },
1608
+ setVersion: function (v) { state.version = v != null ? String(v) : null; versionSeen(state.version); },
1494
1609
  setScreen: function (s) {
1495
1610
  state.screen = s != null ? String(s) : null;
1496
- if (state.screen) note('page', state.screen);
1611
+ if (state.screen) { note('page', state.screen); visited('screen:' + state.screen); }
1497
1612
  },
1498
1613
  /** Open the report form. { type, text } fill it in; the reporter still reviews and sends. */
1499
1614
  open: function (o) {
@@ -1506,8 +1621,9 @@
1506
1621
  /** Show the one-time introduction now. False if it was already shown on this device. */
1507
1622
  introduce: function (o) { return introduce(o); },
1508
1623
  /** The app saw trouble itself (an error screen, a retry that failed): offer to report it.
1624
+ * { stuck: true } for someone who seems unsure ("Stuck on something?", opens as Confusing).
1509
1625
  * Works without data-nudge; the same limits apply. False if it did not show. */
1510
- nudge: function () { return offerHelp(); },
1626
+ nudge: function (o) { return offerHelp(o && o.stuck ? 'stuck' : 'broken'); },
1511
1627
  /** on('sent', fn): fn({ id, type }) after each report is sent. Returns a function that stops it. */
1512
1628
  on: function (event, fn) {
1513
1629
  if (event !== 'sent' || typeof fn !== 'function') return function () {};