@mushi-mushi/web 1.19.0 → 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 +24 -0
- package/README.md +2 -1
- package/dist/index.cjs +142 -20
- 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 +143 -21
- package/dist/index.js.map +1 -1
- package/dist/mushi.loader.global.js +148 -125
- 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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { resolveEnvConfig, createLogger, noopLogger, createApiClient, createPreFilter, createOfflineQueue, createRateLimiter, createPiiScrubber, createBreadcrumbBuffer, getReporterToken, getDeviceFingerprintHash, MAX_SCREENSHOT_DATA_URL_BYTES, getSessionId, captureEnvironment, newUuid, DEFAULT_API_ENDPOINT, MUSHI_INTERNAL_INIT_MARKER, MUSHI_INTERNAL_HEADER, parseIdentityToken, normaliseThrown } from '@mushi-mushi/core';
|
|
1
|
+
import { readPageFaviconHref, resolveEnvConfig, createLogger, noopLogger, createApiClient, createPreFilter, createOfflineQueue, createRateLimiter, createPiiScrubber, createBreadcrumbBuffer, getReporterToken, getDeviceFingerprintHash, MAX_SCREENSHOT_DATA_URL_BYTES, getSessionId, captureEnvironment, newUuid, DEFAULT_API_ENDPOINT, isLikelyGenericFavicon, MUSHI_INTERNAL_INIT_MARKER, MUSHI_INTERNAL_HEADER, parseIdentityToken, normaliseThrown, resolveProjectDomain, projectInitials, projectFaviconUrlCandidates } from '@mushi-mushi/core';
|
|
2
2
|
|
|
3
3
|
// src/capture/compress-screenshot.ts
|
|
4
4
|
async function compressScreenshotDataUrl(dataUrl, maxBytes = MAX_SCREENSHOT_DATA_URL_BYTES) {
|
|
@@ -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;
|
|
@@ -2020,7 +2030,13 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
2020
2030
|
.mushi-account-info strong{font:700 14px/1.3 inherit;color:${ink}}
|
|
2021
2031
|
.mushi-account-rank,.mushi-xapp-app-name,.mushi-label{font-size:12px;color:${inkDim};font-family:${fontMono}}
|
|
2022
2032
|
.mushi-account-rank{display:block}
|
|
2023
|
-
.mushi-xapp-app-
|
|
2033
|
+
.mushi-xapp-app-head{display:flex;align-items:center;gap:8px;margin:0 0 6px}
|
|
2034
|
+
.mushi-xapp-app-name{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.06em;margin:0}
|
|
2035
|
+
.mushi-app-icon{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;border-radius:6px;border:1px solid ${isDark ? "rgba(255,255,255,0.12)" : "rgba(0,0,0,0.1)"};background:#fff;overflow:hidden;flex-shrink:0}
|
|
2036
|
+
.mushi-app-icon-img{display:block;width:16px;height:16px;object-fit:contain}
|
|
2037
|
+
.mushi-app-icon-initials{font-size:9px;font-weight:700;color:${inkDim};line-height:1}
|
|
2038
|
+
.mushi-app-icon-initials-only{background:${isDark ? "rgba(255,255,255,0.06)" : "rgba(0,0,0,0.04)"}}
|
|
2039
|
+
.mushi-header-host-icon{display:block;width:20px;height:20px;border-radius:4px;object-fit:contain}
|
|
2024
2040
|
.mushi-xapp-group{margin-bottom:14px}
|
|
2025
2041
|
.mushi-label{display:block;font-weight:600;margin-bottom:6px}
|
|
2026
2042
|
|
|
@@ -2049,9 +2065,7 @@ function getWidgetStyles(theme, accent = "", accentText = "") {
|
|
|
2049
2065
|
|
|
2050
2066
|
// src/version.ts
|
|
2051
2067
|
var MUSHI_SDK_PACKAGE = "@mushi-mushi/web";
|
|
2052
|
-
var MUSHI_SDK_VERSION = "1.
|
|
2053
|
-
|
|
2054
|
-
// src/widget-helpers.ts
|
|
2068
|
+
var MUSHI_SDK_VERSION = "1.20.0" ;
|
|
2055
2069
|
var CATEGORY_ICONS = {
|
|
2056
2070
|
bug: "\u26A0\uFE0F",
|
|
2057
2071
|
slow: "\u{1F40C}",
|
|
@@ -2171,6 +2185,56 @@ function isSubmitShortcut(e) {
|
|
|
2171
2185
|
function escapeHtml(value) {
|
|
2172
2186
|
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
2173
2187
|
}
|
|
2188
|
+
function renderAppIconHtml(opts) {
|
|
2189
|
+
const domain = opts.appDomain ?? resolveProjectDomain({
|
|
2190
|
+
project_id: opts.projectId,
|
|
2191
|
+
project_name: opts.appName,
|
|
2192
|
+
project_slug: opts.appSlug ?? ""
|
|
2193
|
+
});
|
|
2194
|
+
const initials = escapeHtml(projectInitials(opts.appName));
|
|
2195
|
+
const candidates = projectFaviconUrlCandidates({
|
|
2196
|
+
project_id: opts.projectId,
|
|
2197
|
+
project_name: opts.appName,
|
|
2198
|
+
project_slug: opts.appSlug ?? "",
|
|
2199
|
+
sdk_origin: opts.appDomain ? `https://${opts.appDomain}` : null
|
|
2200
|
+
});
|
|
2201
|
+
if (!candidates.length) {
|
|
2202
|
+
return `<span class="mushi-app-icon mushi-app-icon-initials-only" aria-hidden="true">${initials}</span>`;
|
|
2203
|
+
}
|
|
2204
|
+
const encoded = escapeHtml(JSON.stringify(candidates));
|
|
2205
|
+
return `<span class="mushi-app-icon" data-mushi-favicon data-candidates="${encoded}" data-initials="${initials}" aria-hidden="true" title="${escapeHtml(domain ?? opts.appName)}">
|
|
2206
|
+
<img class="mushi-app-icon-img" src="${escapeHtml(candidates[0])}" alt="" referrerpolicy="no-referrer" width="16" height="16" />
|
|
2207
|
+
<span class="mushi-app-icon-initials" hidden>${initials}</span>
|
|
2208
|
+
</span>`;
|
|
2209
|
+
}
|
|
2210
|
+
function bindFaviconFallbacks(root) {
|
|
2211
|
+
root.querySelectorAll("[data-mushi-favicon]").forEach((wrap) => {
|
|
2212
|
+
const img = wrap.querySelector(".mushi-app-icon-img");
|
|
2213
|
+
const fallback = wrap.querySelector(".mushi-app-icon-initials");
|
|
2214
|
+
if (!img || !fallback) return;
|
|
2215
|
+
let candidates = [];
|
|
2216
|
+
try {
|
|
2217
|
+
candidates = JSON.parse(wrap.dataset.candidates ?? "[]");
|
|
2218
|
+
} catch {
|
|
2219
|
+
candidates = [];
|
|
2220
|
+
}
|
|
2221
|
+
let index = 0;
|
|
2222
|
+
const tryNext = () => {
|
|
2223
|
+
index += 1;
|
|
2224
|
+
if (index < candidates.length) {
|
|
2225
|
+
img.src = candidates[index];
|
|
2226
|
+
} else {
|
|
2227
|
+
img.remove();
|
|
2228
|
+
fallback.hidden = false;
|
|
2229
|
+
wrap.classList.add("mushi-app-icon-initials-only");
|
|
2230
|
+
}
|
|
2231
|
+
};
|
|
2232
|
+
img.onerror = tryNext;
|
|
2233
|
+
img.onload = () => {
|
|
2234
|
+
if (isLikelyGenericFavicon(img)) tryNext();
|
|
2235
|
+
};
|
|
2236
|
+
});
|
|
2237
|
+
}
|
|
2174
2238
|
|
|
2175
2239
|
// src/widget-render.ts
|
|
2176
2240
|
function renderStep(ctx) {
|
|
@@ -2256,7 +2320,7 @@ function renderHeader(ctx, opts) {
|
|
|
2256
2320
|
const counterHtml = step ? `<span class="mushi-step-counter" aria-label="Step ${step} of ${TOTAL_STEPS}"><b>${pad2(step)}</b> / ${pad2(TOTAL_STEPS)}</span>` : "";
|
|
2257
2321
|
return `
|
|
2258
2322
|
<div class="mushi-header">
|
|
2259
|
-
<div class="mushi-header-mark" aria-hidden="true"
|
|
2323
|
+
<div class="mushi-header-mark" aria-hidden="true">${ctx.pageFaviconHref ? `<img class="mushi-header-host-icon" src="${escapeHtml(ctx.pageFaviconHref)}" alt="" referrerpolicy="no-referrer" width="20" height="20" />` : "\u866B"}</div>
|
|
2260
2324
|
<div class="mushi-header-titles">
|
|
2261
2325
|
${eyebrowHtml}
|
|
2262
2326
|
<h3>${title}</h3>
|
|
@@ -2562,24 +2626,42 @@ function renderCrossAppReportsStep(ctx) {
|
|
|
2562
2626
|
const grouped = /* @__PURE__ */ new Map();
|
|
2563
2627
|
for (const r of reports) {
|
|
2564
2628
|
const key = r.project_id ?? "unknown";
|
|
2565
|
-
if (!grouped.has(key))
|
|
2629
|
+
if (!grouped.has(key)) {
|
|
2630
|
+
grouped.set(key, {
|
|
2631
|
+
name: r.app_name ?? "Unknown App",
|
|
2632
|
+
slug: r.app_slug ?? null,
|
|
2633
|
+
domain: r.app_domain ?? null,
|
|
2634
|
+
reports: []
|
|
2635
|
+
});
|
|
2636
|
+
}
|
|
2566
2637
|
grouped.get(key).reports.push(r);
|
|
2567
2638
|
}
|
|
2568
|
-
const rows = [...grouped.entries()].map(([, group]) =>
|
|
2639
|
+
const rows = [...grouped.entries()].map(([projectId, group]) => {
|
|
2640
|
+
const icon = renderAppIconHtml({
|
|
2641
|
+
projectId,
|
|
2642
|
+
appName: group.name,
|
|
2643
|
+
appSlug: group.slug,
|
|
2644
|
+
appDomain: group.domain
|
|
2645
|
+
});
|
|
2646
|
+
return `
|
|
2569
2647
|
<div class="mushi-xapp-group">
|
|
2570
|
-
<
|
|
2648
|
+
<div class="mushi-xapp-app-head">
|
|
2649
|
+
${icon}
|
|
2650
|
+
<h4 class="mushi-xapp-app-name">${escapeHtml(group.name)}</h4>
|
|
2651
|
+
</div>
|
|
2571
2652
|
${group.reports.map((r) => {
|
|
2572
|
-
|
|
2573
|
-
|
|
2653
|
+
const tone = reporterStatusTone(r.status);
|
|
2654
|
+
return `
|
|
2574
2655
|
<div class="mushi-report-row" data-report-id="${escapeHtml(r.id)}" tabindex="0" role="button">
|
|
2575
2656
|
<span class="mushi-report-status mushi-status-${tone}">${escapeHtml(reporterStatusShort(r.status))}</span>
|
|
2576
2657
|
<span class="mushi-report-title">${escapeHtml(r.title ?? r.category)}</span>
|
|
2577
2658
|
<span class="mushi-report-when">${escapeHtml(formatRelativeTime(r.created_at))}</span>
|
|
2578
2659
|
</div>
|
|
2579
2660
|
`;
|
|
2580
|
-
|
|
2661
|
+
}).join("")}
|
|
2581
2662
|
</div>
|
|
2582
|
-
|
|
2663
|
+
`;
|
|
2664
|
+
}).join("");
|
|
2583
2665
|
return `
|
|
2584
2666
|
${renderHeader(ctx, { title: "My reports", showBack: true, eyebrow: "Mushi \xB7 All apps" })}
|
|
2585
2667
|
<div class="mushi-body">
|
|
@@ -2710,6 +2792,7 @@ function renderDetailsStep(ctx) {
|
|
|
2710
2792
|
${ctx.screenshotHint ? `<figcaption class="mushi-screenshot-hint">\u26A0 ${escapeHtml(ctx.screenshotHint)}</figcaption>` : ""}
|
|
2711
2793
|
</figure>` : ""}
|
|
2712
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>` : ""}
|
|
2713
2796
|
</div>
|
|
2714
2797
|
<div class="mushi-footer">
|
|
2715
2798
|
<span class="mushi-footer-hint" aria-hidden="true">\u2318 + ENTER \u2192 send</span>
|
|
@@ -3004,6 +3087,13 @@ var MushiWidget = class _MushiWidget {
|
|
|
3004
3087
|
fabPos = null;
|
|
3005
3088
|
/** Cleanup fn for visualViewport keyboard listener. */
|
|
3006
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;
|
|
3007
3097
|
/** Mushi tester session JWT — set after in-widget sign-in or by mushi.ts. */
|
|
3008
3098
|
testerJwt = null;
|
|
3009
3099
|
/** Tester identity (public_handle, display_name). */
|
|
@@ -3404,6 +3494,10 @@ var MushiWidget = class _MushiWidget {
|
|
|
3404
3494
|
if (this.isOpen && this.step === "leaderboard") this.render();
|
|
3405
3495
|
}
|
|
3406
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
|
+
}
|
|
3407
3501
|
setTesterSession(jwt, info) {
|
|
3408
3502
|
this.testerJwt = jwt;
|
|
3409
3503
|
this.testerInfo = info;
|
|
@@ -4140,6 +4234,7 @@ var MushiWidget = class _MushiWidget {
|
|
|
4140
4234
|
lastReportId: this.lastReportId,
|
|
4141
4235
|
reporterLoading: this.reporterLoading,
|
|
4142
4236
|
locale: this.locale,
|
|
4237
|
+
identifiedUser: this.identifiedUser,
|
|
4143
4238
|
testerReputation: this.testerReputation,
|
|
4144
4239
|
testerInfo: this.testerInfo,
|
|
4145
4240
|
screenshotCapturing: this.screenshotCapturing,
|
|
@@ -4183,11 +4278,13 @@ var MushiWidget = class _MushiWidget {
|
|
|
4183
4278
|
assistantTurns: this.assistantTurns,
|
|
4184
4279
|
assistantSending: this.assistantSending,
|
|
4185
4280
|
assistantError: this.assistantError,
|
|
4186
|
-
showAllCategories: this.showAllCategories
|
|
4281
|
+
showAllCategories: this.showAllCategories,
|
|
4282
|
+
pageFaviconHref: readPageFaviconHref()
|
|
4187
4283
|
};
|
|
4188
4284
|
}
|
|
4189
4285
|
attachHandlers(panel) {
|
|
4190
4286
|
const t = this.locale;
|
|
4287
|
+
bindFaviconFallbacks(panel);
|
|
4191
4288
|
panel.querySelector('[data-action="close"]')?.addEventListener("click", () => this.close());
|
|
4192
4289
|
panel.querySelector('[data-action="back"]')?.addEventListener("click", () => {
|
|
4193
4290
|
if (this.step === "intent") {
|
|
@@ -4785,8 +4882,6 @@ function setConsentGranted(projectId, granted) {
|
|
|
4785
4882
|
localStorage.removeItem(getConsentKey(projectId));
|
|
4786
4883
|
}
|
|
4787
4884
|
optedIn = granted;
|
|
4788
|
-
apiClient?.submitActivity(currentUserId ?? "", [], { optedIn: granted }).catch(() => {
|
|
4789
|
-
});
|
|
4790
4885
|
} catch {
|
|
4791
4886
|
}
|
|
4792
4887
|
}
|
|
@@ -6902,7 +6997,9 @@ function createInstance(config) {
|
|
|
6902
6997
|
}
|
|
6903
6998
|
if (activeConfig.capture?.screenshot !== "off") {
|
|
6904
6999
|
const screenshotOptions = { privacy: activeConfig.privacy };
|
|
6905
|
-
if (
|
|
7000
|
+
if (activeConfig.capture?.screenshotProvider) {
|
|
7001
|
+
screenshotCap = null;
|
|
7002
|
+
} else if (screenshotCap) {
|
|
6906
7003
|
screenshotCap.updateOptions(screenshotOptions);
|
|
6907
7004
|
} else {
|
|
6908
7005
|
screenshotCap = createScreenshotCapture(screenshotOptions);
|
|
@@ -6910,7 +7007,7 @@ function createInstance(config) {
|
|
|
6910
7007
|
} else {
|
|
6911
7008
|
screenshotCap = null;
|
|
6912
7009
|
}
|
|
6913
|
-
if (!screenshotCap) pendingScreenshot = null;
|
|
7010
|
+
if (!screenshotCap && !activeConfig.capture?.screenshotProvider) pendingScreenshot = null;
|
|
6914
7011
|
widget.setAllowScreenshotRemove(activeConfig.privacy?.allowUserRemoveScreenshot !== false);
|
|
6915
7012
|
if (activeConfig.capture?.elementSelector !== false) {
|
|
6916
7013
|
elementSelector ??= createElementSelector();
|
|
@@ -6995,7 +7092,22 @@ function createInstance(config) {
|
|
|
6995
7092
|
detachAutoBreadcrumbs = installAutoBreadcrumbs(breadcrumbs);
|
|
6996
7093
|
let screenshotCaptureInFlight = false;
|
|
6997
7094
|
async function takeScreenshotWithoutChrome() {
|
|
6998
|
-
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;
|
|
6999
7111
|
screenshotCaptureInFlight = true;
|
|
7000
7112
|
const panelWasVisible = widget.getIsOpen();
|
|
7001
7113
|
if (panelWasVisible) widget.hidePanel();
|
|
@@ -7015,7 +7127,8 @@ function createInstance(config) {
|
|
|
7015
7127
|
}
|
|
7016
7128
|
async function autoCaptureScreenshot(when) {
|
|
7017
7129
|
const mode = activeConfig.capture?.screenshot;
|
|
7018
|
-
|
|
7130
|
+
const hasCapture = !!screenshotCap || !!activeConfig.capture?.screenshotProvider;
|
|
7131
|
+
if (!hasCapture || mode === "off" || pendingScreenshot) return;
|
|
7019
7132
|
if (when === "open" && mode !== "auto") return;
|
|
7020
7133
|
if (when === "submit" && mode !== "on-report" && mode !== "auto") return;
|
|
7021
7134
|
log.debug("Auto-capturing screenshot", { when, mode });
|
|
@@ -7049,7 +7162,8 @@ function createInstance(config) {
|
|
|
7049
7162
|
emit("widget:closed");
|
|
7050
7163
|
},
|
|
7051
7164
|
onScreenshotRequest: async () => {
|
|
7052
|
-
|
|
7165
|
+
const hasCapture = !!screenshotCap || !!activeConfig.capture?.screenshotProvider;
|
|
7166
|
+
if (!hasCapture || activeConfig.capture?.screenshot === "off") return;
|
|
7053
7167
|
log.debug("Taking screenshot");
|
|
7054
7168
|
pendingScreenshot = await takeScreenshotWithoutChrome();
|
|
7055
7169
|
widget.setScreenshotAttached(pendingScreenshot !== null);
|
|
@@ -7740,6 +7854,9 @@ function createInstance(config) {
|
|
|
7740
7854
|
},
|
|
7741
7855
|
identify(userId, traits) {
|
|
7742
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
|
+
);
|
|
7743
7860
|
if (traits) {
|
|
7744
7861
|
for (const [k, v] of Object.entries(traits)) {
|
|
7745
7862
|
if (k !== "email" && k !== "name") customMetadata[`user.${k}`] = v;
|
|
@@ -7788,9 +7905,14 @@ function createInstance(config) {
|
|
|
7788
7905
|
...claims.email ? { email: claims.email } : {},
|
|
7789
7906
|
...claims.name ? { name: claims.name } : {}
|
|
7790
7907
|
};
|
|
7908
|
+
widget.setIdentifiedUser(
|
|
7909
|
+
userInfo.name || userInfo.email ? { name: userInfo.name, email: userInfo.email } : null
|
|
7910
|
+
);
|
|
7791
7911
|
}
|
|
7792
7912
|
breadcrumbs.add({ category: "lifecycle", level: "info", message: "Mushi.identifyWithToken()" });
|
|
7793
7913
|
} else {
|
|
7914
|
+
userInfo = null;
|
|
7915
|
+
widget.setIdentifiedUser(null);
|
|
7794
7916
|
breadcrumbs.add({ category: "lifecycle", level: "info", message: "Mushi.identifyWithToken(null)" });
|
|
7795
7917
|
}
|
|
7796
7918
|
},
|