glitchgrab 1.32.0 → 1.33.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/dist/index.js +44 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +44 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1509,7 +1509,9 @@ function ReportDialog({
|
|
|
1509
1509
|
types,
|
|
1510
1510
|
showSeverity = true,
|
|
1511
1511
|
captureScreenshot = captureViaHtml2Canvas,
|
|
1512
|
-
reporter
|
|
1512
|
+
reporter,
|
|
1513
|
+
onClose,
|
|
1514
|
+
headerSlot
|
|
1513
1515
|
}) {
|
|
1514
1516
|
const [isEnhancing, setIsEnhancing] = (0, import_react.useState)(false);
|
|
1515
1517
|
const [isEnhanced, setIsEnhanced] = (0, import_react.useState)(false);
|
|
@@ -1850,6 +1852,7 @@ function ReportDialog({
|
|
|
1850
1852
|
const handleClose = () => {
|
|
1851
1853
|
stopVoice();
|
|
1852
1854
|
setIsOpen(false);
|
|
1855
|
+
onClose == null ? void 0 : onClose();
|
|
1853
1856
|
closePreview();
|
|
1854
1857
|
setAnnotatingIndex(null);
|
|
1855
1858
|
setStep(1);
|
|
@@ -2358,6 +2361,7 @@ function ReportDialog({
|
|
|
2358
2361
|
]
|
|
2359
2362
|
}
|
|
2360
2363
|
) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
2364
|
+
step === 1 && headerSlot ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { marginBottom: "14px" }, children: headerSlot }) : null,
|
|
2361
2365
|
step === 1 && sendFeedback2 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2362
2366
|
"div",
|
|
2363
2367
|
{
|
|
@@ -4291,6 +4295,29 @@ function GlitchgrabProviderInner({
|
|
|
4291
4295
|
window.dispatchEvent(new CustomEvent("glitchgrab:open-report", { detail: options }));
|
|
4292
4296
|
}
|
|
4293
4297
|
}, []);
|
|
4298
|
+
(0, import_react3.useEffect)(() => {
|
|
4299
|
+
try {
|
|
4300
|
+
if (typeof document === "undefined") return;
|
|
4301
|
+
document.documentElement.setAttribute("data-glitchgrab-sdk", "1");
|
|
4302
|
+
return () => document.documentElement.removeAttribute("data-glitchgrab-sdk");
|
|
4303
|
+
} catch (e) {
|
|
4304
|
+
}
|
|
4305
|
+
}, []);
|
|
4306
|
+
const [projectName, setProjectName] = (0, import_react3.useState)(null);
|
|
4307
|
+
(0, import_react3.useEffect)(() => {
|
|
4308
|
+
let cancelled = false;
|
|
4309
|
+
fetch(`${baseUrl}/api/v1/sdk/project`, {
|
|
4310
|
+
headers: { Authorization: `Bearer ${token}` }
|
|
4311
|
+
}).then((r) => r.ok ? r.json() : null).then((json) => {
|
|
4312
|
+
var _a;
|
|
4313
|
+
if (cancelled || !(json == null ? void 0 : json.success) || !((_a = json.data) == null ? void 0 : _a.name)) return;
|
|
4314
|
+
setProjectName(json.data.name);
|
|
4315
|
+
}).catch(() => {
|
|
4316
|
+
});
|
|
4317
|
+
return () => {
|
|
4318
|
+
cancelled = true;
|
|
4319
|
+
};
|
|
4320
|
+
}, [baseUrl, token]);
|
|
4294
4321
|
(0, import_react3.useEffect)(() => {
|
|
4295
4322
|
try {
|
|
4296
4323
|
if (typeof window === "undefined") return;
|
|
@@ -4350,7 +4377,22 @@ function GlitchgrabProviderInner({
|
|
|
4350
4377
|
children
|
|
4351
4378
|
}
|
|
4352
4379
|
),
|
|
4353
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4380
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4381
|
+
ReportDialog,
|
|
4382
|
+
{
|
|
4383
|
+
report,
|
|
4384
|
+
sendFeedback: feedback,
|
|
4385
|
+
enhanceText: enhance,
|
|
4386
|
+
transcribeAudio: transcribe,
|
|
4387
|
+
types,
|
|
4388
|
+
showSeverity,
|
|
4389
|
+
reporter,
|
|
4390
|
+
headerSlot: projectName ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { fontSize: 11, color: "#9aa0a6" }, children: [
|
|
4391
|
+
"Reporting to ",
|
|
4392
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { style: { color: "#e5e5e5" }, children: projectName })
|
|
4393
|
+
] }) : null
|
|
4394
|
+
}
|
|
4395
|
+
)
|
|
4354
4396
|
]
|
|
4355
4397
|
}
|
|
4356
4398
|
);
|