glitchgrab 1.33.0 → 1.34.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.d.mts +34 -1
- package/dist/index.d.ts +34 -1
- package/dist/index.js +624 -156
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +623 -156
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -31,6 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
// src/index.ts
|
|
32
32
|
var index_exports = {};
|
|
33
33
|
__export(index_exports, {
|
|
34
|
+
BookDemoButton: () => BookDemoButton,
|
|
34
35
|
FeedbackButton: () => FeedbackButton,
|
|
35
36
|
GLITCHGRAB_SHORTCUT: () => GLITCHGRAB_SHORTCUT2,
|
|
36
37
|
GLITCHGRAB_SHORTCUT_MAC: () => GLITCHGRAB_SHORTCUT_MAC2,
|
|
@@ -67,7 +68,7 @@ __export(index_exports, {
|
|
|
67
68
|
module.exports = __toCommonJS(index_exports);
|
|
68
69
|
|
|
69
70
|
// src/provider.tsx
|
|
70
|
-
var
|
|
71
|
+
var import_react4 = require("react");
|
|
71
72
|
|
|
72
73
|
// src/error-boundary.tsx
|
|
73
74
|
var React = __toESM(require("react"));
|
|
@@ -688,9 +689,9 @@ function topStackFrame(stack) {
|
|
|
688
689
|
if (!stack) return "";
|
|
689
690
|
const lines = stack.split("\n");
|
|
690
691
|
for (const line of lines) {
|
|
691
|
-
const
|
|
692
|
-
if (
|
|
693
|
-
return
|
|
692
|
+
const t2 = line.trim();
|
|
693
|
+
if (t2.startsWith("at ") || t2.includes("@")) {
|
|
694
|
+
return t2;
|
|
694
695
|
}
|
|
695
696
|
}
|
|
696
697
|
return "";
|
|
@@ -1327,7 +1328,7 @@ function initialsOf(name) {
|
|
|
1327
1328
|
}
|
|
1328
1329
|
function ReporterChip({
|
|
1329
1330
|
reporter,
|
|
1330
|
-
t
|
|
1331
|
+
t: t2
|
|
1331
1332
|
}) {
|
|
1332
1333
|
var _a;
|
|
1333
1334
|
const [avatarFailed, setAvatarFailed] = (0, import_react.useState)(false);
|
|
@@ -1363,9 +1364,9 @@ function ReporterChip({
|
|
|
1363
1364
|
fontSize: "8px",
|
|
1364
1365
|
fontWeight: 700,
|
|
1365
1366
|
letterSpacing: "0.02em",
|
|
1366
|
-
background: isAnonymous ?
|
|
1367
|
-
color: isAnonymous ?
|
|
1368
|
-
border: `1px solid ${isAnonymous ?
|
|
1367
|
+
background: isAnonymous ? t2.inputBg : t2.accent,
|
|
1368
|
+
color: isAnonymous ? t2.textMuted : t2.accentText,
|
|
1369
|
+
border: `1px solid ${isAnonymous ? t2.inputBorder : "transparent"}`
|
|
1369
1370
|
},
|
|
1370
1371
|
children: showAvatarImage ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1371
1372
|
"img",
|
|
@@ -1396,7 +1397,7 @@ function ReporterChip({
|
|
|
1396
1397
|
{
|
|
1397
1398
|
style: {
|
|
1398
1399
|
fontSize: "11px",
|
|
1399
|
-
color:
|
|
1400
|
+
color: t2.textMuted,
|
|
1400
1401
|
overflow: "hidden",
|
|
1401
1402
|
textOverflow: "ellipsis",
|
|
1402
1403
|
whiteSpace: "nowrap"
|
|
@@ -1653,7 +1654,7 @@ function ReportDialog({
|
|
|
1653
1654
|
(_c = tiles[next]) == null ? void 0 : _c.focus();
|
|
1654
1655
|
};
|
|
1655
1656
|
const isDark = useIsDark();
|
|
1656
|
-
const
|
|
1657
|
+
const t2 = getTheme(isDark);
|
|
1657
1658
|
const canZoomPreview = previewNatural !== null && typeof window !== "undefined" && (previewNatural.w > window.innerWidth - 32 || previewNatural.h > window.innerHeight - 80);
|
|
1658
1659
|
const handleFileUpload = (e) => {
|
|
1659
1660
|
const files = e.target.files;
|
|
@@ -1829,7 +1830,7 @@ function ReportDialog({
|
|
|
1829
1830
|
sarvamChunksRef.current = [];
|
|
1830
1831
|
const stream = streamRef.current;
|
|
1831
1832
|
streamRef.current = null;
|
|
1832
|
-
stream == null ? void 0 : stream.getTracks().forEach((
|
|
1833
|
+
stream == null ? void 0 : stream.getTracks().forEach((t22) => t22.stop());
|
|
1833
1834
|
try {
|
|
1834
1835
|
(_b = mediaRecorderRef.current) == null ? void 0 : _b.stop();
|
|
1835
1836
|
} catch (e) {
|
|
@@ -1891,7 +1892,7 @@ function ReportDialog({
|
|
|
1891
1892
|
if (e.data.size > 0) sarvamChunksRef.current.push(e.data);
|
|
1892
1893
|
};
|
|
1893
1894
|
rec.onstop = async () => {
|
|
1894
|
-
stream.getTracks().forEach((
|
|
1895
|
+
stream.getTracks().forEach((t22) => t22.stop());
|
|
1895
1896
|
if (streamRef.current === stream) streamRef.current = null;
|
|
1896
1897
|
mediaRecorderRef.current = null;
|
|
1897
1898
|
const chunks = sarvamChunksRef.current;
|
|
@@ -2092,7 +2093,7 @@ function ReportDialog({
|
|
|
2092
2093
|
button[data-gg-type]{transition:transform .15s ease,border-color .15s ease,box-shadow .15s ease,background-color .15s ease}
|
|
2093
2094
|
button[data-gg-type]:hover{transform:translateY(-2px);box-shadow:0 6px 16px rgba(0,0,0,.18)}
|
|
2094
2095
|
button[data-gg-type]:active{transform:translateY(0) scale(.985);box-shadow:none}
|
|
2095
|
-
button[data-gg-type]:focus-visible{outline:2px solid ${
|
|
2096
|
+
button[data-gg-type]:focus-visible{outline:2px solid ${t2.accent};outline-offset:2px}
|
|
2096
2097
|
@keyframes gg-star-pop{0%{transform:scale(.6);opacity:0}60%{transform:scale(1.12)}100%{transform:scale(1);opacity:1}}
|
|
2097
2098
|
button[data-gg-star]{transition:transform .12s ease}
|
|
2098
2099
|
button[data-gg-star]:hover{transform:scale(1.18)}
|
|
@@ -2135,12 +2136,12 @@ function ReportDialog({
|
|
|
2135
2136
|
maxHeight: "calc(100dvh - 32px)",
|
|
2136
2137
|
display: "flex",
|
|
2137
2138
|
flexDirection: "column",
|
|
2138
|
-
backgroundColor:
|
|
2139
|
+
backgroundColor: t2.bg,
|
|
2139
2140
|
borderRadius: "12px",
|
|
2140
2141
|
boxShadow: "0 20px 60px rgba(0, 0, 0, 0.2), 0 4px 16px rgba(0, 0, 0, 0.1)",
|
|
2141
2142
|
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
|
|
2142
2143
|
overflow: "hidden",
|
|
2143
|
-
color:
|
|
2144
|
+
color: t2.text,
|
|
2144
2145
|
isolation: "isolate"
|
|
2145
2146
|
},
|
|
2146
2147
|
children: [
|
|
@@ -2150,7 +2151,7 @@ function ReportDialog({
|
|
|
2150
2151
|
style: {
|
|
2151
2152
|
flexShrink: 0,
|
|
2152
2153
|
padding: "16px 16px 12px",
|
|
2153
|
-
borderBottom: `1px solid ${
|
|
2154
|
+
borderBottom: `1px solid ${t2.border}`
|
|
2154
2155
|
},
|
|
2155
2156
|
children: [
|
|
2156
2157
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
@@ -2196,7 +2197,7 @@ function ReportDialog({
|
|
|
2196
2197
|
"path",
|
|
2197
2198
|
{
|
|
2198
2199
|
d: "M10 3L5 8L10 13",
|
|
2199
|
-
stroke:
|
|
2200
|
+
stroke: t2.textMuted,
|
|
2200
2201
|
strokeWidth: "2",
|
|
2201
2202
|
strokeLinecap: "round",
|
|
2202
2203
|
strokeLinejoin: "round"
|
|
@@ -2212,7 +2213,7 @@ function ReportDialog({
|
|
|
2212
2213
|
style: {
|
|
2213
2214
|
fontSize: "15px",
|
|
2214
2215
|
fontWeight: 600,
|
|
2215
|
-
color:
|
|
2216
|
+
color: t2.text
|
|
2216
2217
|
},
|
|
2217
2218
|
children: step === 1 ? "What's on your mind?" : "Tell us more"
|
|
2218
2219
|
}
|
|
@@ -2239,9 +2240,9 @@ function ReportDialog({
|
|
|
2239
2240
|
lineHeight: 1,
|
|
2240
2241
|
padding: "3px 6px",
|
|
2241
2242
|
borderRadius: "4px",
|
|
2242
|
-
border: `1px solid ${
|
|
2243
|
-
background:
|
|
2244
|
-
color:
|
|
2243
|
+
border: `1px solid ${t2.inputBorder}`,
|
|
2244
|
+
background: t2.inputBg,
|
|
2245
|
+
color: t2.textMuted,
|
|
2245
2246
|
whiteSpace: "nowrap"
|
|
2246
2247
|
},
|
|
2247
2248
|
children: getShortcutLabel()
|
|
@@ -2274,7 +2275,7 @@ function ReportDialog({
|
|
|
2274
2275
|
"path",
|
|
2275
2276
|
{
|
|
2276
2277
|
d: "M4 4L12 12M12 4L4 12",
|
|
2277
|
-
stroke:
|
|
2278
|
+
stroke: t2.textMuted,
|
|
2278
2279
|
strokeWidth: "2",
|
|
2279
2280
|
strokeLinecap: "round"
|
|
2280
2281
|
}
|
|
@@ -2311,7 +2312,7 @@ function ReportDialog({
|
|
|
2311
2312
|
width: "8px",
|
|
2312
2313
|
height: "8px",
|
|
2313
2314
|
borderRadius: "50%",
|
|
2314
|
-
backgroundColor: s <= step ?
|
|
2315
|
+
backgroundColor: s <= step ? t2.accent : t2.inputBorder,
|
|
2315
2316
|
transition: "background-color 0.2s ease"
|
|
2316
2317
|
}
|
|
2317
2318
|
}
|
|
@@ -2322,7 +2323,7 @@ function ReportDialog({
|
|
|
2322
2323
|
style: {
|
|
2323
2324
|
width: "40px",
|
|
2324
2325
|
height: "2px",
|
|
2325
|
-
backgroundColor: s < step ?
|
|
2326
|
+
backgroundColor: s < step ? t2.accent : t2.inputBorder,
|
|
2326
2327
|
transition: "background-color 0.2s ease"
|
|
2327
2328
|
}
|
|
2328
2329
|
}
|
|
@@ -2351,7 +2352,7 @@ function ReportDialog({
|
|
|
2351
2352
|
style: {
|
|
2352
2353
|
textAlign: "center",
|
|
2353
2354
|
padding: "20px 0",
|
|
2354
|
-
color:
|
|
2355
|
+
color: t2.accent,
|
|
2355
2356
|
fontSize: "14px",
|
|
2356
2357
|
fontWeight: 500
|
|
2357
2358
|
},
|
|
@@ -2382,7 +2383,7 @@ function ReportDialog({
|
|
|
2382
2383
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2383
2384
|
"span",
|
|
2384
2385
|
{
|
|
2385
|
-
style: { fontSize: "13px", fontWeight: 600, color:
|
|
2386
|
+
style: { fontSize: "13px", fontWeight: 600, color: t2.text },
|
|
2386
2387
|
children: "How are we doing?"
|
|
2387
2388
|
}
|
|
2388
2389
|
),
|
|
@@ -2435,9 +2436,9 @@ function ReportDialog({
|
|
|
2435
2436
|
marginBottom: "16px"
|
|
2436
2437
|
},
|
|
2437
2438
|
children: [
|
|
2438
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { flex: 1, height: "1px", background:
|
|
2439
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { fontSize: "11px", color:
|
|
2440
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { flex: 1, height: "1px", background:
|
|
2439
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { flex: 1, height: "1px", background: t2.border } }),
|
|
2440
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { fontSize: "11px", color: t2.textMuted }, children: "or report something" }),
|
|
2441
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { flex: 1, height: "1px", background: t2.border } })
|
|
2441
2442
|
]
|
|
2442
2443
|
}
|
|
2443
2444
|
),
|
|
@@ -2450,9 +2451,9 @@ function ReportDialog({
|
|
|
2450
2451
|
gap: "10px",
|
|
2451
2452
|
marginBottom: "14px",
|
|
2452
2453
|
padding: "8px 10px",
|
|
2453
|
-
border: `1px solid ${
|
|
2454
|
+
border: `1px solid ${t2.inputBorder}`,
|
|
2454
2455
|
borderRadius: "8px",
|
|
2455
|
-
background:
|
|
2456
|
+
background: t2.inputBg
|
|
2456
2457
|
},
|
|
2457
2458
|
children: [
|
|
2458
2459
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
@@ -2465,12 +2466,12 @@ function ReportDialog({
|
|
|
2465
2466
|
height: "24px",
|
|
2466
2467
|
objectFit: "cover",
|
|
2467
2468
|
borderRadius: "4px",
|
|
2468
|
-
border: `1px solid ${
|
|
2469
|
+
border: `1px solid ${t2.border}`,
|
|
2469
2470
|
flexShrink: 0
|
|
2470
2471
|
}
|
|
2471
2472
|
}
|
|
2472
2473
|
),
|
|
2473
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { fontSize: "11px", color:
|
|
2474
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { fontSize: "11px", color: t2.textMuted, flex: 1 }, children: "Screenshot attached" }),
|
|
2474
2475
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2475
2476
|
"button",
|
|
2476
2477
|
{
|
|
@@ -2480,7 +2481,7 @@ function ReportDialog({
|
|
|
2480
2481
|
style: {
|
|
2481
2482
|
border: "none",
|
|
2482
2483
|
background: "transparent",
|
|
2483
|
-
color:
|
|
2484
|
+
color: t2.textMuted,
|
|
2484
2485
|
cursor: "pointer",
|
|
2485
2486
|
fontSize: "15px",
|
|
2486
2487
|
lineHeight: 1,
|
|
@@ -2518,20 +2519,20 @@ function ReportDialog({
|
|
|
2518
2519
|
gap: "9px",
|
|
2519
2520
|
padding: "18px 10px",
|
|
2520
2521
|
borderRadius: "8px",
|
|
2521
|
-
border: `1px solid ${
|
|
2522
|
-
background:
|
|
2522
|
+
border: `1px solid ${t2.inputBorder}`,
|
|
2523
|
+
background: t2.inputBg,
|
|
2523
2524
|
cursor: "pointer",
|
|
2524
|
-
color:
|
|
2525
|
+
color: t2.text,
|
|
2525
2526
|
fontFamily: "inherit"
|
|
2526
2527
|
},
|
|
2527
2528
|
onMouseEnter: (e) => {
|
|
2528
|
-
e.currentTarget.style.borderColor =
|
|
2529
|
+
e.currentTarget.style.borderColor = t2.accent;
|
|
2529
2530
|
},
|
|
2530
2531
|
onMouseLeave: (e) => {
|
|
2531
|
-
e.currentTarget.style.borderColor =
|
|
2532
|
+
e.currentTarget.style.borderColor = t2.inputBorder;
|
|
2532
2533
|
},
|
|
2533
2534
|
children: [
|
|
2534
|
-
getTypeIcon(type,
|
|
2535
|
+
getTypeIcon(type, t2.accent, 22),
|
|
2535
2536
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2536
2537
|
"span",
|
|
2537
2538
|
{
|
|
@@ -2563,18 +2564,18 @@ function ReportDialog({
|
|
|
2563
2564
|
marginBottom: "10px",
|
|
2564
2565
|
padding: "4px 10px 4px 8px",
|
|
2565
2566
|
borderRadius: "999px",
|
|
2566
|
-
border: `1px solid ${isRating ? "rgba(245,158,11,0.4)" :
|
|
2567
|
-
background: isRating ? "rgba(245,158,11,0.1)" :
|
|
2568
|
-
color:
|
|
2567
|
+
border: `1px solid ${isRating ? "rgba(245,158,11,0.4)" : t2.inputBorder}`,
|
|
2568
|
+
background: isRating ? "rgba(245,158,11,0.1)" : t2.inputBg,
|
|
2569
|
+
color: t2.text,
|
|
2569
2570
|
fontSize: "11px",
|
|
2570
2571
|
fontWeight: 600,
|
|
2571
2572
|
fontFamily: "inherit",
|
|
2572
2573
|
cursor: "pointer"
|
|
2573
2574
|
},
|
|
2574
2575
|
children: [
|
|
2575
|
-
getTypeIcon(reportType, isRating ? "#f59e0b" :
|
|
2576
|
+
getTypeIcon(reportType, isRating ? "#f59e0b" : t2.accent, 13),
|
|
2576
2577
|
getTypeLabel(reportType),
|
|
2577
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { color:
|
|
2578
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { color: t2.textMuted, fontWeight: 400 }, children: "\xB7 change" })
|
|
2578
2579
|
]
|
|
2579
2580
|
}
|
|
2580
2581
|
),
|
|
@@ -2611,7 +2612,7 @@ function ReportDialog({
|
|
|
2611
2612
|
{
|
|
2612
2613
|
d: "M12 3l2.6 5.3 5.9.9-4.3 4.1 1 5.8L12 16.4 6.8 19.1l1-5.8L3.5 9.2l5.9-.9L12 3z",
|
|
2613
2614
|
fill: filled ? "#f59e0b" : "transparent",
|
|
2614
|
-
stroke: filled ? "#f59e0b" :
|
|
2615
|
+
stroke: filled ? "#f59e0b" : t2.inputBorder,
|
|
2615
2616
|
strokeWidth: "1.5",
|
|
2616
2617
|
strokeLinejoin: "round"
|
|
2617
2618
|
}
|
|
@@ -2642,24 +2643,24 @@ function ReportDialog({
|
|
|
2642
2643
|
minHeight: "100px",
|
|
2643
2644
|
padding: enhanceText2 ? "28px 12px 36px" : transcribeAudio2 ? "10px 12px 36px" : "10px 12px",
|
|
2644
2645
|
borderRadius: "8px",
|
|
2645
|
-
border: `1px solid ${isTranscribing ? "#f59e0b" : isListening ?
|
|
2646
|
+
border: `1px solid ${isTranscribing ? "#f59e0b" : isListening ? t2.accent : t2.inputBorder}`,
|
|
2646
2647
|
fontSize: "14px",
|
|
2647
2648
|
fontFamily: "inherit",
|
|
2648
2649
|
resize: "none",
|
|
2649
2650
|
outline: "none",
|
|
2650
2651
|
boxSizing: "border-box",
|
|
2651
|
-
color:
|
|
2652
|
-
backgroundColor:
|
|
2652
|
+
color: t2.text,
|
|
2653
|
+
backgroundColor: t2.inputBg,
|
|
2653
2654
|
transition: "border-color 0.2s ease"
|
|
2654
2655
|
},
|
|
2655
2656
|
onKeyDown: handleSpaceDown,
|
|
2656
2657
|
onKeyUp: handleSpaceUp,
|
|
2657
2658
|
onFocus: (e) => {
|
|
2658
|
-
e.target.style.borderColor =
|
|
2659
|
+
e.target.style.borderColor = t2.accent;
|
|
2659
2660
|
},
|
|
2660
2661
|
onBlur: (e) => {
|
|
2661
2662
|
if (!isListening && !isTranscribing)
|
|
2662
|
-
e.target.style.borderColor =
|
|
2663
|
+
e.target.style.borderColor = t2.inputBorder;
|
|
2663
2664
|
},
|
|
2664
2665
|
autoFocus: true
|
|
2665
2666
|
}
|
|
@@ -2776,13 +2777,13 @@ function ReportDialog({
|
|
|
2776
2777
|
display: "inline-flex",
|
|
2777
2778
|
alignItems: "center",
|
|
2778
2779
|
gap: "4px",
|
|
2779
|
-
background:
|
|
2780
|
+
background: t2.inputBg,
|
|
2780
2781
|
border: "none",
|
|
2781
2782
|
padding: "2px 6px",
|
|
2782
2783
|
borderRadius: "4px",
|
|
2783
2784
|
fontFamily: "inherit",
|
|
2784
2785
|
fontSize: "11px",
|
|
2785
|
-
color:
|
|
2786
|
+
color: t2.textMuted,
|
|
2786
2787
|
cursor: !description.trim() || isEnhancing ? "default" : "pointer",
|
|
2787
2788
|
opacity: !description.trim() ? 0.5 : 1,
|
|
2788
2789
|
zIndex: 1
|
|
@@ -2801,7 +2802,7 @@ function ReportDialog({
|
|
|
2801
2802
|
"path",
|
|
2802
2803
|
{
|
|
2803
2804
|
d: "M12 3l1.5 4.5L18 9l-4.5 1.5L12 15l-1.5-4.5L6 9l4.5-1.5L12 3zM19 15l.75 2.25L22 18l-2.25.75L19 21l-.75-2.25L16 18l2.25-.75L19 15z",
|
|
2804
|
-
stroke:
|
|
2805
|
+
stroke: t2.textMuted,
|
|
2805
2806
|
strokeWidth: "1.5",
|
|
2806
2807
|
strokeLinejoin: "round"
|
|
2807
2808
|
}
|
|
@@ -2830,9 +2831,9 @@ function ReportDialog({
|
|
|
2830
2831
|
alignItems: "center",
|
|
2831
2832
|
justifyContent: "center",
|
|
2832
2833
|
background: "transparent",
|
|
2833
|
-
border: `1.5px solid ${isListening ? "#ef4444" :
|
|
2834
|
+
border: `1.5px solid ${isListening ? "#ef4444" : t2.inputBorder}`,
|
|
2834
2835
|
borderRadius: "6px",
|
|
2835
|
-
color: isListening ? "#ef4444" :
|
|
2836
|
+
color: isListening ? "#ef4444" : t2.textMuted,
|
|
2836
2837
|
cursor: "pointer",
|
|
2837
2838
|
zIndex: 1,
|
|
2838
2839
|
padding: 0,
|
|
@@ -2902,7 +2903,7 @@ function ReportDialog({
|
|
|
2902
2903
|
gap: "5px",
|
|
2903
2904
|
marginTop: "5px",
|
|
2904
2905
|
fontSize: "11px",
|
|
2905
|
-
color:
|
|
2906
|
+
color: t2.text,
|
|
2906
2907
|
opacity: 0.55,
|
|
2907
2908
|
userSelect: "none"
|
|
2908
2909
|
},
|
|
@@ -2927,7 +2928,7 @@ function ReportDialog({
|
|
|
2927
2928
|
padding: "6px 8px",
|
|
2928
2929
|
borderRadius: "6px",
|
|
2929
2930
|
background: isDark ? "rgba(34,211,238,0.06)" : "rgba(8,145,178,0.05)",
|
|
2930
|
-
border: `1px solid ${
|
|
2931
|
+
border: `1px solid ${t2.accent}40`
|
|
2931
2932
|
},
|
|
2932
2933
|
children: [
|
|
2933
2934
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
@@ -2942,7 +2943,7 @@ function ReportDialog({
|
|
|
2942
2943
|
"path",
|
|
2943
2944
|
{
|
|
2944
2945
|
d: "M12 3l1.5 4.5L18 9l-4.5 1.5L12 15l-1.5-4.5L6 9l4.5-1.5L12 3z",
|
|
2945
|
-
stroke:
|
|
2946
|
+
stroke: t2.accent,
|
|
2946
2947
|
strokeWidth: "1.5",
|
|
2947
2948
|
strokeLinejoin: "round"
|
|
2948
2949
|
}
|
|
@@ -2954,7 +2955,7 @@ function ReportDialog({
|
|
|
2954
2955
|
{
|
|
2955
2956
|
style: {
|
|
2956
2957
|
fontSize: "11px",
|
|
2957
|
-
color:
|
|
2958
|
+
color: t2.textMuted,
|
|
2958
2959
|
flex: 1
|
|
2959
2960
|
},
|
|
2960
2961
|
children: "AI enhanced"
|
|
@@ -2971,9 +2972,9 @@ function ReportDialog({
|
|
|
2971
2972
|
style: {
|
|
2972
2973
|
padding: "2px 8px",
|
|
2973
2974
|
borderRadius: "4px",
|
|
2974
|
-
border: `1px solid ${
|
|
2975
|
-
background:
|
|
2976
|
-
color:
|
|
2975
|
+
border: `1px solid ${t2.accent}`,
|
|
2976
|
+
background: t2.accent,
|
|
2977
|
+
color: t2.accentText,
|
|
2977
2978
|
fontSize: "11px",
|
|
2978
2979
|
fontWeight: 600,
|
|
2979
2980
|
cursor: "pointer",
|
|
@@ -2994,9 +2995,9 @@ function ReportDialog({
|
|
|
2994
2995
|
style: {
|
|
2995
2996
|
padding: "2px 8px",
|
|
2996
2997
|
borderRadius: "4px",
|
|
2997
|
-
border: `1px solid ${
|
|
2998
|
+
border: `1px solid ${t2.inputBorder}`,
|
|
2998
2999
|
background: "transparent",
|
|
2999
|
-
color:
|
|
3000
|
+
color: t2.textMuted,
|
|
3000
3001
|
fontSize: "11px",
|
|
3001
3002
|
fontWeight: 600,
|
|
3002
3003
|
cursor: "pointer",
|
|
@@ -3026,7 +3027,7 @@ function ReportDialog({
|
|
|
3026
3027
|
{
|
|
3027
3028
|
style: {
|
|
3028
3029
|
fontSize: "12px",
|
|
3029
|
-
color:
|
|
3030
|
+
color: t2.textMuted,
|
|
3030
3031
|
marginBottom: "6px",
|
|
3031
3032
|
display: "block",
|
|
3032
3033
|
fontWeight: 500
|
|
@@ -3065,7 +3066,7 @@ function ReportDialog({
|
|
|
3065
3066
|
width: "100%",
|
|
3066
3067
|
height: "100%",
|
|
3067
3068
|
borderRadius: "6px",
|
|
3068
|
-
border: `1px solid ${
|
|
3069
|
+
border: `1px solid ${t2.border}`,
|
|
3069
3070
|
objectFit: "cover",
|
|
3070
3071
|
objectPosition: "top",
|
|
3071
3072
|
cursor: "zoom-in",
|
|
@@ -3135,8 +3136,8 @@ function ReportDialog({
|
|
|
3135
3136
|
height: "24px",
|
|
3136
3137
|
borderRadius: "50%",
|
|
3137
3138
|
border: "none",
|
|
3138
|
-
background:
|
|
3139
|
-
color:
|
|
3139
|
+
background: t2.accent,
|
|
3140
|
+
color: t2.accentText,
|
|
3140
3141
|
padding: 0,
|
|
3141
3142
|
cursor: "pointer",
|
|
3142
3143
|
display: "flex",
|
|
@@ -3189,7 +3190,7 @@ function ReportDialog({
|
|
|
3189
3190
|
gap: "8px",
|
|
3190
3191
|
padding: "6px 8px",
|
|
3191
3192
|
borderRadius: "6px",
|
|
3192
|
-
border: `1px solid ${
|
|
3193
|
+
border: `1px solid ${t2.border}`
|
|
3193
3194
|
},
|
|
3194
3195
|
children: [
|
|
3195
3196
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
@@ -3205,7 +3206,7 @@ function ReportDialog({
|
|
|
3205
3206
|
"path",
|
|
3206
3207
|
{
|
|
3207
3208
|
d: "M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z",
|
|
3208
|
-
stroke:
|
|
3209
|
+
stroke: t2.textMuted,
|
|
3209
3210
|
strokeWidth: "1.5",
|
|
3210
3211
|
strokeLinecap: "round",
|
|
3211
3212
|
strokeLinejoin: "round"
|
|
@@ -3215,7 +3216,7 @@ function ReportDialog({
|
|
|
3215
3216
|
"path",
|
|
3216
3217
|
{
|
|
3217
3218
|
d: "M14 2v6h6",
|
|
3218
|
-
stroke:
|
|
3219
|
+
stroke: t2.textMuted,
|
|
3219
3220
|
strokeWidth: "1.5",
|
|
3220
3221
|
strokeLinecap: "round",
|
|
3221
3222
|
strokeLinejoin: "round"
|
|
@@ -3229,7 +3230,7 @@ function ReportDialog({
|
|
|
3229
3230
|
{
|
|
3230
3231
|
style: {
|
|
3231
3232
|
fontSize: "11px",
|
|
3232
|
-
color:
|
|
3233
|
+
color: t2.text,
|
|
3233
3234
|
flex: 1,
|
|
3234
3235
|
overflow: "hidden",
|
|
3235
3236
|
textOverflow: "ellipsis",
|
|
@@ -3241,7 +3242,7 @@ function ReportDialog({
|
|
|
3241
3242
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
3242
3243
|
"span",
|
|
3243
3244
|
{
|
|
3244
|
-
style: { fontSize: "10px", color:
|
|
3245
|
+
style: { fontSize: "10px", color: t2.textMuted },
|
|
3245
3246
|
children: [
|
|
3246
3247
|
(a.size / 1024).toFixed(0),
|
|
3247
3248
|
"KB"
|
|
@@ -3316,7 +3317,7 @@ function ReportDialog({
|
|
|
3316
3317
|
},
|
|
3317
3318
|
onDragLeave: () => setScreenshotDragOver(false),
|
|
3318
3319
|
style: {
|
|
3319
|
-
border: `1.5px dashed ${screenshotDragOver ?
|
|
3320
|
+
border: `1.5px dashed ${screenshotDragOver ? t2.accent : t2.inputBorder}`,
|
|
3320
3321
|
borderRadius: "8px",
|
|
3321
3322
|
padding: screenshots.length + attachments.length > 0 ? "8px 12px" : "18px 12px",
|
|
3322
3323
|
textAlign: "center",
|
|
@@ -3331,7 +3332,7 @@ function ReportDialog({
|
|
|
3331
3332
|
margin: 0,
|
|
3332
3333
|
fontSize: "11px",
|
|
3333
3334
|
fontWeight: 500,
|
|
3334
|
-
color:
|
|
3335
|
+
color: t2.textMuted
|
|
3335
3336
|
},
|
|
3336
3337
|
children: screenshotDragOver ? "Drop to attach" : "+ Add more \xB7 Drag & drop \xB7 Paste"
|
|
3337
3338
|
}
|
|
@@ -3357,7 +3358,7 @@ function ReportDialog({
|
|
|
3357
3358
|
width: "18",
|
|
3358
3359
|
height: "18",
|
|
3359
3360
|
rx: "2",
|
|
3360
|
-
stroke:
|
|
3361
|
+
stroke: t2.textMuted,
|
|
3361
3362
|
strokeWidth: "1.5"
|
|
3362
3363
|
}
|
|
3363
3364
|
),
|
|
@@ -3367,7 +3368,7 @@ function ReportDialog({
|
|
|
3367
3368
|
cx: "8.5",
|
|
3368
3369
|
cy: "8.5",
|
|
3369
3370
|
r: "1.5",
|
|
3370
|
-
stroke:
|
|
3371
|
+
stroke: t2.textMuted,
|
|
3371
3372
|
strokeWidth: "1.5"
|
|
3372
3373
|
}
|
|
3373
3374
|
),
|
|
@@ -3375,7 +3376,7 @@ function ReportDialog({
|
|
|
3375
3376
|
"path",
|
|
3376
3377
|
{
|
|
3377
3378
|
d: "M21 15l-5-5L5 21",
|
|
3378
|
-
stroke:
|
|
3379
|
+
stroke: t2.textMuted,
|
|
3379
3380
|
strokeWidth: "1.5",
|
|
3380
3381
|
strokeLinecap: "round",
|
|
3381
3382
|
strokeLinejoin: "round"
|
|
@@ -3391,7 +3392,7 @@ function ReportDialog({
|
|
|
3391
3392
|
margin: 0,
|
|
3392
3393
|
fontSize: "12px",
|
|
3393
3394
|
fontWeight: 600,
|
|
3394
|
-
color:
|
|
3395
|
+
color: t2.text
|
|
3395
3396
|
},
|
|
3396
3397
|
children: screenshotDragOver ? "Drop to attach" : "Add screenshots or files"
|
|
3397
3398
|
}
|
|
@@ -3402,7 +3403,7 @@ function ReportDialog({
|
|
|
3402
3403
|
style: {
|
|
3403
3404
|
margin: "3px 0 0",
|
|
3404
3405
|
fontSize: "11px",
|
|
3405
|
-
color:
|
|
3406
|
+
color: t2.textMuted
|
|
3406
3407
|
},
|
|
3407
3408
|
children: "Images, PDF, DOC, XLS \xB7 Drag & drop \xB7 Paste \u2318V / Ctrl+V \xB7 Click to browse"
|
|
3408
3409
|
}
|
|
@@ -3417,7 +3418,7 @@ function ReportDialog({
|
|
|
3417
3418
|
{
|
|
3418
3419
|
style: {
|
|
3419
3420
|
fontSize: "12px",
|
|
3420
|
-
color:
|
|
3421
|
+
color: t2.textMuted,
|
|
3421
3422
|
marginBottom: "6px",
|
|
3422
3423
|
display: "block"
|
|
3423
3424
|
},
|
|
@@ -3433,9 +3434,9 @@ function ReportDialog({
|
|
|
3433
3434
|
flex: 1,
|
|
3434
3435
|
padding: "6px 0",
|
|
3435
3436
|
borderRadius: "6px",
|
|
3436
|
-
border: `1px solid ${severity === s ?
|
|
3437
|
-
background: severity === s ?
|
|
3438
|
-
color: severity === s ?
|
|
3437
|
+
border: `1px solid ${severity === s ? t2.accent : t2.inputBorder}`,
|
|
3438
|
+
background: severity === s ? t2.accent : "transparent",
|
|
3439
|
+
color: severity === s ? t2.accentText : t2.text,
|
|
3439
3440
|
fontSize: "12px",
|
|
3440
3441
|
fontWeight: 600,
|
|
3441
3442
|
cursor: "pointer",
|
|
@@ -3471,8 +3472,8 @@ function ReportDialog({
|
|
|
3471
3472
|
padding: "10px",
|
|
3472
3473
|
borderRadius: "8px",
|
|
3473
3474
|
border: "none",
|
|
3474
|
-
backgroundColor: submitDisabled ?
|
|
3475
|
-
color: submitDisabled ?
|
|
3475
|
+
backgroundColor: submitDisabled ? t2.bgSecondary : t2.accent,
|
|
3476
|
+
color: submitDisabled ? t2.textMuted : t2.accentText,
|
|
3476
3477
|
fontSize: "14px",
|
|
3477
3478
|
fontWeight: 600,
|
|
3478
3479
|
cursor: submitDisabled ? "not-allowed" : "pointer",
|
|
@@ -3491,20 +3492,20 @@ function ReportDialog({
|
|
|
3491
3492
|
{
|
|
3492
3493
|
style: {
|
|
3493
3494
|
padding: "8px 16px 10px",
|
|
3494
|
-
borderTop: `1px solid ${
|
|
3495
|
+
borderTop: `1px solid ${t2.border}`,
|
|
3495
3496
|
display: "flex",
|
|
3496
3497
|
alignItems: "center",
|
|
3497
3498
|
justifyContent: "space-between",
|
|
3498
3499
|
gap: "12px"
|
|
3499
3500
|
},
|
|
3500
3501
|
children: [
|
|
3501
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ReporterChip, { reporter, t }),
|
|
3502
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ReporterChip, { reporter, t: t2 }),
|
|
3502
3503
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
3503
3504
|
"span",
|
|
3504
3505
|
{
|
|
3505
3506
|
style: {
|
|
3506
3507
|
fontSize: "11px",
|
|
3507
|
-
color:
|
|
3508
|
+
color: t2.textMuted,
|
|
3508
3509
|
whiteSpace: "nowrap",
|
|
3509
3510
|
flexShrink: 0
|
|
3510
3511
|
},
|
|
@@ -3632,8 +3633,8 @@ function ReportDialog({
|
|
|
3632
3633
|
padding: "8px 14px",
|
|
3633
3634
|
borderRadius: "999px",
|
|
3634
3635
|
border: "none",
|
|
3635
|
-
background:
|
|
3636
|
-
color:
|
|
3636
|
+
background: t2.accent,
|
|
3637
|
+
color: t2.accentText,
|
|
3637
3638
|
fontSize: "13px",
|
|
3638
3639
|
fontWeight: 700,
|
|
3639
3640
|
cursor: "pointer",
|
|
@@ -3672,7 +3673,7 @@ function ReportDialog({
|
|
|
3672
3673
|
"span",
|
|
3673
3674
|
{
|
|
3674
3675
|
style: {
|
|
3675
|
-
color:
|
|
3676
|
+
color: t2.textMuted,
|
|
3676
3677
|
fontSize: "12px"
|
|
3677
3678
|
},
|
|
3678
3679
|
children: [
|
|
@@ -3858,6 +3859,400 @@ function getTypeIcon(type, color, size = 24) {
|
|
|
3858
3859
|
}
|
|
3859
3860
|
}
|
|
3860
3861
|
|
|
3862
|
+
// src/booking-dialog.tsx
|
|
3863
|
+
var import_react3 = require("react");
|
|
3864
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
3865
|
+
var t = {
|
|
3866
|
+
bg: "#141414",
|
|
3867
|
+
surface: "#1c1c1c",
|
|
3868
|
+
border: "#2a2a2a",
|
|
3869
|
+
text: "#e5e5e5",
|
|
3870
|
+
muted: "#9aa0a6",
|
|
3871
|
+
accent: "#3b82f6",
|
|
3872
|
+
danger: "#f87171"
|
|
3873
|
+
};
|
|
3874
|
+
function localZone() {
|
|
3875
|
+
try {
|
|
3876
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
3877
|
+
} catch (e) {
|
|
3878
|
+
return "UTC";
|
|
3879
|
+
}
|
|
3880
|
+
}
|
|
3881
|
+
function dayKey(iso) {
|
|
3882
|
+
return new Date(iso).toDateString();
|
|
3883
|
+
}
|
|
3884
|
+
function formatDay(iso) {
|
|
3885
|
+
return new Date(iso).toLocaleDateString(void 0, {
|
|
3886
|
+
weekday: "short",
|
|
3887
|
+
day: "numeric",
|
|
3888
|
+
month: "short"
|
|
3889
|
+
});
|
|
3890
|
+
}
|
|
3891
|
+
function formatTime(iso) {
|
|
3892
|
+
return new Date(iso).toLocaleTimeString(void 0, { hour: "2-digit", minute: "2-digit" });
|
|
3893
|
+
}
|
|
3894
|
+
function BookingDialog({
|
|
3895
|
+
token,
|
|
3896
|
+
baseUrl,
|
|
3897
|
+
open,
|
|
3898
|
+
onClose
|
|
3899
|
+
}) {
|
|
3900
|
+
var _a;
|
|
3901
|
+
const [step, setStep] = (0, import_react3.useState)("slots");
|
|
3902
|
+
const [slots, setSlots] = (0, import_react3.useState)(null);
|
|
3903
|
+
const [heading, setHeading] = (0, import_react3.useState)({
|
|
3904
|
+
title: "Book a demo",
|
|
3905
|
+
description: null
|
|
3906
|
+
});
|
|
3907
|
+
const [whatsappUrl, setWhatsappUrl] = (0, import_react3.useState)(null);
|
|
3908
|
+
const [selected, setSelected] = (0, import_react3.useState)(null);
|
|
3909
|
+
const [name, setName] = (0, import_react3.useState)("");
|
|
3910
|
+
const [email, setEmail] = (0, import_react3.useState)("");
|
|
3911
|
+
const [phone, setPhone] = (0, import_react3.useState)("");
|
|
3912
|
+
const [note, setNote] = (0, import_react3.useState)("");
|
|
3913
|
+
const [code, setCode] = (0, import_react3.useState)("");
|
|
3914
|
+
const [bookingId, setBookingId] = (0, import_react3.useState)(null);
|
|
3915
|
+
const [meetUrl, setMeetUrl] = (0, import_react3.useState)(null);
|
|
3916
|
+
const [busy, setBusy] = (0, import_react3.useState)(false);
|
|
3917
|
+
const [error, setError] = (0, import_react3.useState)(null);
|
|
3918
|
+
const headers = (0, import_react3.useMemo)(
|
|
3919
|
+
() => ({ Authorization: `Bearer ${token}`, "Content-Type": "application/json" }),
|
|
3920
|
+
[token]
|
|
3921
|
+
);
|
|
3922
|
+
const loadSlots = (0, import_react3.useCallback)(async () => {
|
|
3923
|
+
var _a2, _b, _c;
|
|
3924
|
+
setError(null);
|
|
3925
|
+
setSlots(null);
|
|
3926
|
+
try {
|
|
3927
|
+
const from = (/* @__PURE__ */ new Date()).toISOString();
|
|
3928
|
+
const to = new Date(Date.now() + 21 * 864e5).toISOString();
|
|
3929
|
+
const res = await fetch(
|
|
3930
|
+
`${baseUrl}/api/v1/sdk/booking/availability?from=${encodeURIComponent(from)}&to=${encodeURIComponent(to)}`,
|
|
3931
|
+
{ headers }
|
|
3932
|
+
);
|
|
3933
|
+
const json = await res.json();
|
|
3934
|
+
if (!json.success) {
|
|
3935
|
+
setError((_a2 = json.error) != null ? _a2 : "Couldn't load available times");
|
|
3936
|
+
setSlots([]);
|
|
3937
|
+
return;
|
|
3938
|
+
}
|
|
3939
|
+
setSlots((_b = json.data.slots) != null ? _b : []);
|
|
3940
|
+
setHeading({ title: json.data.title, description: json.data.description });
|
|
3941
|
+
setWhatsappUrl((_c = json.data.whatsappUrl) != null ? _c : null);
|
|
3942
|
+
} catch (e) {
|
|
3943
|
+
setError("Couldn't reach the booking service");
|
|
3944
|
+
setSlots([]);
|
|
3945
|
+
}
|
|
3946
|
+
}, [baseUrl, headers]);
|
|
3947
|
+
(0, import_react3.useEffect)(() => {
|
|
3948
|
+
if (!open) return;
|
|
3949
|
+
setStep("slots");
|
|
3950
|
+
setSelected(null);
|
|
3951
|
+
setCode("");
|
|
3952
|
+
setBookingId(null);
|
|
3953
|
+
setError(null);
|
|
3954
|
+
void loadSlots();
|
|
3955
|
+
}, [open, loadSlots]);
|
|
3956
|
+
(0, import_react3.useEffect)(() => {
|
|
3957
|
+
if (!open) return;
|
|
3958
|
+
const onKey = (e) => {
|
|
3959
|
+
if (e.key === "Escape") onClose();
|
|
3960
|
+
};
|
|
3961
|
+
document.addEventListener("keydown", onKey, true);
|
|
3962
|
+
return () => document.removeEventListener("keydown", onKey, true);
|
|
3963
|
+
}, [open, onClose]);
|
|
3964
|
+
if (!open) return null;
|
|
3965
|
+
const byDay = /* @__PURE__ */ new Map();
|
|
3966
|
+
for (const slot of slots != null ? slots : []) {
|
|
3967
|
+
const key = dayKey(slot.startsAt);
|
|
3968
|
+
byDay.set(key, [...(_a = byDay.get(key)) != null ? _a : [], slot]);
|
|
3969
|
+
}
|
|
3970
|
+
async function startBooking() {
|
|
3971
|
+
var _a2;
|
|
3972
|
+
if (!selected) return;
|
|
3973
|
+
setBusy(true);
|
|
3974
|
+
setError(null);
|
|
3975
|
+
try {
|
|
3976
|
+
const res = await fetch(`${baseUrl}/api/v1/sdk/booking`, {
|
|
3977
|
+
method: "POST",
|
|
3978
|
+
headers,
|
|
3979
|
+
body: JSON.stringify({
|
|
3980
|
+
name,
|
|
3981
|
+
email,
|
|
3982
|
+
phone,
|
|
3983
|
+
note,
|
|
3984
|
+
startsAt: selected.startsAt,
|
|
3985
|
+
timezone: localZone()
|
|
3986
|
+
})
|
|
3987
|
+
});
|
|
3988
|
+
const json = await res.json();
|
|
3989
|
+
if (!json.success) {
|
|
3990
|
+
setError((_a2 = json.error) != null ? _a2 : "Couldn't hold that slot");
|
|
3991
|
+
return;
|
|
3992
|
+
}
|
|
3993
|
+
setBookingId(json.data.bookingId);
|
|
3994
|
+
setStep("code");
|
|
3995
|
+
} catch (e) {
|
|
3996
|
+
setError("Couldn't reach the booking service");
|
|
3997
|
+
} finally {
|
|
3998
|
+
setBusy(false);
|
|
3999
|
+
}
|
|
4000
|
+
}
|
|
4001
|
+
async function confirmBooking() {
|
|
4002
|
+
var _a2;
|
|
4003
|
+
if (!bookingId) return;
|
|
4004
|
+
setBusy(true);
|
|
4005
|
+
setError(null);
|
|
4006
|
+
try {
|
|
4007
|
+
const res = await fetch(`${baseUrl}/api/v1/sdk/booking/verify`, {
|
|
4008
|
+
method: "POST",
|
|
4009
|
+
headers,
|
|
4010
|
+
body: JSON.stringify({ bookingId, code })
|
|
4011
|
+
});
|
|
4012
|
+
const json = await res.json();
|
|
4013
|
+
if (!json.success) {
|
|
4014
|
+
setError((_a2 = json.error) != null ? _a2 : "Couldn't confirm that code");
|
|
4015
|
+
return;
|
|
4016
|
+
}
|
|
4017
|
+
setMeetUrl(json.data.meetUrl);
|
|
4018
|
+
setStep("done");
|
|
4019
|
+
} catch (e) {
|
|
4020
|
+
setError("Couldn't reach the booking service");
|
|
4021
|
+
} finally {
|
|
4022
|
+
setBusy(false);
|
|
4023
|
+
}
|
|
4024
|
+
}
|
|
4025
|
+
const canSubmitDetails = name.trim() && email.includes("@") && phone.replace(/\D/g, "").length >= 8;
|
|
4026
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4027
|
+
"div",
|
|
4028
|
+
{
|
|
4029
|
+
onClick: (e) => {
|
|
4030
|
+
if (e.target === e.currentTarget) onClose();
|
|
4031
|
+
},
|
|
4032
|
+
style: {
|
|
4033
|
+
position: "fixed",
|
|
4034
|
+
inset: 0,
|
|
4035
|
+
zIndex: 2147483e3,
|
|
4036
|
+
background: "rgba(0,0,0,.6)",
|
|
4037
|
+
display: "flex",
|
|
4038
|
+
alignItems: "center",
|
|
4039
|
+
justifyContent: "center",
|
|
4040
|
+
padding: 16,
|
|
4041
|
+
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
|
|
4042
|
+
},
|
|
4043
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
4044
|
+
"div",
|
|
4045
|
+
{
|
|
4046
|
+
role: "dialog",
|
|
4047
|
+
"aria-modal": "true",
|
|
4048
|
+
"aria-label": heading.title,
|
|
4049
|
+
style: {
|
|
4050
|
+
width: "min(440px, 100%)",
|
|
4051
|
+
maxHeight: "min(660px, 90vh)",
|
|
4052
|
+
display: "flex",
|
|
4053
|
+
flexDirection: "column",
|
|
4054
|
+
background: t.bg,
|
|
4055
|
+
color: t.text,
|
|
4056
|
+
borderRadius: 16,
|
|
4057
|
+
boxShadow: "0 20px 60px rgba(0,0,0,.55)",
|
|
4058
|
+
overflow: "hidden"
|
|
4059
|
+
},
|
|
4060
|
+
children: [
|
|
4061
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
4062
|
+
"div",
|
|
4063
|
+
{
|
|
4064
|
+
style: {
|
|
4065
|
+
padding: "16px 18px",
|
|
4066
|
+
borderBottom: `1px solid ${t.border}`,
|
|
4067
|
+
display: "flex",
|
|
4068
|
+
alignItems: "flex-start",
|
|
4069
|
+
justifyContent: "space-between",
|
|
4070
|
+
gap: 12
|
|
4071
|
+
},
|
|
4072
|
+
children: [
|
|
4073
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
4074
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { fontSize: 15, fontWeight: 600 }, children: heading.title }),
|
|
4075
|
+
heading.description && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { fontSize: 12, color: t.muted, marginTop: 2 }, children: heading.description })
|
|
4076
|
+
] }),
|
|
4077
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4078
|
+
"button",
|
|
4079
|
+
{
|
|
4080
|
+
onClick: onClose,
|
|
4081
|
+
"aria-label": "Close",
|
|
4082
|
+
style: { border: 0, background: "transparent", color: t.muted, fontSize: 20, cursor: "pointer", lineHeight: 1 },
|
|
4083
|
+
children: "\xD7"
|
|
4084
|
+
}
|
|
4085
|
+
)
|
|
4086
|
+
]
|
|
4087
|
+
}
|
|
4088
|
+
),
|
|
4089
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { padding: 18, overflowY: "auto", flex: "1 1 auto" }, children: [
|
|
4090
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { color: t.danger, fontSize: 12, marginBottom: 12, lineHeight: 1.5 }, children: error }),
|
|
4091
|
+
step === "slots" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
4092
|
+
whatsappUrl && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
4093
|
+
"a",
|
|
4094
|
+
{
|
|
4095
|
+
href: whatsappUrl,
|
|
4096
|
+
target: "_blank",
|
|
4097
|
+
rel: "noreferrer",
|
|
4098
|
+
style: {
|
|
4099
|
+
display: "block",
|
|
4100
|
+
marginBottom: 16,
|
|
4101
|
+
padding: "10px 14px",
|
|
4102
|
+
borderRadius: 10,
|
|
4103
|
+
border: `1px solid ${t.border}`,
|
|
4104
|
+
background: t.surface,
|
|
4105
|
+
color: t.text,
|
|
4106
|
+
fontSize: 13,
|
|
4107
|
+
textDecoration: "none"
|
|
4108
|
+
},
|
|
4109
|
+
children: [
|
|
4110
|
+
"\u{1F4AC} Rather book on WhatsApp?",
|
|
4111
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { display: "block", fontSize: 11, color: t.muted, marginTop: 2 }, children: "We'll ask the same questions in chat." })
|
|
4112
|
+
]
|
|
4113
|
+
}
|
|
4114
|
+
),
|
|
4115
|
+
slots === null && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { color: t.muted, fontSize: 13 }, children: "Finding times\u2026" }),
|
|
4116
|
+
(slots == null ? void 0 : slots.length) === 0 && !error && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { color: t.muted, fontSize: 13 }, children: "No times available right now." }),
|
|
4117
|
+
[...byDay.entries()].map(([day, daySlots]) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { marginBottom: 18 }, children: [
|
|
4118
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { fontSize: 11, color: t.muted, marginBottom: 8, textTransform: "uppercase", letterSpacing: ".6px" }, children: formatDay(daySlots[0].startsAt) }),
|
|
4119
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: 8 }, children: daySlots.map((slot) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4120
|
+
"button",
|
|
4121
|
+
{
|
|
4122
|
+
onClick: () => {
|
|
4123
|
+
setSelected(slot);
|
|
4124
|
+
setStep("details");
|
|
4125
|
+
},
|
|
4126
|
+
style: {
|
|
4127
|
+
padding: "8px 14px",
|
|
4128
|
+
borderRadius: 999,
|
|
4129
|
+
border: `1px solid ${t.border}`,
|
|
4130
|
+
background: t.surface,
|
|
4131
|
+
color: t.text,
|
|
4132
|
+
fontSize: 13,
|
|
4133
|
+
cursor: "pointer"
|
|
4134
|
+
},
|
|
4135
|
+
children: formatTime(slot.startsAt)
|
|
4136
|
+
},
|
|
4137
|
+
slot.startsAt
|
|
4138
|
+
)) })
|
|
4139
|
+
] }, day))
|
|
4140
|
+
] }),
|
|
4141
|
+
step === "details" && selected && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: [
|
|
4142
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { fontSize: 13, color: t.muted }, children: [
|
|
4143
|
+
formatDay(selected.startsAt),
|
|
4144
|
+
" \xB7 ",
|
|
4145
|
+
formatTime(selected.startsAt),
|
|
4146
|
+
" \xB7 ",
|
|
4147
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4148
|
+
"button",
|
|
4149
|
+
{
|
|
4150
|
+
onClick: () => setStep("slots"),
|
|
4151
|
+
style: { border: 0, background: "transparent", color: t.accent, cursor: "pointer", fontSize: 13, padding: 0 },
|
|
4152
|
+
children: "change"
|
|
4153
|
+
}
|
|
4154
|
+
)
|
|
4155
|
+
] }),
|
|
4156
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Field, { label: "Your name", value: name, onChange: setName }),
|
|
4157
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Field, { label: "Email", value: email, onChange: setEmail, type: "email" }),
|
|
4158
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4159
|
+
Field,
|
|
4160
|
+
{
|
|
4161
|
+
label: "Mobile number",
|
|
4162
|
+
value: phone,
|
|
4163
|
+
onChange: setPhone,
|
|
4164
|
+
type: "tel",
|
|
4165
|
+
hint: "We send a code here to confirm, then a reminder before the call."
|
|
4166
|
+
}
|
|
4167
|
+
),
|
|
4168
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Field, { label: "Anything we should know? (optional)", value: note, onChange: setNote }),
|
|
4169
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4170
|
+
"button",
|
|
4171
|
+
{
|
|
4172
|
+
onClick: startBooking,
|
|
4173
|
+
disabled: !canSubmitDetails || busy,
|
|
4174
|
+
style: primaryStyle(!canSubmitDetails || busy),
|
|
4175
|
+
children: busy ? "Sending code\u2026" : "Send verification code"
|
|
4176
|
+
}
|
|
4177
|
+
)
|
|
4178
|
+
] }),
|
|
4179
|
+
step === "code" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: [
|
|
4180
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { fontSize: 13, color: t.muted, lineHeight: 1.5 }, children: "We sent a 4-digit code to your phone. Your slot is held for 10 minutes." }),
|
|
4181
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Field, { label: "Code", value: code, onChange: setCode }),
|
|
4182
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4183
|
+
"button",
|
|
4184
|
+
{
|
|
4185
|
+
onClick: confirmBooking,
|
|
4186
|
+
disabled: code.trim().length < 4 || busy,
|
|
4187
|
+
style: primaryStyle(code.trim().length < 4 || busy),
|
|
4188
|
+
children: busy ? "Confirming\u2026" : "Confirm booking"
|
|
4189
|
+
}
|
|
4190
|
+
)
|
|
4191
|
+
] }),
|
|
4192
|
+
step === "done" && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: [
|
|
4193
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { fontSize: 15, fontWeight: 600 }, children: "You're booked." }),
|
|
4194
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { fontSize: 13, color: t.muted, lineHeight: 1.6 }, children: [
|
|
4195
|
+
selected && `${formatDay(selected.startsAt)} at ${formatTime(selected.startsAt)}. `,
|
|
4196
|
+
"A calendar invite is on its way to ",
|
|
4197
|
+
email,
|
|
4198
|
+
", and we'll send a WhatsApp reminder before the call."
|
|
4199
|
+
] }),
|
|
4200
|
+
meetUrl && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("a", { href: meetUrl, target: "_blank", rel: "noreferrer", style: { ...primaryStyle(false), textAlign: "center", textDecoration: "none" }, children: "Open the meeting link" })
|
|
4201
|
+
] })
|
|
4202
|
+
] })
|
|
4203
|
+
]
|
|
4204
|
+
}
|
|
4205
|
+
)
|
|
4206
|
+
}
|
|
4207
|
+
);
|
|
4208
|
+
}
|
|
4209
|
+
function primaryStyle(disabled) {
|
|
4210
|
+
return {
|
|
4211
|
+
marginTop: 4,
|
|
4212
|
+
padding: "10px 16px",
|
|
4213
|
+
borderRadius: 999,
|
|
4214
|
+
border: 0,
|
|
4215
|
+
background: disabled ? "#2a2a2a" : t.accent,
|
|
4216
|
+
color: disabled ? "#6b7280" : "#fff",
|
|
4217
|
+
fontSize: 14,
|
|
4218
|
+
fontWeight: 500,
|
|
4219
|
+
cursor: disabled ? "default" : "pointer"
|
|
4220
|
+
};
|
|
4221
|
+
}
|
|
4222
|
+
function Field({
|
|
4223
|
+
label,
|
|
4224
|
+
value,
|
|
4225
|
+
onChange,
|
|
4226
|
+
type = "text",
|
|
4227
|
+
hint
|
|
4228
|
+
}) {
|
|
4229
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { style: { display: "block", fontSize: 11, color: t.muted }, children: [
|
|
4230
|
+
label,
|
|
4231
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
4232
|
+
"input",
|
|
4233
|
+
{
|
|
4234
|
+
type,
|
|
4235
|
+
value,
|
|
4236
|
+
onChange: (e) => onChange(e.target.value),
|
|
4237
|
+
style: {
|
|
4238
|
+
display: "block",
|
|
4239
|
+
width: "100%",
|
|
4240
|
+
boxSizing: "border-box",
|
|
4241
|
+
marginTop: 4,
|
|
4242
|
+
padding: "9px 12px",
|
|
4243
|
+
background: t.surface,
|
|
4244
|
+
color: t.text,
|
|
4245
|
+
border: `1px solid ${t.border}`,
|
|
4246
|
+
borderRadius: 8,
|
|
4247
|
+
fontSize: 13,
|
|
4248
|
+
outline: "none"
|
|
4249
|
+
}
|
|
4250
|
+
}
|
|
4251
|
+
),
|
|
4252
|
+
hint && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { marginTop: 4, fontSize: 10, color: t.muted }, children: hint })
|
|
4253
|
+
] });
|
|
4254
|
+
}
|
|
4255
|
+
|
|
3861
4256
|
// src/rejection.ts
|
|
3862
4257
|
var DETAILS_MAX_LENGTH = 1e3;
|
|
3863
4258
|
var MESSAGE_MAX_LENGTH = 200;
|
|
@@ -3913,6 +4308,36 @@ function describeShape(reason) {
|
|
|
3913
4308
|
return "";
|
|
3914
4309
|
}
|
|
3915
4310
|
}
|
|
4311
|
+
var EVENT_URL_MAX_LENGTH = 120;
|
|
4312
|
+
function isEventLike(reason) {
|
|
4313
|
+
try {
|
|
4314
|
+
if (typeof Event !== "undefined" && reason instanceof Event) return true;
|
|
4315
|
+
const source = reason;
|
|
4316
|
+
return typeof (source == null ? void 0 : source.type) === "string" && typeof (source == null ? void 0 : source.isTrusted) === "boolean";
|
|
4317
|
+
} catch (e) {
|
|
4318
|
+
return false;
|
|
4319
|
+
}
|
|
4320
|
+
}
|
|
4321
|
+
function describeEvent(reason) {
|
|
4322
|
+
var _a, _b, _c, _d, _e;
|
|
4323
|
+
const parts = [];
|
|
4324
|
+
try {
|
|
4325
|
+
const source = reason;
|
|
4326
|
+
const name = ((_a = source.constructor) == null ? void 0 : _a.name) || "Event";
|
|
4327
|
+
parts.push(`${name} ("${String((_b = source.type) != null ? _b : "")}")`);
|
|
4328
|
+
} catch (e) {
|
|
4329
|
+
parts.push("Event");
|
|
4330
|
+
}
|
|
4331
|
+
try {
|
|
4332
|
+
const target = reason.target;
|
|
4333
|
+
const tag = (_c = target == null ? void 0 : target.tagName) == null ? void 0 : _c.toLowerCase();
|
|
4334
|
+
if (tag) parts.push(`from <${tag}>`);
|
|
4335
|
+
const url = (_e = (_d = readString(target == null ? void 0 : target.currentSrc)) != null ? _d : readString(target == null ? void 0 : target.src)) != null ? _e : readString(target == null ? void 0 : target.href);
|
|
4336
|
+
if (url) parts.push(`\u2014 ${url.split(/[?#]/)[0].slice(0, EVENT_URL_MAX_LENGTH)}`);
|
|
4337
|
+
} catch (e) {
|
|
4338
|
+
}
|
|
4339
|
+
return parts.join(" ").slice(0, MESSAGE_MAX_LENGTH);
|
|
4340
|
+
}
|
|
3916
4341
|
function describeRejection(reason) {
|
|
3917
4342
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3918
4343
|
try {
|
|
@@ -3937,7 +4362,7 @@ function describeRejection(reason) {
|
|
|
3937
4362
|
const message = (_h = (_g = (_f = (_e = (_d = (_c = (_b = readString(source.message)) != null ? _b : readString(nestedError)) != null ? _c : readString(nestedError == null ? void 0 : nestedError.message)) != null ? _d : readScalar(source.code)) != null ? _e : readString(source.name)) != null ? _f : readScalar(source.status)) != null ? _g : readString(source.statusText)) != null ? _h : "";
|
|
3938
4363
|
const details = serialize(reason);
|
|
3939
4364
|
return {
|
|
3940
|
-
message: message || describeShape(reason),
|
|
4365
|
+
message: message || (isEventLike(reason) ? describeEvent(reason) : describeShape(reason)),
|
|
3941
4366
|
stack,
|
|
3942
4367
|
details
|
|
3943
4368
|
};
|
|
@@ -3965,11 +4390,11 @@ function matchesShortcut(e) {
|
|
|
3965
4390
|
}
|
|
3966
4391
|
|
|
3967
4392
|
// src/provider.tsx
|
|
3968
|
-
var
|
|
4393
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
3969
4394
|
var DEFAULT_BASE_URL2 = "https://glitchgrab.dev";
|
|
3970
|
-
var GlitchgrabContext = (0,
|
|
4395
|
+
var GlitchgrabContext = (0, import_react4.createContext)(null);
|
|
3971
4396
|
function useGlitchgrab() {
|
|
3972
|
-
const ctx = (0,
|
|
4397
|
+
const ctx = (0, import_react4.useContext)(GlitchgrabContext);
|
|
3973
4398
|
if (!ctx) {
|
|
3974
4399
|
throw new Error("useGlitchgrab must be used within a GlitchgrabProvider");
|
|
3975
4400
|
}
|
|
@@ -3992,7 +4417,7 @@ function GlitchgrabProviderInner({
|
|
|
3992
4417
|
context: appContext2,
|
|
3993
4418
|
responseBodyOrigins: responseBodyOrigins2
|
|
3994
4419
|
}) {
|
|
3995
|
-
const visitedPagesRef = (0,
|
|
4420
|
+
const visitedPagesRef = (0, import_react4.useRef)([]);
|
|
3996
4421
|
setRelease(release2);
|
|
3997
4422
|
if (appContext2) setContexts(appContext2);
|
|
3998
4423
|
registerCaptureConfig({
|
|
@@ -4004,12 +4429,12 @@ function GlitchgrabProviderInner({
|
|
|
4004
4429
|
onError,
|
|
4005
4430
|
onReportSent
|
|
4006
4431
|
});
|
|
4007
|
-
(0,
|
|
4432
|
+
(0, import_react4.useEffect)(() => {
|
|
4008
4433
|
if (enableBreadcrumbs) {
|
|
4009
4434
|
initBreadcrumbs(maxBreadcrumbs2, { responseBodyOrigins: responseBodyOrigins2 });
|
|
4010
4435
|
}
|
|
4011
4436
|
}, [enableBreadcrumbs, maxBreadcrumbs2, responseBodyOrigins2 == null ? void 0 : responseBodyOrigins2.join(",")]);
|
|
4012
|
-
(0,
|
|
4437
|
+
(0, import_react4.useEffect)(() => {
|
|
4013
4438
|
try {
|
|
4014
4439
|
if (typeof window === "undefined") return;
|
|
4015
4440
|
const trackPage = () => {
|
|
@@ -4046,7 +4471,7 @@ function GlitchgrabProviderInner({
|
|
|
4046
4471
|
} catch (e) {
|
|
4047
4472
|
}
|
|
4048
4473
|
}, []);
|
|
4049
|
-
(0,
|
|
4474
|
+
(0, import_react4.useEffect)(() => {
|
|
4050
4475
|
try {
|
|
4051
4476
|
if (typeof window === "undefined") return;
|
|
4052
4477
|
if (process.env.NODE_ENV === "development") return;
|
|
@@ -4173,7 +4598,7 @@ function GlitchgrabProviderInner({
|
|
|
4173
4598
|
} catch (e) {
|
|
4174
4599
|
}
|
|
4175
4600
|
}, [token, baseUrl, onError, onReportSent, session, ignoreErrors]);
|
|
4176
|
-
const report = (0,
|
|
4601
|
+
const report = (0, import_react4.useCallback)(
|
|
4177
4602
|
async (type, description, metadata) => {
|
|
4178
4603
|
var _a;
|
|
4179
4604
|
try {
|
|
@@ -4207,11 +4632,11 @@ function GlitchgrabProviderInner({
|
|
|
4207
4632
|
},
|
|
4208
4633
|
[token, baseUrl, onReportSent, session]
|
|
4209
4634
|
);
|
|
4210
|
-
const reportBug = (0,
|
|
4635
|
+
const reportBug = (0, import_react4.useCallback)(
|
|
4211
4636
|
(description, metadata) => report("BUG", description, metadata),
|
|
4212
4637
|
[report]
|
|
4213
4638
|
);
|
|
4214
|
-
const feedback = (0,
|
|
4639
|
+
const feedback = (0, import_react4.useCallback)(
|
|
4215
4640
|
async (rating, message, metadata) => {
|
|
4216
4641
|
try {
|
|
4217
4642
|
const context = captureContext(visitedPagesRef.current);
|
|
@@ -4239,32 +4664,32 @@ function GlitchgrabProviderInner({
|
|
|
4239
4664
|
},
|
|
4240
4665
|
[token, baseUrl, session]
|
|
4241
4666
|
);
|
|
4242
|
-
const openFeedbackDialog = (0,
|
|
4667
|
+
const openFeedbackDialog = (0, import_react4.useCallback)(() => {
|
|
4243
4668
|
if (typeof window !== "undefined") {
|
|
4244
4669
|
window.dispatchEvent(
|
|
4245
4670
|
new CustomEvent("glitchgrab:open-report", { detail: { type: "RATING" } })
|
|
4246
4671
|
);
|
|
4247
4672
|
}
|
|
4248
4673
|
}, []);
|
|
4249
|
-
const captureError2 = (0,
|
|
4674
|
+
const captureError2 = (0, import_react4.useCallback)(
|
|
4250
4675
|
(error, options) => {
|
|
4251
4676
|
captureError(error, options);
|
|
4252
4677
|
},
|
|
4253
4678
|
[]
|
|
4254
4679
|
);
|
|
4255
|
-
const setContext2 = (0,
|
|
4680
|
+
const setContext2 = (0, import_react4.useCallback)((key, value) => {
|
|
4256
4681
|
setContext(key, value);
|
|
4257
4682
|
}, []);
|
|
4258
|
-
const setContexts2 = (0,
|
|
4683
|
+
const setContexts2 = (0, import_react4.useCallback)((values) => {
|
|
4259
4684
|
setContexts(values);
|
|
4260
4685
|
}, []);
|
|
4261
|
-
const addBreadcrumb2 = (0,
|
|
4686
|
+
const addBreadcrumb2 = (0, import_react4.useCallback)(
|
|
4262
4687
|
(message, data) => {
|
|
4263
4688
|
addBreadcrumb("custom", message, data);
|
|
4264
4689
|
},
|
|
4265
4690
|
[]
|
|
4266
4691
|
);
|
|
4267
|
-
const enhance = (0,
|
|
4692
|
+
const enhance = (0, import_react4.useCallback)(
|
|
4268
4693
|
async (text, screenshot) => {
|
|
4269
4694
|
try {
|
|
4270
4695
|
const ctx = captureContext(visitedPagesRef.current);
|
|
@@ -4280,7 +4705,7 @@ function GlitchgrabProviderInner({
|
|
|
4280
4705
|
},
|
|
4281
4706
|
[token, baseUrl]
|
|
4282
4707
|
);
|
|
4283
|
-
const transcribe = (0,
|
|
4708
|
+
const transcribe = (0, import_react4.useCallback)(
|
|
4284
4709
|
async (blob) => {
|
|
4285
4710
|
try {
|
|
4286
4711
|
return await transcribeAudio(blob, token, baseUrl);
|
|
@@ -4290,12 +4715,12 @@ function GlitchgrabProviderInner({
|
|
|
4290
4715
|
},
|
|
4291
4716
|
[token, baseUrl]
|
|
4292
4717
|
);
|
|
4293
|
-
const openReportDialog = (0,
|
|
4718
|
+
const openReportDialog = (0, import_react4.useCallback)((options) => {
|
|
4294
4719
|
if (typeof window !== "undefined") {
|
|
4295
4720
|
window.dispatchEvent(new CustomEvent("glitchgrab:open-report", { detail: options }));
|
|
4296
4721
|
}
|
|
4297
4722
|
}, []);
|
|
4298
|
-
(0,
|
|
4723
|
+
(0, import_react4.useEffect)(() => {
|
|
4299
4724
|
try {
|
|
4300
4725
|
if (typeof document === "undefined") return;
|
|
4301
4726
|
document.documentElement.setAttribute("data-glitchgrab-sdk", "1");
|
|
@@ -4303,8 +4728,10 @@ function GlitchgrabProviderInner({
|
|
|
4303
4728
|
} catch (e) {
|
|
4304
4729
|
}
|
|
4305
4730
|
}, []);
|
|
4306
|
-
const [projectName, setProjectName] = (0,
|
|
4307
|
-
(0,
|
|
4731
|
+
const [projectName, setProjectName] = (0, import_react4.useState)(null);
|
|
4732
|
+
const [bookingOpen, setBookingOpen] = (0, import_react4.useState)(false);
|
|
4733
|
+
const openBookingDialog = (0, import_react4.useCallback)(() => setBookingOpen(true), []);
|
|
4734
|
+
(0, import_react4.useEffect)(() => {
|
|
4308
4735
|
let cancelled = false;
|
|
4309
4736
|
fetch(`${baseUrl}/api/v1/sdk/project`, {
|
|
4310
4737
|
headers: { Authorization: `Bearer ${token}` }
|
|
@@ -4318,7 +4745,7 @@ function GlitchgrabProviderInner({
|
|
|
4318
4745
|
cancelled = true;
|
|
4319
4746
|
};
|
|
4320
4747
|
}, [baseUrl, token]);
|
|
4321
|
-
(0,
|
|
4748
|
+
(0, import_react4.useEffect)(() => {
|
|
4322
4749
|
try {
|
|
4323
4750
|
if (typeof window === "undefined") return;
|
|
4324
4751
|
const handleKeyDown = (e) => {
|
|
@@ -4332,7 +4759,7 @@ function GlitchgrabProviderInner({
|
|
|
4332
4759
|
} catch (e) {
|
|
4333
4760
|
}
|
|
4334
4761
|
}, [openReportDialog]);
|
|
4335
|
-
const reporter = (0,
|
|
4762
|
+
const reporter = (0, import_react4.useMemo)(() => {
|
|
4336
4763
|
var _a;
|
|
4337
4764
|
if (!session) return null;
|
|
4338
4765
|
const avatar = (_a = session.avatarUrl) != null ? _a : session.image;
|
|
@@ -4342,11 +4769,11 @@ function GlitchgrabProviderInner({
|
|
|
4342
4769
|
avatarUrl: typeof avatar === "string" ? avatar : null
|
|
4343
4770
|
};
|
|
4344
4771
|
}, [session]);
|
|
4345
|
-
const [shortcutLabel, setShortcutLabel] = (0,
|
|
4346
|
-
(0,
|
|
4772
|
+
const [shortcutLabel, setShortcutLabel] = (0, import_react4.useState)(GLITCHGRAB_SHORTCUT2);
|
|
4773
|
+
(0, import_react4.useEffect)(() => {
|
|
4347
4774
|
setShortcutLabel(getShortcutLabel2());
|
|
4348
4775
|
}, []);
|
|
4349
|
-
return /* @__PURE__ */ (0,
|
|
4776
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
4350
4777
|
GlitchgrabContext.Provider,
|
|
4351
4778
|
{
|
|
4352
4779
|
value: {
|
|
@@ -4361,11 +4788,12 @@ function GlitchgrabProviderInner({
|
|
|
4361
4788
|
openFeedbackDialog,
|
|
4362
4789
|
addBreadcrumb: addBreadcrumb2,
|
|
4363
4790
|
openReportDialog,
|
|
4791
|
+
openBookingDialog,
|
|
4364
4792
|
enhanceText: enhance,
|
|
4365
4793
|
shortcutLabel
|
|
4366
4794
|
},
|
|
4367
4795
|
children: [
|
|
4368
|
-
/* @__PURE__ */ (0,
|
|
4796
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4369
4797
|
GlitchgrabErrorBoundary,
|
|
4370
4798
|
{
|
|
4371
4799
|
token,
|
|
@@ -4377,7 +4805,16 @@ function GlitchgrabProviderInner({
|
|
|
4377
4805
|
children
|
|
4378
4806
|
}
|
|
4379
4807
|
),
|
|
4380
|
-
/* @__PURE__ */ (0,
|
|
4808
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4809
|
+
BookingDialog,
|
|
4810
|
+
{
|
|
4811
|
+
token,
|
|
4812
|
+
baseUrl: baseUrl != null ? baseUrl : DEFAULT_BASE_URL2,
|
|
4813
|
+
open: bookingOpen,
|
|
4814
|
+
onClose: () => setBookingOpen(false)
|
|
4815
|
+
}
|
|
4816
|
+
),
|
|
4817
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
4381
4818
|
ReportDialog,
|
|
4382
4819
|
{
|
|
4383
4820
|
report,
|
|
@@ -4387,9 +4824,9 @@ function GlitchgrabProviderInner({
|
|
|
4387
4824
|
types,
|
|
4388
4825
|
showSeverity,
|
|
4389
4826
|
reporter,
|
|
4390
|
-
headerSlot: projectName ? /* @__PURE__ */ (0,
|
|
4827
|
+
headerSlot: projectName ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { fontSize: 11, color: "#9aa0a6" }, children: [
|
|
4391
4828
|
"Reporting to ",
|
|
4392
|
-
/* @__PURE__ */ (0,
|
|
4829
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { style: { color: "#e5e5e5" }, children: projectName })
|
|
4393
4830
|
] }) : null
|
|
4394
4831
|
}
|
|
4395
4832
|
)
|
|
@@ -4398,21 +4835,21 @@ function GlitchgrabProviderInner({
|
|
|
4398
4835
|
);
|
|
4399
4836
|
}
|
|
4400
4837
|
function GlitchgrabProvider(props) {
|
|
4401
|
-
if (!props.token) return /* @__PURE__ */ (0,
|
|
4838
|
+
if (!props.token) return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: props.children });
|
|
4402
4839
|
const resolvedProps = {
|
|
4403
4840
|
...props,
|
|
4404
4841
|
baseUrl: props.baseUrl || DEFAULT_BASE_URL2
|
|
4405
4842
|
};
|
|
4406
4843
|
try {
|
|
4407
|
-
return /* @__PURE__ */ (0,
|
|
4844
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(GlitchgrabProviderInner, { ...resolvedProps });
|
|
4408
4845
|
} catch (e) {
|
|
4409
|
-
return /* @__PURE__ */ (0,
|
|
4846
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: props.children });
|
|
4410
4847
|
}
|
|
4411
4848
|
}
|
|
4412
4849
|
|
|
4413
4850
|
// src/report-button.tsx
|
|
4414
|
-
var
|
|
4415
|
-
var
|
|
4851
|
+
var import_react5 = require("react");
|
|
4852
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
4416
4853
|
function useGlitchgrabSafe() {
|
|
4417
4854
|
try {
|
|
4418
4855
|
return useGlitchgrab();
|
|
@@ -4427,7 +4864,7 @@ function ReportButton({
|
|
|
4427
4864
|
children
|
|
4428
4865
|
}) {
|
|
4429
4866
|
var _a, _b;
|
|
4430
|
-
const [capturing, setCapturing] = (0,
|
|
4867
|
+
const [capturing, setCapturing] = (0, import_react5.useState)(false);
|
|
4431
4868
|
const glitchgrab = useGlitchgrabSafe();
|
|
4432
4869
|
if (!glitchgrab) return null;
|
|
4433
4870
|
const handleClick = async () => {
|
|
@@ -4436,7 +4873,7 @@ function ReportButton({
|
|
|
4436
4873
|
setCapturing(false);
|
|
4437
4874
|
};
|
|
4438
4875
|
if (children) {
|
|
4439
|
-
return /* @__PURE__ */ (0,
|
|
4876
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: children({ onClick: handleClick, capturing }) });
|
|
4440
4877
|
}
|
|
4441
4878
|
const isTop = (_a = position == null ? void 0 : position.startsWith("top")) != null ? _a : false;
|
|
4442
4879
|
const isLeft = (_b = position == null ? void 0 : position.endsWith("left")) != null ? _b : false;
|
|
@@ -4444,7 +4881,7 @@ function ReportButton({
|
|
|
4444
4881
|
...isLeft ? { left: "16px" } : { right: "16px" },
|
|
4445
4882
|
...isTop ? { top: "16px" } : { bottom: "16px" }
|
|
4446
4883
|
};
|
|
4447
|
-
return /* @__PURE__ */ (0,
|
|
4884
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
4448
4885
|
"button",
|
|
4449
4886
|
{
|
|
4450
4887
|
type: "button",
|
|
@@ -4479,7 +4916,7 @@ function ReportButton({
|
|
|
4479
4916
|
},
|
|
4480
4917
|
"aria-label": label,
|
|
4481
4918
|
children: [
|
|
4482
|
-
/* @__PURE__ */ (0,
|
|
4919
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4483
4920
|
"svg",
|
|
4484
4921
|
{
|
|
4485
4922
|
width: "16",
|
|
@@ -4487,7 +4924,7 @@ function ReportButton({
|
|
|
4487
4924
|
viewBox: "0 0 16 16",
|
|
4488
4925
|
fill: "none",
|
|
4489
4926
|
style: { flexShrink: 0 },
|
|
4490
|
-
children: /* @__PURE__ */ (0,
|
|
4927
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
4491
4928
|
"path",
|
|
4492
4929
|
{
|
|
4493
4930
|
d: "M8 1C4.134 1 1 4.134 1 8s3.134 7 7 7 7-3.134 7-7-3.134-7-7-7zm0 12.5a.75.75 0 110-1.5.75.75 0 010 1.5zm.75-3.5a.75.75 0 01-1.5 0V5a.75.75 0 011.5 0v5z",
|
|
@@ -4502,8 +4939,38 @@ function ReportButton({
|
|
|
4502
4939
|
);
|
|
4503
4940
|
}
|
|
4504
4941
|
|
|
4942
|
+
// src/book-demo-button.tsx
|
|
4943
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
4944
|
+
function BookDemoButton({
|
|
4945
|
+
label = "Book a demo",
|
|
4946
|
+
className,
|
|
4947
|
+
children
|
|
4948
|
+
}) {
|
|
4949
|
+
const { openBookingDialog } = useGlitchgrab();
|
|
4950
|
+
if (children) return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: children({ onClick: openBookingDialog }) });
|
|
4951
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
4952
|
+
"button",
|
|
4953
|
+
{
|
|
4954
|
+
type: "button",
|
|
4955
|
+
onClick: openBookingDialog,
|
|
4956
|
+
className,
|
|
4957
|
+
style: className ? void 0 : {
|
|
4958
|
+
padding: "10px 18px",
|
|
4959
|
+
borderRadius: 999,
|
|
4960
|
+
border: 0,
|
|
4961
|
+
background: "#3b82f6",
|
|
4962
|
+
color: "#fff",
|
|
4963
|
+
fontSize: 14,
|
|
4964
|
+
fontWeight: 500,
|
|
4965
|
+
cursor: "pointer"
|
|
4966
|
+
},
|
|
4967
|
+
children: label
|
|
4968
|
+
}
|
|
4969
|
+
);
|
|
4970
|
+
}
|
|
4971
|
+
|
|
4505
4972
|
// src/feedback-button.tsx
|
|
4506
|
-
var
|
|
4973
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
4507
4974
|
function useGlitchgrabSafe2() {
|
|
4508
4975
|
try {
|
|
4509
4976
|
return useGlitchgrab();
|
|
@@ -4522,7 +4989,7 @@ function FeedbackButton({
|
|
|
4522
4989
|
if (!glitchgrab) return null;
|
|
4523
4990
|
const handleClick = () => glitchgrab.openFeedbackDialog();
|
|
4524
4991
|
if (children) {
|
|
4525
|
-
return /* @__PURE__ */ (0,
|
|
4992
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: children({ onClick: handleClick }) });
|
|
4526
4993
|
}
|
|
4527
4994
|
const isTop = (_a = position == null ? void 0 : position.startsWith("top")) != null ? _a : false;
|
|
4528
4995
|
const isLeft = (_b = position == null ? void 0 : position.endsWith("left")) != null ? _b : false;
|
|
@@ -4530,7 +4997,7 @@ function FeedbackButton({
|
|
|
4530
4997
|
...isLeft ? { left: "16px" } : { right: "16px" },
|
|
4531
4998
|
...isTop ? { top: "16px" } : { bottom: "16px" }
|
|
4532
4999
|
};
|
|
4533
|
-
return /* @__PURE__ */ (0,
|
|
5000
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
4534
5001
|
"button",
|
|
4535
5002
|
{
|
|
4536
5003
|
type: "button",
|
|
@@ -4563,7 +5030,7 @@ function FeedbackButton({
|
|
|
4563
5030
|
},
|
|
4564
5031
|
"aria-label": label,
|
|
4565
5032
|
children: [
|
|
4566
|
-
/* @__PURE__ */ (0,
|
|
5033
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
4567
5034
|
"svg",
|
|
4568
5035
|
{
|
|
4569
5036
|
width: "16",
|
|
@@ -4572,7 +5039,7 @@ function FeedbackButton({
|
|
|
4572
5039
|
fill: "none",
|
|
4573
5040
|
style: { flexShrink: 0 },
|
|
4574
5041
|
"aria-hidden": "true",
|
|
4575
|
-
children: /* @__PURE__ */ (0,
|
|
5042
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
4576
5043
|
"path",
|
|
4577
5044
|
{
|
|
4578
5045
|
d: "M12 2.5l2.9 5.9 6.5.9-4.7 4.6 1.1 6.5L12 17.4l-5.8 3 1.1-6.5L2.6 9.3l6.5-.9L12 2.5z",
|
|
@@ -4588,18 +5055,18 @@ function FeedbackButton({
|
|
|
4588
5055
|
}
|
|
4589
5056
|
|
|
4590
5057
|
// src/use-reports.ts
|
|
4591
|
-
var
|
|
5058
|
+
var import_react6 = require("react");
|
|
4592
5059
|
var BASE_URL = "https://glitchgrab.dev";
|
|
4593
5060
|
function useGlitchgrabReports({
|
|
4594
5061
|
token,
|
|
4595
5062
|
userId,
|
|
4596
5063
|
limit = 100
|
|
4597
5064
|
}) {
|
|
4598
|
-
const [reports, setReports] = (0,
|
|
4599
|
-
const [isLoading, setIsLoading] = (0,
|
|
4600
|
-
const [isFetching, setIsFetching] = (0,
|
|
4601
|
-
const [error, setError] = (0,
|
|
4602
|
-
const fetchReports = (0,
|
|
5065
|
+
const [reports, setReports] = (0, import_react6.useState)([]);
|
|
5066
|
+
const [isLoading, setIsLoading] = (0, import_react6.useState)(true);
|
|
5067
|
+
const [isFetching, setIsFetching] = (0, import_react6.useState)(false);
|
|
5068
|
+
const [error, setError] = (0, import_react6.useState)(null);
|
|
5069
|
+
const fetchReports = (0, import_react6.useCallback)(async () => {
|
|
4603
5070
|
var _a, _b;
|
|
4604
5071
|
if (!token || !userId) {
|
|
4605
5072
|
setIsLoading(false);
|
|
@@ -4625,7 +5092,7 @@ function useGlitchgrabReports({
|
|
|
4625
5092
|
setIsFetching(false);
|
|
4626
5093
|
}
|
|
4627
5094
|
}, [token, userId, limit]);
|
|
4628
|
-
(0,
|
|
5095
|
+
(0, import_react6.useEffect)(() => {
|
|
4629
5096
|
fetchReports();
|
|
4630
5097
|
}, [fetchReports]);
|
|
4631
5098
|
return { reports, isLoading, isFetching, error, refetch: fetchReports };
|
|
@@ -4662,9 +5129,9 @@ function useGlitchgrabActions({
|
|
|
4662
5129
|
onSuccess,
|
|
4663
5130
|
onError
|
|
4664
5131
|
}) {
|
|
4665
|
-
const [isPending, setIsPending] = (0,
|
|
4666
|
-
const [error, setError] = (0,
|
|
4667
|
-
const run = (0,
|
|
5132
|
+
const [isPending, setIsPending] = (0, import_react6.useState)(false);
|
|
5133
|
+
const [error, setError] = (0, import_react6.useState)(null);
|
|
5134
|
+
const run = (0, import_react6.useCallback)(
|
|
4668
5135
|
async (reportId, body) => {
|
|
4669
5136
|
setIsPending(true);
|
|
4670
5137
|
setError(null);
|
|
@@ -4694,7 +5161,7 @@ function useGlitchgrabActions({
|
|
|
4694
5161
|
}
|
|
4695
5162
|
|
|
4696
5163
|
// src/use-feedback.ts
|
|
4697
|
-
var
|
|
5164
|
+
var import_react7 = require("react");
|
|
4698
5165
|
var DEFAULT_BASE_URL3 = "https://glitchgrab.dev";
|
|
4699
5166
|
function buildUrl({
|
|
4700
5167
|
approvedOnly,
|
|
@@ -4720,11 +5187,11 @@ async function fetchGlitchgrabFeedback(query) {
|
|
|
4720
5187
|
}
|
|
4721
5188
|
function useGlitchgrabFeedback(query) {
|
|
4722
5189
|
const { token, approvedOnly, userId, minRating, limit, baseUrl } = query;
|
|
4723
|
-
const [feedback, setFeedback] = (0,
|
|
4724
|
-
const [isLoading, setIsLoading] = (0,
|
|
4725
|
-
const [isFetching, setIsFetching] = (0,
|
|
4726
|
-
const [error, setError] = (0,
|
|
4727
|
-
const load = (0,
|
|
5190
|
+
const [feedback, setFeedback] = (0, import_react7.useState)([]);
|
|
5191
|
+
const [isLoading, setIsLoading] = (0, import_react7.useState)(true);
|
|
5192
|
+
const [isFetching, setIsFetching] = (0, import_react7.useState)(false);
|
|
5193
|
+
const [error, setError] = (0, import_react7.useState)(null);
|
|
5194
|
+
const load = (0, import_react7.useCallback)(async () => {
|
|
4728
5195
|
if (!token) {
|
|
4729
5196
|
setIsLoading(false);
|
|
4730
5197
|
return;
|
|
@@ -4748,13 +5215,14 @@ function useGlitchgrabFeedback(query) {
|
|
|
4748
5215
|
setIsFetching(false);
|
|
4749
5216
|
}
|
|
4750
5217
|
}, [token, approvedOnly, userId, minRating, limit, baseUrl]);
|
|
4751
|
-
(0,
|
|
5218
|
+
(0, import_react7.useEffect)(() => {
|
|
4752
5219
|
load();
|
|
4753
5220
|
}, [load]);
|
|
4754
5221
|
return { feedback, isLoading, isFetching, error, refetch: load };
|
|
4755
5222
|
}
|
|
4756
5223
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4757
5224
|
0 && (module.exports = {
|
|
5225
|
+
BookDemoButton,
|
|
4758
5226
|
FeedbackButton,
|
|
4759
5227
|
GLITCHGRAB_SHORTCUT,
|
|
4760
5228
|
GLITCHGRAB_SHORTCUT_MAC,
|