makethisbetter 1.19.4 → 1.20.0

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/README.md CHANGED
@@ -216,11 +216,11 @@ The SDK watches for signals that a user is struggling and proactively offers to
216
216
 
217
217
  | Signal | Trigger |
218
218
  |--------|---------|
219
- | Rage click | 3+ clicks on the same element within 1 second |
220
- | Dead click | Click on a non-interactive element (with console errors) |
221
- | Dead click (DOM) | Click on interactive-looking element with no DOM response |
222
- | Rapid navigation | 3+ page navigations within 5 seconds |
223
- | Form failure | Form submission with validation errors |
219
+ | Rage click | 4+ clicks on the same interaction target within 1.5 seconds |
220
+ | Interaction error | Uncaught error within 2 seconds after an interaction |
221
+ | Dead click (DOM) | Command-style control with no response after 1 second |
222
+ | Rapid navigation | 3+ user-initiated page navigations within 5 seconds |
223
+ | Form failure | The same form fails validation twice within 30 seconds |
224
224
  | Error page | Landing on a 404/500 error page |
225
225
 
226
226
  Disable with `frustrationDetection: false`.
@@ -264,6 +264,7 @@ MakeThisBetter.init({
264
264
  locale: 'en', // UI language. Unset: falls back to <html lang>, then 'en'
265
265
  position: 'right', // Tab position: 'left' | 'right'
266
266
  tabText: 'Feedback', // Label on the docked tab. Unset: the locale's own wording
267
+ tabColor: '#2563eb', // Six-digit hex color for the docked tab
267
268
  entryMode: 'button', // 'button' docks a tab | 'api' renders none
268
269
  theme: 'auto', // 'light' | 'dark' | 'auto'
269
270
  frustrationDetection: true, // Proactive frustration prompts
@@ -280,6 +281,27 @@ MakeThisBetter.init({
280
281
  })
281
282
  ```
282
283
 
284
+ ### Launcher branding
285
+
286
+ Use `tabText` and `tabColor` to match the docked Feedback button to your
287
+ product. Keep the text short. Omit `tabText` to use the built-in translation for
288
+ the active locale, and omit `tabColor` to keep the Make This Better green.
289
+
290
+ ```js
291
+ MakeThisBetter.init({
292
+ projectKey: 'mtb_proj_xxx',
293
+ tabText: 'Report a problem',
294
+ tabColor: '#2563eb',
295
+ })
296
+ ```
297
+
298
+ `tabColor` accepts a six-digit hex color. The SDK derives darker hover and active
299
+ states from it, then chooses light or dark button text for readable contrast.
300
+ The setting affects only the docked launcher, not the annotation toolbar or
301
+ feedback panels. Project Settings can generate this configuration for you; the
302
+ `/makethisbetter setup` skill can also detect your website's primary color and
303
+ ask whether to use it before editing your installation.
304
+
283
305
  `locale` is resolved once, in this order: the `locale` you pass, then the page's
284
306
  `<html lang>` attribute, then `en`. A tag with no exact match is retried without
285
307
  its region (`fr-CA` → `fr`), and anything still unmatched falls back to `en`.
@@ -452,8 +474,8 @@ Shadow DOM Host (#mtb-widget-host)
452
474
 
453
475
  | Format | Size | gzip |
454
476
  |--------|------|------|
455
- | IIFE | ~77 KB | ~23 KB |
456
- | ESM | ~90 KB | ~24 KB |
477
+ | IIFE | ~146 KB | ~42 KB |
478
+ | ESM | ~178 KB | ~48 KB |
457
479
 
458
480
  The rrweb recorder (~78 KB) is loaded on demand when Interaction Replay starts and is not included in these numbers.
459
481
 
@@ -11,17 +11,20 @@ export declare class FrustrationDetector {
11
11
  private boundClickHandler;
12
12
  private unsubscribeErrors;
13
13
  private active;
14
- private errorCount;
15
- private deadClickCount;
14
+ private lastInteraction;
16
15
  private cooldownUntil;
17
16
  private static readonly COOLDOWN_MS;
18
17
  private navTimestamps;
19
18
  private unsubscribeNavigation;
20
19
  private boundPageLeaveHandler;
20
+ private boundTurboNavigationHandler;
21
21
  private lastNavigationAt;
22
+ private userNavigationIntentUntil;
22
23
  private boundSubmitHandler;
23
24
  private boundInvalidHandler;
24
25
  private recentSubmitForms;
26
+ private recentFailedForms;
27
+ private formFailureTimestamps;
25
28
  private errorPageUrls;
26
29
  private domObserver;
27
30
  private pendingDomChecks;
@@ -40,14 +43,17 @@ export declare class FrustrationDetector {
40
43
  private handleNavigation;
41
44
  private handleFormSubmit;
42
45
  private trackFormSubmitIntent;
46
+ private trackNativeNavigationIntent;
43
47
  private rememberSubmitAttempt;
48
+ private recordFormFailure;
44
49
  private handleFormInvalid;
45
50
  private checkErrorPage;
46
51
  private checkDeadClickDom;
47
52
  private ensureDomObserver;
48
53
  private disconnectDomObserver;
49
54
  private looksInteractive;
50
- private isInteractive;
55
+ private interactionTarget;
56
+ private isIntrinsicInteractive;
51
57
  private emitIfReady;
52
58
  private emitHighPriority;
53
59
  }
@@ -1 +1 @@
1
- {"version":3,"file":"frustration.d.ts","sourceRoot":"","sources":["../../src/context/frustration.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,iBAAiB,GACzB,YAAY,GACZ,YAAY,GACZ,kBAAkB,GAClB,cAAc,GACd,YAAY,GACZ,gBAAgB,CAAA;AAEpB,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,iBAAiB,CAAA;IACzB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;CAClB;AAwCD,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,YAAY,CAAoB;IACxC,OAAO,CAAC,aAAa,CAAmC;IACxD,OAAO,CAAC,iBAAiB,CAAyB;IAClD,OAAO,CAAC,iBAAiB,CAA4B;IACrD,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,UAAU,CAAI;IACtB,OAAO,CAAC,cAAc,CAAI;IAC1B,OAAO,CAAC,aAAa,CAAI;IACzB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAS;IAE5C,OAAO,CAAC,aAAa,CAAe;IACpC,OAAO,CAAC,qBAAqB,CAA4B;IACzD,OAAO,CAAC,qBAAqB,CAA4B;IACzD,OAAO,CAAC,gBAAgB,CAAK;IAC7B,OAAO,CAAC,kBAAkB,CAAoC;IAC9D,OAAO,CAAC,mBAAmB,CAAoC;IAC/D,OAAO,CAAC,iBAAiB,CAAiC;IAC1D,OAAO,CAAC,aAAa,CAAoB;IACzC,OAAO,CAAC,WAAW,CAAgC;IACnD,OAAO,CAAC,gBAAgB,CAAI;IAC5B,O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iB;IAazB,OAAO,CAAC,qBAAqB;IAK7B,OAAO,CAAC,gBAAgB;IAmBxB,OAAO,CAAC,iBAAiB;IAgBzB,OAAO,CAAC,sBAAsB;IAU9B,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,gBAAgB;CAKzB"}
@@ -1,4 +1,9 @@
1
- type NavListener = () => void;
1
+ export interface HistoryNavigationEvent {
2
+ type: 'push' | 'replace' | 'pop';
3
+ fromUrl: string;
4
+ toUrl: string;
5
+ }
6
+ type NavListener = (event: HistoryNavigationEvent) => void;
2
7
  export declare function onHistoryNavigation(listener: NavListener): () => void;
3
8
  export {};
4
9
  //# sourceMappingURL=history-patch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"history-patch.d.ts","sourceRoot":"","sources":["../../src/context/history-patch.ts"],"names":[],"mappings":"AAUA,KAAK,WAAW,GAAG,MAAM,IAAI,CAAA;AAY7B,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,WAAW,GAAG,MAAM,IAAI,CAWrE"}
1
+ {"version":3,"file":"history-patch.d.ts","sourceRoot":"","sources":["../../src/context/history-patch.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,KAAK,CAAA;IAChC,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;CACd;AAED,KAAK,WAAW,GAAG,CAAC,KAAK,EAAE,sBAAsB,KAAK,IAAI,CAAA;AAa1D,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,WAAW,GAAG,MAAM,IAAI,CAWrE"}