@mushi-mushi/web 1.22.3 → 1.22.5
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 +13 -3
- package/dist/i18n/index.cjs +4 -0
- package/dist/i18n/index.cjs.map +1 -1
- package/dist/i18n/index.d.cts +1 -0
- package/dist/i18n/index.d.ts +1 -0
- package/dist/i18n/index.js +4 -0
- package/dist/i18n/index.js.map +1 -1
- package/dist/index.cjs +231 -57
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +36 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.js +231 -57
- package/dist/index.js.map +1 -1
- package/dist/mushi.loader.global.js +140 -140
- package/dist/mushi.loader.global.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -101,6 +101,7 @@ var en = {
|
|
|
101
101
|
elementButton: "Select Element",
|
|
102
102
|
elementSelected: "Element selected \u2713",
|
|
103
103
|
elementCapturing: "Click anything on the page\u2026",
|
|
104
|
+
elementFailed: "Couldn't select \u2014 describe it instead",
|
|
104
105
|
elementSelectorHint: "Click any element \xB7 Esc to cancel",
|
|
105
106
|
optional: "(optional)",
|
|
106
107
|
tooShort: "A bit more detail helps us fix it faster",
|
|
@@ -269,6 +270,7 @@ var ja = {
|
|
|
269
270
|
elementButton: "\u8981\u7D20\u3092\u9078\u629E",
|
|
270
271
|
elementSelected: "\u8981\u7D20\u9078\u629E\u6E08\u307F \u2713",
|
|
271
272
|
elementCapturing: "\u30DA\u30FC\u30B8\u4E0A\u306E\u8981\u7D20\u3092\u30AF\u30EA\u30C3\u30AF\u2026",
|
|
273
|
+
elementFailed: "\u9078\u629E\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F \u2014 \u6587\u5B57\u3067\u6559\u3048\u3066\u304F\u3060\u3055\u3044",
|
|
272
274
|
elementSelectorHint: "\u8981\u7D20\u3092\u30AF\u30EA\u30C3\u30AF \xB7 Esc \u3067\u30AD\u30E3\u30F3\u30BB\u30EB",
|
|
273
275
|
optional: "\uFF08\u4EFB\u610F\uFF09",
|
|
274
276
|
tooShort: "\u3082\u3046\u5C11\u3057\u8A73\u3057\u304F\u6559\u3048\u3066\u304F\u3060\u3055\u3044",
|
|
@@ -437,6 +439,7 @@ var th = {
|
|
|
437
439
|
elementButton: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E2D\u0E07\u0E04\u0E4C\u0E1B\u0E23\u0E30\u0E01\u0E2D\u0E1A",
|
|
438
440
|
elementSelected: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E2D\u0E07\u0E04\u0E4C\u0E1B\u0E23\u0E30\u0E01\u0E2D\u0E1A\u0E41\u0E25\u0E49\u0E27 \u2713",
|
|
439
441
|
elementCapturing: "\u0E04\u0E25\u0E34\u0E01\u0E2D\u0E07\u0E04\u0E4C\u0E1B\u0E23\u0E30\u0E01\u0E2D\u0E1A\u0E1A\u0E19\u0E2B\u0E19\u0E49\u0E32\u2026",
|
|
442
|
+
elementFailed: "\u0E44\u0E21\u0E48\u0E2A\u0E32\u0E21\u0E32\u0E23\u0E16\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E14\u0E49 \u2014 \u0E42\u0E1B\u0E23\u0E14\u0E2D\u0E18\u0E34\u0E1A\u0E32\u0E22\u0E41\u0E17\u0E19",
|
|
440
443
|
elementSelectorHint: "\u0E04\u0E25\u0E34\u0E01\u0E2D\u0E07\u0E04\u0E4C\u0E1B\u0E23\u0E30\u0E01\u0E2D\u0E1A\u0E43\u0E14\u0E01\u0E47\u0E44\u0E14\u0E49 \xB7 Esc \u0E40\u0E1E\u0E37\u0E48\u0E2D\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01",
|
|
441
444
|
optional: "(\u0E44\u0E21\u0E48\u0E1A\u0E31\u0E07\u0E04\u0E31\u0E1A)",
|
|
442
445
|
tooShort: "\u0E01\u0E23\u0E38\u0E13\u0E32\u0E43\u0E2B\u0E49\u0E23\u0E32\u0E22\u0E25\u0E30\u0E40\u0E2D\u0E35\u0E22\u0E14\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E40\u0E15\u0E34\u0E21",
|
|
@@ -605,6 +608,7 @@ var es = {
|
|
|
605
608
|
elementButton: "Seleccionar elemento",
|
|
606
609
|
elementSelected: "Elemento seleccionado \u2713",
|
|
607
610
|
elementCapturing: "Haz clic en cualquier elemento\u2026",
|
|
611
|
+
elementFailed: "No se pudo seleccionar \u2014 descr\xEDbelo en su lugar",
|
|
608
612
|
elementSelectorHint: "Clic en cualquier elemento \xB7 Esc para cancelar",
|
|
609
613
|
optional: "(opcional)",
|
|
610
614
|
tooShort: "Un poco m\xE1s de detalle nos ayuda a resolverlo",
|
|
@@ -2553,7 +2557,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
2553
2557
|
|
|
2554
2558
|
// src/version.ts
|
|
2555
2559
|
var MUSHI_SDK_PACKAGE = "@mushi-mushi/web";
|
|
2556
|
-
var MUSHI_SDK_VERSION = "1.22.
|
|
2560
|
+
var MUSHI_SDK_VERSION = "1.22.5" ;
|
|
2557
2561
|
var CATEGORY_ICONS = {
|
|
2558
2562
|
bug: "\u26A0\uFE0F",
|
|
2559
2563
|
slow: "\u{1F40C}",
|
|
@@ -3282,10 +3286,11 @@ function renderDetailsStep(ctx) {
|
|
|
3282
3286
|
ctx.screenshotError ? "error" : "",
|
|
3283
3287
|
ctx.screenshotCapturing ? "loading" : ""
|
|
3284
3288
|
].filter(Boolean).join(" ");
|
|
3285
|
-
const elementLabel = ctx.elementCapturing ? t.step3.elementCapturing : ctx.elementSelected ? t.step3.elementSelected : t.step3.elementButton;
|
|
3289
|
+
const elementLabel = ctx.elementCapturing ? t.step3.elementCapturing : ctx.elementError ? t.step3.elementFailed : ctx.elementSelected ? t.step3.elementSelected : t.step3.elementButton;
|
|
3286
3290
|
const elementClass = [
|
|
3287
3291
|
"mushi-attach-btn",
|
|
3288
3292
|
ctx.elementSelected ? "active" : "",
|
|
3293
|
+
ctx.elementError ? "error" : "",
|
|
3289
3294
|
ctx.elementCapturing ? "loading" : ""
|
|
3290
3295
|
].filter(Boolean).join(" ");
|
|
3291
3296
|
const exampleChips = t.step3.examplePrompts.map((p) => `<button type="button" class="mushi-example-chip" data-example="${escapeHtml(p)}">${escapeHtml(p)}</button>`).join("");
|
|
@@ -3306,24 +3311,24 @@ function renderDetailsStep(ctx) {
|
|
|
3306
3311
|
</div>
|
|
3307
3312
|
</div>
|
|
3308
3313
|
<div class="mushi-attachments">
|
|
3309
|
-
|
|
3314
|
+
${ctx.screenshotAvailable ? `<button type="button" class="${screenshotClass}"
|
|
3310
3315
|
data-action="screenshot"
|
|
3311
3316
|
${ctx.screenshotCapturing ? "disabled" : ""}
|
|
3312
3317
|
aria-label="${escapeHtml(screenshotLabel)}"
|
|
3313
3318
|
>
|
|
3314
3319
|
${ctx.screenshotCapturing ? '<span class="mushi-spinner" aria-hidden="true"></span>' : "\u{1F4F8}"}
|
|
3315
3320
|
${escapeHtml(screenshotLabel)}
|
|
3316
|
-
</button
|
|
3321
|
+
</button>` : ""}
|
|
3317
3322
|
${ctx.screenshotAttached && ctx.allowScreenshotRemove ? '<button type="button" class="mushi-attach-btn danger" data-action="remove-screenshot" aria-label="Remove screenshot">\u2715 Remove</button>' : ""}
|
|
3318
3323
|
${ctx.screenshotAttached ? '<button type="button" class="mushi-attach-btn" data-action="annotate-screenshot" aria-label="Mark up screenshot">\u270F Mark up</button><div class="mushi-annotate-host" data-role="annotate-host"></div>' : ""}
|
|
3319
|
-
|
|
3324
|
+
${ctx.elementAvailable ? `<button type="button" class="${elementClass}"
|
|
3320
3325
|
data-action="element"
|
|
3321
3326
|
${ctx.elementCapturing ? "disabled" : ""}
|
|
3322
3327
|
aria-label="${escapeHtml(elementLabel)}"
|
|
3323
3328
|
>
|
|
3324
3329
|
${ctx.elementCapturing ? '<span class="mushi-spinner" aria-hidden="true"></span>' : "\u{1F3AF}"}
|
|
3325
3330
|
${escapeHtml(elementLabel)}
|
|
3326
|
-
</button
|
|
3331
|
+
</button>` : ""}
|
|
3327
3332
|
</div>
|
|
3328
3333
|
${ctx.screenshotAttached && ctx.screenshotPreview ? `<figure class="mushi-screenshot-preview">
|
|
3329
3334
|
<img src="${escapeHtml(ctx.screenshotPreview)}" alt="${escapeHtml(t.step3.screenshotPreviewAlt)}" />
|
|
@@ -3570,10 +3575,32 @@ var MushiWidget = class _MushiWidget {
|
|
|
3570
3575
|
screenshotCapturing = false;
|
|
3571
3576
|
screenshotError = false;
|
|
3572
3577
|
allowScreenshotRemove = true;
|
|
3578
|
+
/**
|
|
3579
|
+
* Whether the screenshot / element-select tools are actually usable
|
|
3580
|
+
* (capture module present + not disabled by config). Unavailable tools are
|
|
3581
|
+
* hidden from the details step — a rendered button whose handler silently
|
|
3582
|
+
* no-ops reads as a bug to the reporter.
|
|
3583
|
+
*/
|
|
3584
|
+
screenshotAvailable = true;
|
|
3585
|
+
elementAvailable = true;
|
|
3586
|
+
/**
|
|
3587
|
+
* In-progress form input preserved across full shadow-DOM re-renders.
|
|
3588
|
+
* render() rebuilds the panel with `innerHTML = ''`, which used to destroy
|
|
3589
|
+
* whatever the reporter had typed whenever a background refresh (60s inbox
|
|
3590
|
+
* poll, visibilitychange refetch, screenshot attach) fired mid-typing.
|
|
3591
|
+
* Captured from the live DOM right before teardown, replayed right after.
|
|
3592
|
+
*/
|
|
3593
|
+
draftDescription = "";
|
|
3594
|
+
draftEmail = "";
|
|
3595
|
+
draftReply = "";
|
|
3596
|
+
draftFocus = null;
|
|
3597
|
+
draftSelStart = 0;
|
|
3598
|
+
draftSelEnd = 0;
|
|
3573
3599
|
/** Data URL of the attached screenshot, rendered as a visible preview. */
|
|
3574
3600
|
screenshotPreview = null;
|
|
3575
3601
|
elementSelected = false;
|
|
3576
3602
|
elementCapturing = false;
|
|
3603
|
+
elementError = false;
|
|
3577
3604
|
submitting = false;
|
|
3578
3605
|
/** Hint element injected outside the shadow DOM during element selection. */
|
|
3579
3606
|
selectorHint = null;
|
|
@@ -3756,12 +3783,14 @@ var MushiWidget = class _MushiWidget {
|
|
|
3756
3783
|
this.screenshotPreview = null;
|
|
3757
3784
|
this.elementSelected = false;
|
|
3758
3785
|
this.elementCapturing = false;
|
|
3786
|
+
this.elementError = false;
|
|
3759
3787
|
this.submitting = false;
|
|
3760
3788
|
this.submittedAt = null;
|
|
3761
3789
|
this.removeSelectorHint();
|
|
3762
3790
|
this.lastReportId = null;
|
|
3763
3791
|
this.lastSubmitQueuedOffline = false;
|
|
3764
3792
|
this.viaFeatureRequest = false;
|
|
3793
|
+
this.clearFormDrafts();
|
|
3765
3794
|
if (options?.featureRequest) {
|
|
3766
3795
|
this.selectedCategory = "other";
|
|
3767
3796
|
this.selectedIntent = FEATURE_REQUEST_INTENT;
|
|
@@ -3893,6 +3922,8 @@ var MushiWidget = class _MushiWidget {
|
|
|
3893
3922
|
}
|
|
3894
3923
|
setScreenshotAttached(attached) {
|
|
3895
3924
|
this.screenshotAttached = attached;
|
|
3925
|
+
this.screenshotCapturing = false;
|
|
3926
|
+
if (attached) this.screenshotError = false;
|
|
3896
3927
|
if (!attached) this.screenshotPreview = null;
|
|
3897
3928
|
if (this.isOpen) this.render();
|
|
3898
3929
|
}
|
|
@@ -3917,9 +3948,26 @@ var MushiWidget = class _MushiWidget {
|
|
|
3917
3948
|
this.allowScreenshotRemove = allow;
|
|
3918
3949
|
if (this.isOpen) this.render();
|
|
3919
3950
|
}
|
|
3951
|
+
/** Show/hide the attachment tools based on what the SDK can actually do. */
|
|
3952
|
+
setCaptureAvailability(availability) {
|
|
3953
|
+
const nextScreenshot = availability.screenshot ?? this.screenshotAvailable;
|
|
3954
|
+
const nextElement = availability.element ?? this.elementAvailable;
|
|
3955
|
+
if (nextScreenshot === this.screenshotAvailable && nextElement === this.elementAvailable) return;
|
|
3956
|
+
this.screenshotAvailable = nextScreenshot;
|
|
3957
|
+
this.elementAvailable = nextElement;
|
|
3958
|
+
if (this.isOpen) this.render();
|
|
3959
|
+
}
|
|
3920
3960
|
setElementSelected(selected) {
|
|
3921
3961
|
this.elementSelected = selected;
|
|
3922
3962
|
this.elementCapturing = false;
|
|
3963
|
+
if (selected) this.elementError = false;
|
|
3964
|
+
this.removeSelectorHint();
|
|
3965
|
+
if (this.isOpen) this.render();
|
|
3966
|
+
}
|
|
3967
|
+
/** Surface a failed/cancelled element-selection attempt (mirrors setScreenshotError). */
|
|
3968
|
+
setElementError(failed) {
|
|
3969
|
+
this.elementError = failed;
|
|
3970
|
+
this.elementCapturing = false;
|
|
3923
3971
|
this.removeSelectorHint();
|
|
3924
3972
|
if (this.isOpen) this.render();
|
|
3925
3973
|
}
|
|
@@ -3936,6 +3984,7 @@ var MushiWidget = class _MushiWidget {
|
|
|
3936
3984
|
setElementCapturing(capturing) {
|
|
3937
3985
|
this.elementCapturing = capturing;
|
|
3938
3986
|
if (capturing) {
|
|
3987
|
+
this.elementError = false;
|
|
3939
3988
|
this.showSelectorHint();
|
|
3940
3989
|
} else {
|
|
3941
3990
|
this.removeSelectorHint();
|
|
@@ -4412,10 +4461,70 @@ var MushiWidget = class _MushiWidget {
|
|
|
4412
4461
|
}
|
|
4413
4462
|
return "light";
|
|
4414
4463
|
}
|
|
4464
|
+
/** Snapshot in-progress form input from the live DOM before teardown. */
|
|
4465
|
+
captureFormDrafts() {
|
|
4466
|
+
const desc = this.shadow.querySelector(
|
|
4467
|
+
'textarea.mushi-textarea:not([data-role="reporter-reply"])'
|
|
4468
|
+
);
|
|
4469
|
+
const email = this.shadow.querySelector('[data-role="magic-link-email"]');
|
|
4470
|
+
const reply = this.shadow.querySelector(
|
|
4471
|
+
'textarea[data-role="reporter-reply"]'
|
|
4472
|
+
);
|
|
4473
|
+
if (desc) this.draftDescription = desc.value;
|
|
4474
|
+
if (email) this.draftEmail = email.value;
|
|
4475
|
+
if (reply) this.draftReply = reply.value;
|
|
4476
|
+
const active = this.shadow.activeElement;
|
|
4477
|
+
this.draftFocus = active && active === desc ? "description" : active && active === email ? "email" : active && active === reply ? "reply" : null;
|
|
4478
|
+
if (this.draftFocus && active) {
|
|
4479
|
+
const el = active;
|
|
4480
|
+
this.draftSelStart = el.selectionStart ?? el.value.length;
|
|
4481
|
+
this.draftSelEnd = el.selectionEnd ?? el.value.length;
|
|
4482
|
+
}
|
|
4483
|
+
}
|
|
4484
|
+
/** Replay captured drafts (value + focus + caret) into a freshly built panel. */
|
|
4485
|
+
restoreFormDrafts(panel) {
|
|
4486
|
+
const fields = [
|
|
4487
|
+
{
|
|
4488
|
+
selector: 'textarea.mushi-textarea:not([data-role="reporter-reply"])',
|
|
4489
|
+
value: this.draftDescription,
|
|
4490
|
+
key: "description"
|
|
4491
|
+
},
|
|
4492
|
+
{ selector: '[data-role="magic-link-email"]', value: this.draftEmail, key: "email" },
|
|
4493
|
+
{ selector: 'textarea[data-role="reporter-reply"]', value: this.draftReply, key: "reply" }
|
|
4494
|
+
];
|
|
4495
|
+
for (const field of fields) {
|
|
4496
|
+
const el = panel.querySelector(field.selector);
|
|
4497
|
+
if (!el) continue;
|
|
4498
|
+
if (field.value && el.value !== field.value) {
|
|
4499
|
+
el.value = field.value;
|
|
4500
|
+
el.dispatchEvent(new Event("input"));
|
|
4501
|
+
}
|
|
4502
|
+
if (this.draftFocus === field.key) {
|
|
4503
|
+
const applyFocus = () => {
|
|
4504
|
+
el.focus();
|
|
4505
|
+
try {
|
|
4506
|
+
el.setSelectionRange(this.draftSelStart, this.draftSelEnd);
|
|
4507
|
+
} catch {
|
|
4508
|
+
}
|
|
4509
|
+
};
|
|
4510
|
+
if (typeof requestAnimationFrame === "function") requestAnimationFrame(applyFocus);
|
|
4511
|
+
else applyFocus();
|
|
4512
|
+
}
|
|
4513
|
+
}
|
|
4514
|
+
}
|
|
4515
|
+
clearFormDrafts() {
|
|
4516
|
+
this.draftDescription = "";
|
|
4517
|
+
this.draftEmail = "";
|
|
4518
|
+
this.draftReply = "";
|
|
4519
|
+
this.draftFocus = null;
|
|
4520
|
+
this.draftSelStart = 0;
|
|
4521
|
+
this.draftSelEnd = 0;
|
|
4522
|
+
}
|
|
4415
4523
|
render() {
|
|
4416
4524
|
const theme = this.getTheme();
|
|
4417
4525
|
const pos = this.config.position;
|
|
4418
4526
|
const t = this.locale;
|
|
4527
|
+
if (this.isOpen) this.captureFormDrafts();
|
|
4419
4528
|
this.bannerResizeObserver?.disconnect();
|
|
4420
4529
|
this.bannerResizeObserver = null;
|
|
4421
4530
|
this.shadow.innerHTML = "";
|
|
@@ -4493,6 +4602,7 @@ var MushiWidget = class _MushiWidget {
|
|
|
4493
4602
|
this.shadow.appendChild(panel);
|
|
4494
4603
|
this.attachHandlers(panel);
|
|
4495
4604
|
this.trapFocus(panel);
|
|
4605
|
+
this.restoreFormDrafts(panel);
|
|
4496
4606
|
this.attachViewportHandlers(panel);
|
|
4497
4607
|
} else {
|
|
4498
4608
|
this.teardownViewportHandlers();
|
|
@@ -4783,6 +4893,8 @@ var MushiWidget = class _MushiWidget {
|
|
|
4783
4893
|
screenshotAttached: this.screenshotAttached,
|
|
4784
4894
|
screenshotPreview: this.screenshotPreview,
|
|
4785
4895
|
screenshotHint: this.resolveScreenshotHint(),
|
|
4896
|
+
screenshotAvailable: this.screenshotAvailable,
|
|
4897
|
+
elementAvailable: this.elementAvailable,
|
|
4786
4898
|
reporterError: this.reporterError,
|
|
4787
4899
|
magicLinkError: this.magicLinkError,
|
|
4788
4900
|
elementCapturing: this.elementCapturing,
|
|
@@ -4795,6 +4907,7 @@ var MushiWidget = class _MushiWidget {
|
|
|
4795
4907
|
globalLeaderboardLoading: this.globalLeaderboardLoading,
|
|
4796
4908
|
globalLeaderboard: this.globalLeaderboard,
|
|
4797
4909
|
elementSelected: this.elementSelected,
|
|
4910
|
+
elementError: this.elementError,
|
|
4798
4911
|
crossAppLoading: this.crossAppLoading,
|
|
4799
4912
|
callbacks: this.callbacks,
|
|
4800
4913
|
testerJwt: this.testerJwt,
|
|
@@ -5117,6 +5230,7 @@ var MushiWidget = class _MushiWidget {
|
|
|
5117
5230
|
this.submitting = false;
|
|
5118
5231
|
this.step = "success";
|
|
5119
5232
|
this.render();
|
|
5233
|
+
this.draftDescription = "";
|
|
5120
5234
|
void outcomeP.then((outcome) => {
|
|
5121
5235
|
if (this.step !== "success") return;
|
|
5122
5236
|
if (outcome) {
|
|
@@ -5212,10 +5326,23 @@ var MushiWidget = class _MushiWidget {
|
|
|
5212
5326
|
async refreshReporterInboxQuiet() {
|
|
5213
5327
|
try {
|
|
5214
5328
|
this.reporterReports = await this.callbacks.onReporterReportsRequest?.() ?? [];
|
|
5215
|
-
if (this.isOpen)
|
|
5329
|
+
if (!this.isOpen) return;
|
|
5330
|
+
if (this.step === "reports") {
|
|
5331
|
+
this.render();
|
|
5332
|
+
} else {
|
|
5333
|
+
this.updateReportsBadgeText();
|
|
5334
|
+
}
|
|
5216
5335
|
} catch {
|
|
5217
5336
|
}
|
|
5218
5337
|
}
|
|
5338
|
+
/** Patch the "Your reports (N new)" nav label in place, if it is rendered. */
|
|
5339
|
+
updateReportsBadgeText() {
|
|
5340
|
+
const label = this.shadow.querySelector(".mushi-reports-entry .mushi-option-label");
|
|
5341
|
+
if (!label) return;
|
|
5342
|
+
const mn = this.locale.step1.moreNav;
|
|
5343
|
+
const unread = this.unreadCount();
|
|
5344
|
+
label.textContent = unread ? `${mn.yourReports} (${unread} ${mn.unreadNew})` : mn.yourReports;
|
|
5345
|
+
}
|
|
5219
5346
|
async loadReporterReports() {
|
|
5220
5347
|
this.step = "reports";
|
|
5221
5348
|
this.reporterLoading = true;
|
|
@@ -5231,6 +5358,9 @@ var MushiWidget = class _MushiWidget {
|
|
|
5231
5358
|
}
|
|
5232
5359
|
}
|
|
5233
5360
|
async loadReporterComments(reportId) {
|
|
5361
|
+
if (this.selectedReportId !== reportId) {
|
|
5362
|
+
this.draftReply = "";
|
|
5363
|
+
}
|
|
5234
5364
|
this.selectedReportId = reportId;
|
|
5235
5365
|
this.step = "report-detail";
|
|
5236
5366
|
this.reporterLoading = true;
|
|
@@ -5272,6 +5402,7 @@ var MushiWidget = class _MushiWidget {
|
|
|
5272
5402
|
try {
|
|
5273
5403
|
await this.callbacks.onReporterReply?.(reportId, body);
|
|
5274
5404
|
if (textarea) textarea.value = "";
|
|
5405
|
+
this.draftReply = "";
|
|
5275
5406
|
await this.loadReporterComments(reportId);
|
|
5276
5407
|
} catch (err) {
|
|
5277
5408
|
this.reporterError = err instanceof Error ? err.message : "Could not send reply.";
|
|
@@ -5377,6 +5508,64 @@ var MushiWidget = class _MushiWidget {
|
|
|
5377
5508
|
}
|
|
5378
5509
|
};
|
|
5379
5510
|
|
|
5511
|
+
// src/runtime-merge.ts
|
|
5512
|
+
function mergeRuntimeCapture(host, runtime) {
|
|
5513
|
+
const merged = { ...host };
|
|
5514
|
+
if (runtime) {
|
|
5515
|
+
for (const [key, value] of Object.entries(runtime)) {
|
|
5516
|
+
if (value !== void 0) merged[key] = value;
|
|
5517
|
+
}
|
|
5518
|
+
}
|
|
5519
|
+
return merged;
|
|
5520
|
+
}
|
|
5521
|
+
function mergeRuntimeConfig(config, runtime) {
|
|
5522
|
+
const nativeTrigger = runtime.native?.triggerMode;
|
|
5523
|
+
const runtimeLauncher = runtime.widget?.launcher;
|
|
5524
|
+
const hostTrigger = config.widget?.trigger;
|
|
5525
|
+
const rawRuntimeTrigger = runtimeLauncher ?? runtime.widget?.trigger;
|
|
5526
|
+
const runtimeTrigger = rawRuntimeTrigger === "auto" && hostTrigger && hostTrigger !== "auto" ? void 0 : rawRuntimeTrigger;
|
|
5527
|
+
const widgetTrigger = runtimeTrigger ?? (nativeTrigger === "none" || nativeTrigger === "shake" ? "manual" : void 0);
|
|
5528
|
+
const explicitHidden = runtimeLauncher === "hidden" || runtime.widget?.trigger === "hidden";
|
|
5529
|
+
const safeWidgetTrigger = widgetTrigger === "hidden" && !explicitHidden && hostTrigger && hostTrigger !== "hidden" ? hostTrigger : widgetTrigger;
|
|
5530
|
+
const runtimeWidget = runtime.widget;
|
|
5531
|
+
const runtimeBannerVariant = runtimeWidget?.bannerVariant;
|
|
5532
|
+
const runtimeBannerPosition = runtimeWidget?.bannerPosition;
|
|
5533
|
+
const runtimeBannerMessage = runtimeWidget?.bannerMessage;
|
|
5534
|
+
const runtimeBannerLabel = runtimeWidget?.bannerLabel;
|
|
5535
|
+
const runtimeBannerBugCta = runtimeWidget?.bannerBugCta;
|
|
5536
|
+
const runtimeBannerFeatureCta = runtimeWidget?.bannerFeatureCta;
|
|
5537
|
+
const derivedBannerConfig = runtimeBannerVariant || runtimeBannerPosition || runtimeBannerMessage != null || runtimeBannerLabel != null || runtimeBannerBugCta != null || runtimeBannerFeatureCta != null ? {
|
|
5538
|
+
...config.widget?.bannerConfig ?? {},
|
|
5539
|
+
...runtimeBannerVariant ? { variant: runtimeBannerVariant } : {},
|
|
5540
|
+
...runtimeBannerPosition ? { position: runtimeBannerPosition } : {},
|
|
5541
|
+
...runtimeBannerMessage != null ? { message: runtimeBannerMessage } : {},
|
|
5542
|
+
...runtimeBannerLabel != null ? { label: runtimeBannerLabel === "" ? false : runtimeBannerLabel } : {},
|
|
5543
|
+
...runtimeBannerBugCta != null ? { bugCta: runtimeBannerBugCta ?? void 0 } : {},
|
|
5544
|
+
...runtimeBannerFeatureCta != null ? { featureCta: runtimeBannerFeatureCta } : {}
|
|
5545
|
+
} : void 0;
|
|
5546
|
+
const definedRuntimeWidget = {};
|
|
5547
|
+
if (runtime.widget) {
|
|
5548
|
+
for (const [key, value] of Object.entries(runtime.widget)) {
|
|
5549
|
+
if (key === "trigger" || key === "launcher") continue;
|
|
5550
|
+
if (value !== void 0 && value !== null) definedRuntimeWidget[key] = value;
|
|
5551
|
+
}
|
|
5552
|
+
}
|
|
5553
|
+
return {
|
|
5554
|
+
...config,
|
|
5555
|
+
widget: {
|
|
5556
|
+
...config.widget,
|
|
5557
|
+
...definedRuntimeWidget,
|
|
5558
|
+
...safeWidgetTrigger ? { trigger: safeWidgetTrigger } : {},
|
|
5559
|
+
...derivedBannerConfig ? { bannerConfig: derivedBannerConfig } : {},
|
|
5560
|
+
...config.widget?.betaMode ? { betaMode: config.widget.betaMode } : {}
|
|
5561
|
+
},
|
|
5562
|
+
capture: mergeRuntimeCapture(config.capture, runtime.capture),
|
|
5563
|
+
privacy: {
|
|
5564
|
+
...config.privacy
|
|
5565
|
+
}
|
|
5566
|
+
};
|
|
5567
|
+
}
|
|
5568
|
+
|
|
5380
5569
|
// src/marketing-recorder.ts
|
|
5381
5570
|
function centerOf(el) {
|
|
5382
5571
|
if (!el) return null;
|
|
@@ -5721,7 +5910,6 @@ function installActivityListeners(projectId) {
|
|
|
5721
5910
|
};
|
|
5722
5911
|
historyUnsub = subscribeHistory({
|
|
5723
5912
|
onPush: emitRoute,
|
|
5724
|
-
onReplace: emitRoute,
|
|
5725
5913
|
onPop: emitRoute
|
|
5726
5914
|
});
|
|
5727
5915
|
emitRoute();
|
|
@@ -7672,7 +7860,12 @@ function createInstance(config) {
|
|
|
7672
7860
|
perfCap = null;
|
|
7673
7861
|
}
|
|
7674
7862
|
if (activeConfig.capture?.screenshot !== "off") {
|
|
7675
|
-
const screenshotOptions = {
|
|
7863
|
+
const screenshotOptions = {
|
|
7864
|
+
privacy: activeConfig.privacy,
|
|
7865
|
+
// Surface capture failures (canvas taint, CSP) in the widget UI —
|
|
7866
|
+
// an invisible failure looks identical to a broken button.
|
|
7867
|
+
onFailed: () => widget.setScreenshotError(true)
|
|
7868
|
+
};
|
|
7676
7869
|
if (activeConfig.capture?.screenshotProvider) {
|
|
7677
7870
|
screenshotCap = null;
|
|
7678
7871
|
} else if (screenshotCap) {
|
|
@@ -7692,6 +7885,10 @@ function createInstance(config) {
|
|
|
7692
7885
|
elementSelector = null;
|
|
7693
7886
|
pendingElement = null;
|
|
7694
7887
|
}
|
|
7888
|
+
widget.setCaptureAvailability({
|
|
7889
|
+
screenshot: (!!screenshotCap || !!activeConfig.capture?.screenshotProvider) && activeConfig.capture?.screenshot !== "off",
|
|
7890
|
+
element: !!elementSelector
|
|
7891
|
+
});
|
|
7695
7892
|
const discoveryRaw = activeConfig.capture?.discoverInventory;
|
|
7696
7893
|
const discoveryConfig = discoveryRaw === true ? {} : discoveryRaw && typeof discoveryRaw === "object" ? discoveryRaw : null;
|
|
7697
7894
|
const discoveryEnabled = discoveryConfig != null && discoveryConfig.enabled !== false;
|
|
@@ -7896,11 +8093,24 @@ function createInstance(config) {
|
|
|
7896
8093
|
},
|
|
7897
8094
|
onScreenshotRequest: async () => {
|
|
7898
8095
|
const hasCapture = !!screenshotCap || !!activeConfig.capture?.screenshotProvider;
|
|
7899
|
-
if (!hasCapture || activeConfig.capture?.screenshot === "off")
|
|
8096
|
+
if (!hasCapture || activeConfig.capture?.screenshot === "off") {
|
|
8097
|
+
log.warn("Screenshot requested but capture is disabled");
|
|
8098
|
+
widget.setScreenshotError(true);
|
|
8099
|
+
return;
|
|
8100
|
+
}
|
|
7900
8101
|
log.debug("Taking screenshot");
|
|
7901
|
-
|
|
8102
|
+
widget.setScreenshotCapturing(true);
|
|
8103
|
+
try {
|
|
8104
|
+
pendingScreenshot = await takeScreenshotWithoutChrome();
|
|
8105
|
+
} catch (err) {
|
|
8106
|
+
log.warn("Screenshot capture threw", {
|
|
8107
|
+
error: err instanceof Error ? err.message : String(err)
|
|
8108
|
+
});
|
|
8109
|
+
pendingScreenshot = null;
|
|
8110
|
+
}
|
|
7902
8111
|
widget.setScreenshotAttached(pendingScreenshot !== null);
|
|
7903
8112
|
widget.setScreenshotPreview(pendingScreenshot);
|
|
8113
|
+
if (pendingScreenshot === null) widget.setScreenshotError(true);
|
|
7904
8114
|
},
|
|
7905
8115
|
onScreenshotRemove: () => {
|
|
7906
8116
|
log.debug("Screenshot attachment removed");
|
|
@@ -7958,7 +8168,11 @@ function createInstance(config) {
|
|
|
7958
8168
|
container.insertBefore(toolbar, container.firstChild);
|
|
7959
8169
|
},
|
|
7960
8170
|
onElementSelectorRequest: async () => {
|
|
7961
|
-
if (!elementSelector || activeConfig.capture?.elementSelector === false)
|
|
8171
|
+
if (!elementSelector || activeConfig.capture?.elementSelector === false) {
|
|
8172
|
+
log.warn("Element selector requested but it is disabled/unavailable");
|
|
8173
|
+
widget.setElementError(true);
|
|
8174
|
+
return;
|
|
8175
|
+
}
|
|
7962
8176
|
log.debug("Element selector activated");
|
|
7963
8177
|
widget.setElementCapturing(true);
|
|
7964
8178
|
widget.hidePanel();
|
|
@@ -7971,6 +8185,11 @@ function createInstance(config) {
|
|
|
7971
8185
|
} else {
|
|
7972
8186
|
widget.setElementCapturing(false);
|
|
7973
8187
|
}
|
|
8188
|
+
} catch (err) {
|
|
8189
|
+
log.warn("Element selector threw", {
|
|
8190
|
+
error: err instanceof Error ? err.message : String(err)
|
|
8191
|
+
});
|
|
8192
|
+
widget.setElementError(true);
|
|
7974
8193
|
} finally {
|
|
7975
8194
|
widget.showPanel();
|
|
7976
8195
|
}
|
|
@@ -8849,51 +9068,6 @@ function createInstance(config) {
|
|
|
8849
9068
|
});
|
|
8850
9069
|
return isolatePublicApi(sdk);
|
|
8851
9070
|
}
|
|
8852
|
-
function mergeRuntimeConfig(config, runtime) {
|
|
8853
|
-
const nativeTrigger = runtime.native?.triggerMode;
|
|
8854
|
-
const runtimeLauncher = runtime.widget?.launcher;
|
|
8855
|
-
const widgetTrigger = runtimeLauncher ?? runtime.widget?.trigger ?? (nativeTrigger === "none" || nativeTrigger === "shake" ? "manual" : void 0);
|
|
8856
|
-
const explicitHidden = runtimeLauncher === "hidden" || runtime.widget?.trigger === "hidden";
|
|
8857
|
-
const hostTrigger = config.widget?.trigger;
|
|
8858
|
-
const safeWidgetTrigger = widgetTrigger === "hidden" && !explicitHidden && hostTrigger && hostTrigger !== "hidden" ? hostTrigger : widgetTrigger;
|
|
8859
|
-
const runtimeWidget = runtime.widget;
|
|
8860
|
-
const runtimeBannerVariant = runtimeWidget?.bannerVariant;
|
|
8861
|
-
const runtimeBannerPosition = runtimeWidget?.bannerPosition;
|
|
8862
|
-
const runtimeBannerMessage = runtimeWidget?.bannerMessage;
|
|
8863
|
-
const runtimeBannerLabel = runtimeWidget?.bannerLabel;
|
|
8864
|
-
const runtimeBannerBugCta = runtimeWidget?.bannerBugCta;
|
|
8865
|
-
const runtimeBannerFeatureCta = runtimeWidget?.bannerFeatureCta;
|
|
8866
|
-
const derivedBannerConfig = runtimeBannerVariant || runtimeBannerPosition || runtimeBannerMessage != null || runtimeBannerLabel != null || runtimeBannerBugCta != null || runtimeBannerFeatureCta != null ? {
|
|
8867
|
-
...config.widget?.bannerConfig ?? {},
|
|
8868
|
-
...runtimeBannerVariant ? { variant: runtimeBannerVariant } : {},
|
|
8869
|
-
...runtimeBannerPosition ? { position: runtimeBannerPosition } : {},
|
|
8870
|
-
...runtimeBannerMessage != null ? { message: runtimeBannerMessage } : {},
|
|
8871
|
-
// Dashboard sends an empty string to hide the pill (the runtime
|
|
8872
|
-
// payload has no way to express the local-config `label: false`).
|
|
8873
|
-
...runtimeBannerLabel != null ? { label: runtimeBannerLabel === "" ? false : runtimeBannerLabel } : {},
|
|
8874
|
-
...runtimeBannerBugCta != null ? { bugCta: runtimeBannerBugCta ?? void 0 } : {},
|
|
8875
|
-
...runtimeBannerFeatureCta != null ? { featureCta: runtimeBannerFeatureCta } : {}
|
|
8876
|
-
} : void 0;
|
|
8877
|
-
return {
|
|
8878
|
-
...config,
|
|
8879
|
-
widget: {
|
|
8880
|
-
...config.widget,
|
|
8881
|
-
...runtime.widget,
|
|
8882
|
-
...safeWidgetTrigger ? { trigger: safeWidgetTrigger } : {},
|
|
8883
|
-
...derivedBannerConfig ? { bannerConfig: derivedBannerConfig } : {},
|
|
8884
|
-
// betaMode is local-only: set by the host app, not the dashboard.
|
|
8885
|
-
// Restore it after the runtime spread so it is never silently cleared.
|
|
8886
|
-
...config.widget?.betaMode ? { betaMode: config.widget.betaMode } : {}
|
|
8887
|
-
},
|
|
8888
|
-
capture: {
|
|
8889
|
-
...config.capture,
|
|
8890
|
-
...runtime.capture
|
|
8891
|
-
},
|
|
8892
|
-
privacy: {
|
|
8893
|
-
...config.privacy
|
|
8894
|
-
}
|
|
8895
|
-
};
|
|
8896
|
-
}
|
|
8897
9071
|
function applyPresetConfig(config) {
|
|
8898
9072
|
if (!config.preset) return config;
|
|
8899
9073
|
const preset = presetDefaults(config.preset);
|