@mushi-mushi/web 1.19.2 → 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/CONTRIBUTING.md +12 -0
- package/README.md +1 -1
- package/dist/index.cjs +56 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +56 -6
- package/dist/index.js.map +1 -1
- package/dist/mushi.loader.global.js +16 -5
- package/dist/mushi.loader.global.js.map +1 -1
- package/package.json +10 -6
package/dist/index.d.cts
CHANGED
|
@@ -199,6 +199,13 @@ declare class MushiWidget {
|
|
|
199
199
|
private fabPos;
|
|
200
200
|
/** Cleanup fn for visualViewport keyboard listener. */
|
|
201
201
|
private vvCleanup;
|
|
202
|
+
/**
|
|
203
|
+
* Host-app user identity forwarded via `Mushi.identify()` or
|
|
204
|
+
* `Mushi.identifyWithToken()`. Used to show "Reporting as <name>"
|
|
205
|
+
* in the details step so logged-in users know their report is linked.
|
|
206
|
+
* Independent of the Mushi tester magic-link session below.
|
|
207
|
+
*/
|
|
208
|
+
private identifiedUser;
|
|
202
209
|
/** Mushi tester session JWT — set after in-widget sign-in or by mushi.ts. */
|
|
203
210
|
private testerJwt;
|
|
204
211
|
/** Tester identity (public_handle, display_name). */
|
|
@@ -294,6 +301,10 @@ declare class MushiWidget {
|
|
|
294
301
|
total_points: number;
|
|
295
302
|
points_30d: number;
|
|
296
303
|
}> | null, loading?: boolean): void;
|
|
304
|
+
setIdentifiedUser(user: {
|
|
305
|
+
name?: string;
|
|
306
|
+
email?: string;
|
|
307
|
+
} | null): void;
|
|
297
308
|
setTesterSession(jwt: string | null, info: {
|
|
298
309
|
id: string;
|
|
299
310
|
public_handle: string | null;
|
package/dist/index.d.ts
CHANGED
|
@@ -199,6 +199,13 @@ declare class MushiWidget {
|
|
|
199
199
|
private fabPos;
|
|
200
200
|
/** Cleanup fn for visualViewport keyboard listener. */
|
|
201
201
|
private vvCleanup;
|
|
202
|
+
/**
|
|
203
|
+
* Host-app user identity forwarded via `Mushi.identify()` or
|
|
204
|
+
* `Mushi.identifyWithToken()`. Used to show "Reporting as <name>"
|
|
205
|
+
* in the details step so logged-in users know their report is linked.
|
|
206
|
+
* Independent of the Mushi tester magic-link session below.
|
|
207
|
+
*/
|
|
208
|
+
private identifiedUser;
|
|
202
209
|
/** Mushi tester session JWT — set after in-widget sign-in or by mushi.ts. */
|
|
203
210
|
private testerJwt;
|
|
204
211
|
/** Tester identity (public_handle, display_name). */
|
|
@@ -294,6 +301,10 @@ declare class MushiWidget {
|
|
|
294
301
|
total_points: number;
|
|
295
302
|
points_30d: number;
|
|
296
303
|
}> | null, loading?: boolean): void;
|
|
304
|
+
setIdentifiedUser(user: {
|
|
305
|
+
name?: string;
|
|
306
|
+
email?: string;
|
|
307
|
+
} | null): void;
|
|
297
308
|
setTesterSession(jwt: string | null, info: {
|
|
298
309
|
id: string;
|
|
299
310
|
public_handle: string | null;
|
package/dist/index.js
CHANGED
|
@@ -1132,6 +1132,16 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
1132
1132
|
line-height: 1.4;
|
|
1133
1133
|
letter-spacing: 0.02em;
|
|
1134
1134
|
}
|
|
1135
|
+
.mushi-identified-user {
|
|
1136
|
+
margin: 8px 0 0;
|
|
1137
|
+
font-size: 11.5px;
|
|
1138
|
+
color: ${inkMuted};
|
|
1139
|
+
line-height: 1.4;
|
|
1140
|
+
}
|
|
1141
|
+
.mushi-identified-user strong {
|
|
1142
|
+
color: ${ink};
|
|
1143
|
+
font-weight: 600;
|
|
1144
|
+
}
|
|
1135
1145
|
.mushi-annotate-toolbar {
|
|
1136
1146
|
display: flex;
|
|
1137
1147
|
flex-wrap: wrap;
|
|
@@ -2055,7 +2065,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
2055
2065
|
|
|
2056
2066
|
// src/version.ts
|
|
2057
2067
|
var MUSHI_SDK_PACKAGE = "@mushi-mushi/web";
|
|
2058
|
-
var MUSHI_SDK_VERSION = "1.
|
|
2068
|
+
var MUSHI_SDK_VERSION = "1.20.0" ;
|
|
2059
2069
|
var CATEGORY_ICONS = {
|
|
2060
2070
|
bug: "\u26A0\uFE0F",
|
|
2061
2071
|
slow: "\u{1F40C}",
|
|
@@ -2782,6 +2792,7 @@ function renderDetailsStep(ctx) {
|
|
|
2782
2792
|
${ctx.screenshotHint ? `<figcaption class="mushi-screenshot-hint">\u26A0 ${escapeHtml(ctx.screenshotHint)}</figcaption>` : ""}
|
|
2783
2793
|
</figure>` : ""}
|
|
2784
2794
|
<div class="mushi-error" style="display:none" role="alert"></div>
|
|
2795
|
+
${ctx.identifiedUser ? `<p class="mushi-identified-user" aria-label="Reporting as ${escapeHtml(ctx.identifiedUser.name ?? ctx.identifiedUser.email ?? "")}">\u{1F464} Reporting as <strong>${escapeHtml(ctx.identifiedUser.name ?? ctx.identifiedUser.email ?? "you")}</strong></p>` : ""}
|
|
2785
2796
|
</div>
|
|
2786
2797
|
<div class="mushi-footer">
|
|
2787
2798
|
<span class="mushi-footer-hint" aria-hidden="true">\u2318 + ENTER \u2192 send</span>
|
|
@@ -3076,6 +3087,13 @@ var MushiWidget = class _MushiWidget {
|
|
|
3076
3087
|
fabPos = null;
|
|
3077
3088
|
/** Cleanup fn for visualViewport keyboard listener. */
|
|
3078
3089
|
vvCleanup = null;
|
|
3090
|
+
/**
|
|
3091
|
+
* Host-app user identity forwarded via `Mushi.identify()` or
|
|
3092
|
+
* `Mushi.identifyWithToken()`. Used to show "Reporting as <name>"
|
|
3093
|
+
* in the details step so logged-in users know their report is linked.
|
|
3094
|
+
* Independent of the Mushi tester magic-link session below.
|
|
3095
|
+
*/
|
|
3096
|
+
identifiedUser = null;
|
|
3079
3097
|
/** Mushi tester session JWT — set after in-widget sign-in or by mushi.ts. */
|
|
3080
3098
|
testerJwt = null;
|
|
3081
3099
|
/** Tester identity (public_handle, display_name). */
|
|
@@ -3476,6 +3494,10 @@ var MushiWidget = class _MushiWidget {
|
|
|
3476
3494
|
if (this.isOpen && this.step === "leaderboard") this.render();
|
|
3477
3495
|
}
|
|
3478
3496
|
// ── Community public setters (called by mushi.ts after API calls) ──────────
|
|
3497
|
+
setIdentifiedUser(user) {
|
|
3498
|
+
this.identifiedUser = user;
|
|
3499
|
+
if (this.isOpen) this.render();
|
|
3500
|
+
}
|
|
3479
3501
|
setTesterSession(jwt, info) {
|
|
3480
3502
|
this.testerJwt = jwt;
|
|
3481
3503
|
this.testerInfo = info;
|
|
@@ -4212,6 +4234,7 @@ var MushiWidget = class _MushiWidget {
|
|
|
4212
4234
|
lastReportId: this.lastReportId,
|
|
4213
4235
|
reporterLoading: this.reporterLoading,
|
|
4214
4236
|
locale: this.locale,
|
|
4237
|
+
identifiedUser: this.identifiedUser,
|
|
4215
4238
|
testerReputation: this.testerReputation,
|
|
4216
4239
|
testerInfo: this.testerInfo,
|
|
4217
4240
|
screenshotCapturing: this.screenshotCapturing,
|
|
@@ -6974,7 +6997,9 @@ function createInstance(config) {
|
|
|
6974
6997
|
}
|
|
6975
6998
|
if (activeConfig.capture?.screenshot !== "off") {
|
|
6976
6999
|
const screenshotOptions = { privacy: activeConfig.privacy };
|
|
6977
|
-
if (
|
|
7000
|
+
if (activeConfig.capture?.screenshotProvider) {
|
|
7001
|
+
screenshotCap = null;
|
|
7002
|
+
} else if (screenshotCap) {
|
|
6978
7003
|
screenshotCap.updateOptions(screenshotOptions);
|
|
6979
7004
|
} else {
|
|
6980
7005
|
screenshotCap = createScreenshotCapture(screenshotOptions);
|
|
@@ -6982,7 +7007,7 @@ function createInstance(config) {
|
|
|
6982
7007
|
} else {
|
|
6983
7008
|
screenshotCap = null;
|
|
6984
7009
|
}
|
|
6985
|
-
if (!screenshotCap) pendingScreenshot = null;
|
|
7010
|
+
if (!screenshotCap && !activeConfig.capture?.screenshotProvider) pendingScreenshot = null;
|
|
6986
7011
|
widget.setAllowScreenshotRemove(activeConfig.privacy?.allowUserRemoveScreenshot !== false);
|
|
6987
7012
|
if (activeConfig.capture?.elementSelector !== false) {
|
|
6988
7013
|
elementSelector ??= createElementSelector();
|
|
@@ -7067,7 +7092,22 @@ function createInstance(config) {
|
|
|
7067
7092
|
detachAutoBreadcrumbs = installAutoBreadcrumbs(breadcrumbs);
|
|
7068
7093
|
let screenshotCaptureInFlight = false;
|
|
7069
7094
|
async function takeScreenshotWithoutChrome() {
|
|
7070
|
-
if (
|
|
7095
|
+
if (screenshotCaptureInFlight) return null;
|
|
7096
|
+
const provider = activeConfig.capture?.screenshotProvider;
|
|
7097
|
+
if (provider) {
|
|
7098
|
+
screenshotCaptureInFlight = true;
|
|
7099
|
+
try {
|
|
7100
|
+
const result = await provider();
|
|
7101
|
+
return result ?? null;
|
|
7102
|
+
} catch (err) {
|
|
7103
|
+
log.warn("screenshotProvider threw, falling back to built-in capturer", {
|
|
7104
|
+
error: err instanceof Error ? err.message : String(err)
|
|
7105
|
+
});
|
|
7106
|
+
} finally {
|
|
7107
|
+
screenshotCaptureInFlight = false;
|
|
7108
|
+
}
|
|
7109
|
+
}
|
|
7110
|
+
if (!screenshotCap) return null;
|
|
7071
7111
|
screenshotCaptureInFlight = true;
|
|
7072
7112
|
const panelWasVisible = widget.getIsOpen();
|
|
7073
7113
|
if (panelWasVisible) widget.hidePanel();
|
|
@@ -7087,7 +7127,8 @@ function createInstance(config) {
|
|
|
7087
7127
|
}
|
|
7088
7128
|
async function autoCaptureScreenshot(when) {
|
|
7089
7129
|
const mode = activeConfig.capture?.screenshot;
|
|
7090
|
-
|
|
7130
|
+
const hasCapture = !!screenshotCap || !!activeConfig.capture?.screenshotProvider;
|
|
7131
|
+
if (!hasCapture || mode === "off" || pendingScreenshot) return;
|
|
7091
7132
|
if (when === "open" && mode !== "auto") return;
|
|
7092
7133
|
if (when === "submit" && mode !== "on-report" && mode !== "auto") return;
|
|
7093
7134
|
log.debug("Auto-capturing screenshot", { when, mode });
|
|
@@ -7121,7 +7162,8 @@ function createInstance(config) {
|
|
|
7121
7162
|
emit("widget:closed");
|
|
7122
7163
|
},
|
|
7123
7164
|
onScreenshotRequest: async () => {
|
|
7124
|
-
|
|
7165
|
+
const hasCapture = !!screenshotCap || !!activeConfig.capture?.screenshotProvider;
|
|
7166
|
+
if (!hasCapture || activeConfig.capture?.screenshot === "off") return;
|
|
7125
7167
|
log.debug("Taking screenshot");
|
|
7126
7168
|
pendingScreenshot = await takeScreenshotWithoutChrome();
|
|
7127
7169
|
widget.setScreenshotAttached(pendingScreenshot !== null);
|
|
@@ -7812,6 +7854,9 @@ function createInstance(config) {
|
|
|
7812
7854
|
},
|
|
7813
7855
|
identify(userId, traits) {
|
|
7814
7856
|
userInfo = { id: userId, ...traits?.email ? { email: traits.email } : {}, ...traits?.name ? { name: traits.name } : {} };
|
|
7857
|
+
widget.setIdentifiedUser(
|
|
7858
|
+
userInfo.name || userInfo.email ? { name: userInfo.name, email: userInfo.email } : null
|
|
7859
|
+
);
|
|
7815
7860
|
if (traits) {
|
|
7816
7861
|
for (const [k, v] of Object.entries(traits)) {
|
|
7817
7862
|
if (k !== "email" && k !== "name") customMetadata[`user.${k}`] = v;
|
|
@@ -7860,9 +7905,14 @@ function createInstance(config) {
|
|
|
7860
7905
|
...claims.email ? { email: claims.email } : {},
|
|
7861
7906
|
...claims.name ? { name: claims.name } : {}
|
|
7862
7907
|
};
|
|
7908
|
+
widget.setIdentifiedUser(
|
|
7909
|
+
userInfo.name || userInfo.email ? { name: userInfo.name, email: userInfo.email } : null
|
|
7910
|
+
);
|
|
7863
7911
|
}
|
|
7864
7912
|
breadcrumbs.add({ category: "lifecycle", level: "info", message: "Mushi.identifyWithToken()" });
|
|
7865
7913
|
} else {
|
|
7914
|
+
userInfo = null;
|
|
7915
|
+
widget.setIdentifiedUser(null);
|
|
7866
7916
|
breadcrumbs.add({ category: "lifecycle", level: "info", message: "Mushi.identifyWithToken(null)" });
|
|
7867
7917
|
}
|
|
7868
7918
|
},
|