glitchgrab 1.59.0 → 1.60.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/README.md CHANGED
@@ -1037,6 +1037,25 @@ interface CallsOptions {
1037
1037
  }
1038
1038
  ```
1039
1039
 
1040
+ ## How do I do something once a visitor books a demo?
1041
+
1042
+ Open the dialog yourself and pass `onBooked`. `intro` puts one line of your own
1043
+ above the dialog's title, so the visitor knows why you are asking.
1044
+
1045
+ ```tsx
1046
+ const { openBookingDialog } = useGlitchgrab();
1047
+
1048
+ openBookingDialog({
1049
+ intro: "Book a short call — the live demo opens the moment you're booked.",
1050
+ onBooked: ({ bookingId }) => {
1051
+ // Runs once, after the phone code when one is asked. The details come from
1052
+ // the browser: look `bookingId` up with listBookings() on your server
1053
+ // before you trust it.
1054
+ startDemo(bookingId);
1055
+ },
1056
+ });
1057
+ ```
1058
+
1040
1059
  ## How do I change demo booking settings from my admin panel?
1041
1060
 
1042
1061
  The same server key reads and writes the project's demo booking settings —
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { f as GlitchgrabProviderProps, U as UseGlitchgrabReturn, R as ReportButtonProps, F as FeedbackButtonProps, g as GlitchgrabSession, C as CaptureErrorOptions, e as GlitchgrabFeedback, a as BreadcrumbType, B as Breadcrumb, b as CapturedContext, D as DeviceInfo, c as FeedbackPayload, d as FeedbackResult, L as LeadInput, h as LeadResult, i as ReportPayload, j as ReportResult } from './types-BpTLWJ1y.mjs';
3
- export { G as GlitchgrabConfig, k as ReportSeverity, l as ReportType, m as RuntimeInfo } from './types-BpTLWJ1y.mjs';
2
+ import { h as GlitchgrabProviderProps, U as UseGlitchgrabReturn, R as ReportButtonProps, B as BookedDemo, F as FeedbackButtonProps, i as GlitchgrabSession, C as CaptureErrorOptions, g as GlitchgrabFeedback, c as BreadcrumbType, b as Breadcrumb, d as CapturedContext, D as DeviceInfo, e as FeedbackPayload, f as FeedbackResult, L as LeadInput, j as LeadResult, k as ReportPayload, l as ReportResult } from './types-BlMF6wzX.mjs';
3
+ export { a as BookingDialogOptions, G as GlitchgrabConfig, m as ReportSeverity, n as ReportType, o as RuntimeInfo } from './types-BlMF6wzX.mjs';
4
4
  import * as React from 'react';
5
5
  import { ReactNode } from 'react';
6
6
 
@@ -81,7 +81,7 @@ declare function BookDemoButton({ label, className, children, }: {
81
81
  }) => ReactNode;
82
82
  }): react_jsx_runtime.JSX.Element;
83
83
 
84
- declare function BookingDialog({ token, baseUrl, open, onClose, preview, availabilityUrl, }: {
84
+ declare function BookingDialog({ token, baseUrl, open, onClose, preview, availabilityUrl, intro, onBooked, }: {
85
85
  token: string;
86
86
  baseUrl: string;
87
87
  open: boolean;
@@ -97,6 +97,10 @@ declare function BookingDialog({ token, baseUrl, open, onClose, preview, availab
97
97
  * holds no `gg_` token for the project. Same response shape.
98
98
  */
99
99
  availabilityUrl?: string;
100
+ /** The host's one line above the title — see `BookingDialogOptions.intro`. */
101
+ intro?: string;
102
+ /** Fired once when a booking is confirmed — see `BookingDialogOptions.onBooked`. */
103
+ onBooked?: (booking: BookedDemo) => void;
100
104
  }): react_jsx_runtime.JSX.Element | null;
101
105
 
102
106
  /**
@@ -498,4 +502,4 @@ declare function computeSignature(params: {
498
502
  declare function shouldSkipDuplicate(signature: string, windowMs?: number, now?: number): boolean;
499
503
  declare function clearDedupCache(): void;
500
504
 
501
- export { BookDemoButton, BookingDialog, Breadcrumb, BreadcrumbType, CaptureErrorOptions, CapturedContext, DeviceInfo, FeedbackButton, FeedbackButtonProps, FeedbackPayload, type FeedbackQuery, FeedbackResult, GLITCHGRAB_SHORTCUT, GLITCHGRAB_SHORTCUT_MAC, type GlitchgrabComment, GlitchgrabErrorBoundary, GlitchgrabFeedback, GlitchgrabProvider, GlitchgrabProviderProps, type GlitchgrabReport, type GlitchgrabReportThread, GlitchgrabSession, LeadInput, LeadResult, ReportButton, ReportButtonProps, ReportPayload, ReportResult, UseGlitchgrabReturn, addBreadcrumb, captureContext, captureDeviceInfo, captureError, clearAppContext, clearBreadcrumbs, clearDedupCache, computeSignature, enhanceText, fetchGlitchgrabFeedback, fetchGlitchgrabReportThread, fetchGlitchgrabReports, getAppContext, getBreadcrumbs, getShortcutLabel, initBreadcrumbs, matchesShortcut, postGlitchgrabReportComment, sanitizeUrl, sendFeedback, sendLead, sendReport, setContext, setContexts, shouldSkipDuplicate, useGlitchgrab, useGlitchgrabActions, useGlitchgrabFeedback, useGlitchgrabReportThread, useGlitchgrabReports };
505
+ export { BookDemoButton, BookedDemo, BookingDialog, Breadcrumb, BreadcrumbType, CaptureErrorOptions, CapturedContext, DeviceInfo, FeedbackButton, FeedbackButtonProps, FeedbackPayload, type FeedbackQuery, FeedbackResult, GLITCHGRAB_SHORTCUT, GLITCHGRAB_SHORTCUT_MAC, type GlitchgrabComment, GlitchgrabErrorBoundary, GlitchgrabFeedback, GlitchgrabProvider, GlitchgrabProviderProps, type GlitchgrabReport, type GlitchgrabReportThread, GlitchgrabSession, LeadInput, LeadResult, ReportButton, ReportButtonProps, ReportPayload, ReportResult, UseGlitchgrabReturn, addBreadcrumb, captureContext, captureDeviceInfo, captureError, clearAppContext, clearBreadcrumbs, clearDedupCache, computeSignature, enhanceText, fetchGlitchgrabFeedback, fetchGlitchgrabReportThread, fetchGlitchgrabReports, getAppContext, getBreadcrumbs, getShortcutLabel, initBreadcrumbs, matchesShortcut, postGlitchgrabReportComment, sanitizeUrl, sendFeedback, sendLead, sendReport, setContext, setContexts, shouldSkipDuplicate, useGlitchgrab, useGlitchgrabActions, useGlitchgrabFeedback, useGlitchgrabReportThread, useGlitchgrabReports };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { f as GlitchgrabProviderProps, U as UseGlitchgrabReturn, R as ReportButtonProps, F as FeedbackButtonProps, g as GlitchgrabSession, C as CaptureErrorOptions, e as GlitchgrabFeedback, a as BreadcrumbType, B as Breadcrumb, b as CapturedContext, D as DeviceInfo, c as FeedbackPayload, d as FeedbackResult, L as LeadInput, h as LeadResult, i as ReportPayload, j as ReportResult } from './types-BpTLWJ1y.js';
3
- export { G as GlitchgrabConfig, k as ReportSeverity, l as ReportType, m as RuntimeInfo } from './types-BpTLWJ1y.js';
2
+ import { h as GlitchgrabProviderProps, U as UseGlitchgrabReturn, R as ReportButtonProps, B as BookedDemo, F as FeedbackButtonProps, i as GlitchgrabSession, C as CaptureErrorOptions, g as GlitchgrabFeedback, c as BreadcrumbType, b as Breadcrumb, d as CapturedContext, D as DeviceInfo, e as FeedbackPayload, f as FeedbackResult, L as LeadInput, j as LeadResult, k as ReportPayload, l as ReportResult } from './types-BlMF6wzX.js';
3
+ export { a as BookingDialogOptions, G as GlitchgrabConfig, m as ReportSeverity, n as ReportType, o as RuntimeInfo } from './types-BlMF6wzX.js';
4
4
  import * as React from 'react';
5
5
  import { ReactNode } from 'react';
6
6
 
@@ -81,7 +81,7 @@ declare function BookDemoButton({ label, className, children, }: {
81
81
  }) => ReactNode;
82
82
  }): react_jsx_runtime.JSX.Element;
83
83
 
84
- declare function BookingDialog({ token, baseUrl, open, onClose, preview, availabilityUrl, }: {
84
+ declare function BookingDialog({ token, baseUrl, open, onClose, preview, availabilityUrl, intro, onBooked, }: {
85
85
  token: string;
86
86
  baseUrl: string;
87
87
  open: boolean;
@@ -97,6 +97,10 @@ declare function BookingDialog({ token, baseUrl, open, onClose, preview, availab
97
97
  * holds no `gg_` token for the project. Same response shape.
98
98
  */
99
99
  availabilityUrl?: string;
100
+ /** The host's one line above the title — see `BookingDialogOptions.intro`. */
101
+ intro?: string;
102
+ /** Fired once when a booking is confirmed — see `BookingDialogOptions.onBooked`. */
103
+ onBooked?: (booking: BookedDemo) => void;
100
104
  }): react_jsx_runtime.JSX.Element | null;
101
105
 
102
106
  /**
@@ -498,4 +502,4 @@ declare function computeSignature(params: {
498
502
  declare function shouldSkipDuplicate(signature: string, windowMs?: number, now?: number): boolean;
499
503
  declare function clearDedupCache(): void;
500
504
 
501
- export { BookDemoButton, BookingDialog, Breadcrumb, BreadcrumbType, CaptureErrorOptions, CapturedContext, DeviceInfo, FeedbackButton, FeedbackButtonProps, FeedbackPayload, type FeedbackQuery, FeedbackResult, GLITCHGRAB_SHORTCUT, GLITCHGRAB_SHORTCUT_MAC, type GlitchgrabComment, GlitchgrabErrorBoundary, GlitchgrabFeedback, GlitchgrabProvider, GlitchgrabProviderProps, type GlitchgrabReport, type GlitchgrabReportThread, GlitchgrabSession, LeadInput, LeadResult, ReportButton, ReportButtonProps, ReportPayload, ReportResult, UseGlitchgrabReturn, addBreadcrumb, captureContext, captureDeviceInfo, captureError, clearAppContext, clearBreadcrumbs, clearDedupCache, computeSignature, enhanceText, fetchGlitchgrabFeedback, fetchGlitchgrabReportThread, fetchGlitchgrabReports, getAppContext, getBreadcrumbs, getShortcutLabel, initBreadcrumbs, matchesShortcut, postGlitchgrabReportComment, sanitizeUrl, sendFeedback, sendLead, sendReport, setContext, setContexts, shouldSkipDuplicate, useGlitchgrab, useGlitchgrabActions, useGlitchgrabFeedback, useGlitchgrabReportThread, useGlitchgrabReports };
505
+ export { BookDemoButton, BookedDemo, BookingDialog, Breadcrumb, BreadcrumbType, CaptureErrorOptions, CapturedContext, DeviceInfo, FeedbackButton, FeedbackButtonProps, FeedbackPayload, type FeedbackQuery, FeedbackResult, GLITCHGRAB_SHORTCUT, GLITCHGRAB_SHORTCUT_MAC, type GlitchgrabComment, GlitchgrabErrorBoundary, GlitchgrabFeedback, GlitchgrabProvider, GlitchgrabProviderProps, type GlitchgrabReport, type GlitchgrabReportThread, GlitchgrabSession, LeadInput, LeadResult, ReportButton, ReportButtonProps, ReportPayload, ReportResult, UseGlitchgrabReturn, addBreadcrumb, captureContext, captureDeviceInfo, captureError, clearAppContext, clearBreadcrumbs, clearDedupCache, computeSignature, enhanceText, fetchGlitchgrabFeedback, fetchGlitchgrabReportThread, fetchGlitchgrabReports, getAppContext, getBreadcrumbs, getShortcutLabel, initBreadcrumbs, matchesShortcut, postGlitchgrabReportComment, sanitizeUrl, sendFeedback, sendLead, sendReport, setContext, setContexts, shouldSkipDuplicate, useGlitchgrab, useGlitchgrabActions, useGlitchgrabFeedback, useGlitchgrabReportThread, useGlitchgrabReports };
package/dist/index.js CHANGED
@@ -1485,10 +1485,21 @@ function drawStroke(ctx, s) {
1485
1485
  ctx.moveTo(s.points[0].x, s.points[0].y);
1486
1486
  for (let i = 1; i < s.points.length; i++) ctx.lineTo(s.points[i].x, s.points[i].y);
1487
1487
  ctx.stroke();
1488
- } else {
1488
+ } else if (s.type === "circle") {
1489
1489
  ctx.beginPath();
1490
1490
  ctx.arc(s.cx, s.cy, s.r, 0, Math.PI * 2);
1491
1491
  ctx.stroke();
1492
+ } else {
1493
+ if (Math.hypot(s.x2 - s.x1, s.y2 - s.y1) < 3) return;
1494
+ const angle = Math.atan2(s.y2 - s.y1, s.x2 - s.x1);
1495
+ const head = Math.max(14, s.width * 4);
1496
+ ctx.beginPath();
1497
+ ctx.moveTo(s.x1, s.y1);
1498
+ ctx.lineTo(s.x2, s.y2);
1499
+ ctx.moveTo(s.x2 - head * Math.cos(angle - Math.PI / 6), s.y2 - head * Math.sin(angle - Math.PI / 6));
1500
+ ctx.lineTo(s.x2, s.y2);
1501
+ ctx.lineTo(s.x2 - head * Math.cos(angle + Math.PI / 6), s.y2 - head * Math.sin(angle + Math.PI / 6));
1502
+ ctx.stroke();
1492
1503
  }
1493
1504
  }
1494
1505
  function AnnotationCanvas({ imageSrc, onSave, onCancel }) {
@@ -1537,7 +1548,7 @@ function AnnotationCanvas({ imageSrc, onSave, onCancel }) {
1537
1548
  e.currentTarget.setPointerCapture(e.pointerId);
1538
1549
  const { x, y } = getPos(e);
1539
1550
  setCurrentStroke(
1540
- tool === "pen" ? { type: "freehand", color, width: strokeWidth, points: [{ x, y }] } : { type: "circle", color, width: strokeWidth, cx: x, cy: y, r: 0 }
1551
+ tool === "pen" ? { type: "freehand", color, width: strokeWidth, points: [{ x, y }] } : tool === "circle" ? { type: "circle", color, width: strokeWidth, cx: x, cy: y, r: 0 } : { type: "arrow", color, width: strokeWidth, x1: x, y1: y, x2: x, y2: y }
1541
1552
  );
1542
1553
  };
1543
1554
  const handlePointerMove = (e) => {
@@ -1546,6 +1557,7 @@ function AnnotationCanvas({ imageSrc, onSave, onCancel }) {
1546
1557
  setCurrentStroke((prev) => {
1547
1558
  if (!prev) return prev;
1548
1559
  if (prev.type === "freehand") return { ...prev, points: [...prev.points, { x, y }] };
1560
+ if (prev.type === "arrow") return { ...prev, x2: x, y2: y };
1549
1561
  return { ...prev, r: Math.hypot(x - prev.cx, y - prev.cy) };
1550
1562
  });
1551
1563
  };
@@ -1626,6 +1638,7 @@ function AnnotationCanvas({ imageSrc, onSave, onCancel }) {
1626
1638
  children: [
1627
1639
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: () => setTool("pen"), style: iconBtn(tool === "pen"), title: "Freehand", "aria-label": "Freehand tool", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "15", height: "15", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M12 20h9M16.5 3.5a2.12 2.12 0 013 3L7 19l-4 1 1-4L16.5 3.5z", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) }) }),
1628
1640
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: () => setTool("circle"), style: iconBtn(tool === "circle"), title: "Circle", "aria-label": "Circle tool", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "15", height: "15", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "12", cy: "12", r: "8", stroke: "currentColor", strokeWidth: "1.8" }) }) }),
1641
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: () => setTool("arrow"), style: iconBtn(tool === "arrow"), title: "Arrow", "aria-label": "Arrow tool", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { width: "15", height: "15", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M5 19L19 5M19 5h-8M19 5v8", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) }) }),
1629
1642
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { width: "1px", height: "20px", background: "rgba(255,255,255,0.15)" } }),
1630
1643
  PALETTE.map((c) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1631
1644
  "button",
@@ -2500,6 +2513,7 @@ function AssistSheet({
2500
2513
  canReadPdf = false,
2501
2514
  onRemoveFile,
2502
2515
  onRemoveImage,
2516
+ onAnnotateImage,
2503
2517
  attachmentCount,
2504
2518
  context,
2505
2519
  reportTypeLabel,
@@ -2619,6 +2633,12 @@ function AssistSheet({
2619
2633
  const id = setTimeout(() => setAutoFileLeft((n) => n === null ? null : n - 1), 1e3);
2620
2634
  return () => clearTimeout(id);
2621
2635
  }, [autoFileLeft, isSubmitting, submitted, phase]);
2636
+ function markUp(index, shot) {
2637
+ if (!onAnnotateImage) return;
2638
+ stopAutoFile("marked up an image");
2639
+ logEvent("image_markup", pageShot && shot === pageShot ? "page capture" : "attached");
2640
+ onAnnotateImage(index);
2641
+ }
2622
2642
  function stopAutoFile(reason) {
2623
2643
  if (autoFileLeft === null) return;
2624
2644
  setAutoFileLeft(null);
@@ -3044,7 +3064,7 @@ function AssistSheet({
3044
3064
  @keyframes gg-autofile{from{transform:scaleX(0)}to{transform:scaleX(1)}}
3045
3065
  @keyframes gg-spin{to{transform:rotate(360deg)}}
3046
3066
  @keyframes gg-dot{0%,80%,100%{transform:translateY(0);opacity:.4}40%{transform:translateY(-3px);opacity:1}}
3047
- [data-gg-sheet-send]:focus-visible,[data-gg-chip]:focus-visible,[data-gg-assist-remove]:focus-visible,[data-gg-stop-auto-file]:focus-visible{outline:2px solid currentColor;outline-offset:2px}
3067
+ [data-gg-sheet-send]:focus-visible,[data-gg-chip]:focus-visible,[data-gg-assist-remove]:focus-visible,[data-gg-assist-annotate]:focus-visible,[data-gg-stop-auto-file]:focus-visible{outline:2px solid currentColor;outline-offset:2px}
3048
3068
  ` }),
3049
3069
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3050
3070
  "div",
@@ -3098,7 +3118,10 @@ function AssistSheet({
3098
3118
  display: "flex",
3099
3119
  alignItems: "flex-start",
3100
3120
  justifyContent: "space-between",
3101
- gap: "12px",
3121
+ // The title is one unbreakable line, so on a phone-width sheet the
3122
+ // pills drop to their own row instead of landing on the Beta tag (#591).
3123
+ flexWrap: "wrap",
3124
+ gap: "8px 12px",
3102
3125
  minWidth: 0
3103
3126
  },
3104
3127
  children: [
@@ -3143,7 +3166,7 @@ function AssistSheet({
3143
3166
  projectSlot ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { marginLeft: "6px" }, children: projectSlot }) : null
3144
3167
  ] })
3145
3168
  ] }),
3146
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { display: "flex", gap: "6px", flexShrink: 0 }, children: [
3169
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { display: "flex", gap: "6px", flexShrink: 0, marginLeft: "auto" }, children: [
3147
3170
  historyKey && (showChats || otherChats.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3148
3171
  "button",
3149
3172
  {
@@ -3206,7 +3229,8 @@ function AssistSheet({
3206
3229
  ref: scrollRef,
3207
3230
  style: {
3208
3231
  flex: 1,
3209
- minHeight: narrow ? "180px" : 0,
3232
+ // 0 while the "already filed?" card is up: its footer scrolls instead (#590).
3233
+ minHeight: narrow && !similarSlot ? "180px" : 0,
3210
3234
  overflowY: "auto",
3211
3235
  padding: "16px",
3212
3236
  display: "flex",
@@ -4058,7 +4082,10 @@ function AssistSheet({
4058
4082
  borderTop: `1px solid ${t.border}`,
4059
4083
  padding: "12px 16px",
4060
4084
  paddingBottom: narrow ? "max(12px, env(safe-area-inset-bottom))" : "12px",
4061
- backgroundColor: t.bg
4085
+ backgroundColor: t.bg,
4086
+ // The "already filed?" card can be taller than the sheet; scroll
4087
+ // it instead of clipping its buttons off the bottom (#590).
4088
+ ...similarSlot ? { maxHeight: "70%", overflowY: "auto" } : {}
4062
4089
  },
4063
4090
  children: [
4064
4091
  phase === "solved" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
@@ -4138,7 +4165,9 @@ function AssistSheet({
4138
4165
  src: shot,
4139
4166
  alt: read ? "Attached image the assistant reads" : "Attached image",
4140
4167
  "data-gg-assist-thumb": "",
4168
+ onClick: onAnnotateImage ? () => markUp(i, shot) : void 0,
4141
4169
  style: {
4170
+ cursor: onAnnotateImage ? "pointer" : void 0,
4142
4171
  display: "block",
4143
4172
  width: "100%",
4144
4173
  height: "100%",
@@ -4150,6 +4179,59 @@ function AssistSheet({
4150
4179
  }
4151
4180
  }
4152
4181
  ),
4182
+ onAnnotateImage && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4183
+ "button",
4184
+ {
4185
+ type: "button",
4186
+ "data-gg-assist-annotate": "",
4187
+ "aria-label": `Draw on image ${i + 1}`,
4188
+ title: "Draw or circle on this image",
4189
+ onClick: () => markUp(i, shot),
4190
+ style: {
4191
+ position: "absolute",
4192
+ bottom: "-13px",
4193
+ right: "-13px",
4194
+ width: "32px",
4195
+ height: "32px",
4196
+ border: "none",
4197
+ background: "transparent",
4198
+ padding: 0,
4199
+ cursor: "pointer",
4200
+ display: "flex",
4201
+ alignItems: "center",
4202
+ justifyContent: "center",
4203
+ borderRadius: "50%"
4204
+ },
4205
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4206
+ "span",
4207
+ {
4208
+ "aria-hidden": "true",
4209
+ style: {
4210
+ width: "20px",
4211
+ height: "20px",
4212
+ boxSizing: "border-box",
4213
+ borderRadius: "50%",
4214
+ border: `2px solid ${t.bg}`,
4215
+ background: t.accent,
4216
+ color: t.accentText,
4217
+ display: "flex",
4218
+ alignItems: "center",
4219
+ justifyContent: "center"
4220
+ },
4221
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { width: "10", height: "10", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4222
+ "path",
4223
+ {
4224
+ d: "M16.5 3.5a2.12 2.12 0 013 3L7 19l-4 1 1-4L16.5 3.5z",
4225
+ stroke: "currentColor",
4226
+ strokeWidth: "2.6",
4227
+ strokeLinecap: "round",
4228
+ strokeLinejoin: "round"
4229
+ }
4230
+ ) })
4231
+ }
4232
+ )
4233
+ }
4234
+ ),
4153
4235
  onRemoveImage && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4154
4236
  "button",
4155
4237
  {
@@ -6341,6 +6423,10 @@ function ReportDialog({
6341
6423
  setAttachingTo(null);
6342
6424
  }
6343
6425
  };
6426
+ const plainIssueTitle = (title) => (
6427
+ // Only emphasis markers: a lone "_" is part of a name (task_module).
6428
+ title.replace(/(\*\*|__)(?=\S)(.+?)(?<=\S)\1/g, "$2").replace(/[*`]+/g, "").replace(/\s+/g, " ").trim() || title
6429
+ );
6344
6430
  const similarCard = similarIssues ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
6345
6431
  "div",
6346
6432
  {
@@ -6428,10 +6514,7 @@ function ReportDialog({
6428
6514
  fontSize: "12.5px",
6429
6515
  lineHeight: 1.45,
6430
6516
  wordBreak: "break-word",
6431
- overflow: "hidden",
6432
- display: "-webkit-box",
6433
- WebkitLineClamp: 3,
6434
- WebkitBoxOrient: "vertical"
6517
+ overflowWrap: "anywhere"
6435
6518
  },
6436
6519
  children: [
6437
6520
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { style: { color: t.textMuted, fontWeight: 600 }, children: [
@@ -6439,7 +6522,7 @@ function ReportDialog({
6439
6522
  issue.number
6440
6523
  ] }),
6441
6524
  " ",
6442
- issue.title
6525
+ plainIssueTitle(issue.title)
6443
6526
  ]
6444
6527
  }
6445
6528
  ),
@@ -8412,6 +8495,7 @@ function ReportDialog({
8412
8495
  pageShot,
8413
8496
  onAddFiles: addFiles,
8414
8497
  onRemoveImage: (index) => setScreenshots((prev) => prev.filter((_, i) => i !== index)),
8498
+ onAnnotateImage: setAnnotatingIndex,
8415
8499
  files: heldFiles,
8416
8500
  canReadPdf: !!readFile,
8417
8501
  onRemoveFile: (index) => setAttachments((prev) => prev.filter((_, i) => i !== index)),
@@ -8617,6 +8701,69 @@ function getTypeIcon(type, color, size = 24) {
8617
8701
 
8618
8702
  // src/booking-dialog.tsx
8619
8703
  var import_react5 = require("react");
8704
+
8705
+ // src/phone.ts
8706
+ var COUNTRIES = [
8707
+ { iso: "IN", name: "India", dial: "91" },
8708
+ { iso: "AE", name: "UAE", dial: "971" },
8709
+ { iso: "US", name: "US / Canada", dial: "1" },
8710
+ { iso: "GB", name: "UK", dial: "44" },
8711
+ { iso: "SG", name: "Singapore", dial: "65" },
8712
+ { iso: "AU", name: "Australia", dial: "61" },
8713
+ { iso: "SA", name: "Saudi Arabia", dial: "966" },
8714
+ { iso: "QA", name: "Qatar", dial: "974" },
8715
+ { iso: "NP", name: "Nepal", dial: "977" },
8716
+ { iso: "BD", name: "Bangladesh", dial: "880" },
8717
+ { iso: "LK", name: "Sri Lanka", dial: "94" },
8718
+ { iso: "DE", name: "Germany", dial: "49" }
8719
+ ];
8720
+ var ZONE_COUNTRY = {
8721
+ "Asia/Kolkata": "91",
8722
+ "Asia/Calcutta": "91",
8723
+ "Asia/Dubai": "971",
8724
+ "Europe/London": "44",
8725
+ "Asia/Singapore": "65",
8726
+ "Asia/Riyadh": "966",
8727
+ "Asia/Qatar": "974",
8728
+ "Asia/Kathmandu": "977",
8729
+ "Asia/Katmandu": "977",
8730
+ "Asia/Dhaka": "880",
8731
+ "Asia/Colombo": "94",
8732
+ "Europe/Berlin": "49"
8733
+ };
8734
+ function defaultDialForZone(zone) {
8735
+ if (ZONE_COUNTRY[zone]) return ZONE_COUNTRY[zone];
8736
+ if (zone.startsWith("America/")) return "1";
8737
+ if (zone.startsWith("Australia/")) return "61";
8738
+ return "91";
8739
+ }
8740
+ function splitTypedPhone(typed, dial) {
8741
+ const trimmed = typed.trim();
8742
+ const digits = trimmed.replace(/\D/g, "");
8743
+ if (trimmed.startsWith("+")) {
8744
+ const match = [...COUNTRIES].sort((a, b) => b.dial.length - a.dial.length).find((c) => digits.startsWith(c.dial));
8745
+ if (match) return { dial: match.dial, national: digits.slice(match.dial.length) };
8746
+ }
8747
+ if (dial === "91" && digits.length === 12 && digits.startsWith("91")) return { dial, national: digits.slice(2) };
8748
+ if (dial === "91" && digits.length === 11 && digits.startsWith("0")) return { dial, national: digits.slice(1) };
8749
+ return { dial, national: digits };
8750
+ }
8751
+ function phoneProblem(dial, national) {
8752
+ const digits = national.replace(/\D/g, "");
8753
+ if (!digits) return "Enter your mobile number";
8754
+ if (dial === "91") {
8755
+ if (digits.length !== 10) return `An Indian mobile has 10 digits \u2014 this has ${digits.length}`;
8756
+ if (!/^[6-9]/.test(digits)) return "An Indian mobile starts with 6, 7, 8 or 9";
8757
+ return null;
8758
+ }
8759
+ if (digits.length < 6 || digits.length > 12) return "Check the number \u2014 it looks too short or too long";
8760
+ return null;
8761
+ }
8762
+ function toE164(dial, national) {
8763
+ return `+${dial}${national.replace(/\D/g, "")}`;
8764
+ }
8765
+
8766
+ // src/booking-dialog.tsx
8620
8767
  var import_jsx_runtime6 = require("react/jsx-runtime");
8621
8768
  function readQuestions(value) {
8622
8769
  if (!Array.isArray(value)) return [];
@@ -8759,7 +8906,9 @@ function BookingDialog({
8759
8906
  open,
8760
8907
  onClose,
8761
8908
  preview = false,
8762
- availabilityUrl
8909
+ availabilityUrl,
8910
+ intro,
8911
+ onBooked
8763
8912
  }) {
8764
8913
  var _a, _b, _c, _d, _e;
8765
8914
  const wide = useMediaQuery(WIDE_QUERY, true);
@@ -8782,6 +8931,8 @@ function BookingDialog({
8782
8931
  const [name, setName] = (0, import_react5.useState)("");
8783
8932
  const [email, setEmail] = (0, import_react5.useState)("");
8784
8933
  const [phone, setPhone] = (0, import_react5.useState)("");
8934
+ const [dial, setDial] = (0, import_react5.useState)(() => defaultDialForZone(localZone()));
8935
+ const [phoneTouched, setPhoneTouched] = (0, import_react5.useState)(false);
8785
8936
  const [note, setNote] = (0, import_react5.useState)("");
8786
8937
  const [questions, setQuestions] = (0, import_react5.useState)([]);
8787
8938
  const [answers, setAnswers] = (0, import_react5.useState)({});
@@ -8892,8 +9043,12 @@ function BookingDialog({
8892
9043
  const view = step !== "slots" ? step : !pageLoaded ? "loading" : questions.length > 0 && !asked ? "questions" : "slots";
8893
9044
  const roomy = step === "slots";
8894
9045
  async function startBooking() {
8895
- var _a2, _b2;
9046
+ var _a2, _b2, _c2;
8896
9047
  if (!selected) return;
9048
+ if (phoneError) {
9049
+ setPhoneTouched(true);
9050
+ return;
9051
+ }
8897
9052
  if (preview) {
8898
9053
  setPreviewEnded(true);
8899
9054
  return;
@@ -8907,7 +9062,7 @@ function BookingDialog({
8907
9062
  body: JSON.stringify({
8908
9063
  name,
8909
9064
  email,
8910
- phone,
9065
+ phone: toE164(dial, phone),
8911
9066
  note,
8912
9067
  answers: Object.fromEntries(given.map((q) => [q.id, q.answer])),
8913
9068
  startsAt: selected.startsAt,
@@ -8926,6 +9081,7 @@ function BookingDialog({
8926
9081
  if (json.data.confirmed) {
8927
9082
  setMeetUrl((_b2 = json.data.meetUrl) != null ? _b2 : null);
8928
9083
  setStep("done");
9084
+ reportBooked(json.data.bookingId, (_c2 = json.data.meetUrl) != null ? _c2 : null);
8929
9085
  return;
8930
9086
  }
8931
9087
  setBookingId(json.data.bookingId);
@@ -8936,8 +9092,16 @@ function BookingDialog({
8936
9092
  setBusy(false);
8937
9093
  }
8938
9094
  }
9095
+ function reportBooked(id, meet) {
9096
+ if (!onBooked || !id || !selected) return;
9097
+ try {
9098
+ onBooked({ bookingId: id, startsAt: selected.startsAt, name, email, phone: toE164(dial, phone), meetUrl: meet });
9099
+ } catch (e) {
9100
+ console.error("[glitchgrab] onBooked threw", e);
9101
+ }
9102
+ }
8939
9103
  async function confirmBooking() {
8940
- var _a2;
9104
+ var _a2, _b2;
8941
9105
  if (!bookingId) return;
8942
9106
  setBusy(true);
8943
9107
  setError(null);
@@ -8954,13 +9118,15 @@ function BookingDialog({
8954
9118
  }
8955
9119
  setMeetUrl(json.data.meetUrl);
8956
9120
  setStep("done");
9121
+ reportBooked(bookingId, (_b2 = json.data.meetUrl) != null ? _b2 : null);
8957
9122
  } catch (e) {
8958
9123
  setError("Couldn't reach the booking service");
8959
9124
  } finally {
8960
9125
  setBusy(false);
8961
9126
  }
8962
9127
  }
8963
- const canSubmitDetails = name.trim() && email.includes("@") && phone.replace(/\D/g, "").length >= 8;
9128
+ const phoneError = phoneProblem(dial, phone);
9129
+ const canSubmitDetails = Boolean(name.trim() && email.includes("@"));
8964
9130
  const selectedEnd = selected ? (_e = selected.endsAt) != null ? _e : new Date(new Date(selected.startsAt).getTime() + page.slotMinutes * 6e4).toISOString() : null;
8965
9131
  const monthDate = new Date(keyToUtc(`${month}-01`));
8966
9132
  const muted = { color: t.muted };
@@ -9107,6 +9273,14 @@ function BookingDialog({
9107
9273
  children: "Preview \u2014 nothing is booked"
9108
9274
  }
9109
9275
  ),
9276
+ intro && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9277
+ "div",
9278
+ {
9279
+ "data-glitchgrab-booking-intro": true,
9280
+ style: { fontSize: 13, fontWeight: 600, lineHeight: 1.45, paddingRight: 32, color: t.ink, overflowWrap: "anywhere" },
9281
+ children: intro
9282
+ }
9283
+ ),
9110
9284
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { fontSize: 20, fontWeight: 600, lineHeight: 1.25, paddingRight: 32, overflowWrap: "anywhere" }, children: page.title }),
9111
9285
  page.description && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { fontSize: 13, lineHeight: 1.5, overflowWrap: "anywhere", ...muted }, children: page.description }),
9112
9286
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 10, marginTop: 4, fontSize: 14 }, children: [
@@ -9549,14 +9723,17 @@ function BookingDialog({
9549
9723
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Field, { t, label: "Your name", value: name, onChange: setName, autoComplete: "name" }),
9550
9724
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Field, { t, label: "Email", value: email, onChange: setEmail, type: "email", autoComplete: "email" }),
9551
9725
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9552
- Field,
9726
+ PhoneField,
9553
9727
  {
9554
9728
  t,
9555
- label: "Mobile number",
9556
- value: phone,
9557
- onChange: setPhone,
9558
- type: "tel",
9559
- autoComplete: "tel",
9729
+ dial,
9730
+ national: phone,
9731
+ onChange: (nextDial, national) => {
9732
+ setDial(nextDial);
9733
+ setPhone(national);
9734
+ },
9735
+ onBlur: () => setPhoneTouched(true),
9736
+ error: phoneTouched ? phoneError : null,
9560
9737
  hint: requireOtp ? "We send a code here to confirm, then a reminder before the call." : "We send a reminder here before the call."
9561
9738
  }
9562
9739
  ),
@@ -9844,6 +10021,64 @@ function Field({
9844
10021
  hint && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { marginTop: 6, fontSize: 12, fontWeight: 400, color: t.muted }, children: hint })
9845
10022
  ] });
9846
10023
  }
10024
+ function PhoneField({
10025
+ t,
10026
+ dial,
10027
+ national,
10028
+ onChange,
10029
+ onBlur,
10030
+ error,
10031
+ hint
10032
+ }) {
10033
+ const box = {
10034
+ boxSizing: "border-box",
10035
+ padding: "9px 12px",
10036
+ background: t.input,
10037
+ color: t.text,
10038
+ border: `1px solid ${error ? t.danger : t.border}`,
10039
+ borderRadius: 8,
10040
+ fontFamily: "inherit",
10041
+ fontSize: 14,
10042
+ outline: "none"
10043
+ };
10044
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { style: { display: "block", fontSize: 13, fontWeight: 500, color: t.text }, children: [
10045
+ "Mobile number",
10046
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", gap: 8, marginTop: 6 }, children: [
10047
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
10048
+ "select",
10049
+ {
10050
+ "aria-label": "Country code",
10051
+ value: dial,
10052
+ onChange: (e) => onChange(e.target.value, national),
10053
+ style: { ...box, flex: "0 0 auto", paddingRight: 8, cursor: "pointer" },
10054
+ children: COUNTRIES.map((c) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("option", { value: c.dial, children: [
10055
+ c.iso,
10056
+ " +",
10057
+ c.dial
10058
+ ] }, c.iso))
10059
+ }
10060
+ ),
10061
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
10062
+ "input",
10063
+ {
10064
+ type: "tel",
10065
+ autoComplete: "tel",
10066
+ inputMode: "numeric",
10067
+ placeholder: dial === "91" ? "98765 43210" : "Mobile number",
10068
+ value: national,
10069
+ "aria-invalid": Boolean(error),
10070
+ onChange: (e) => {
10071
+ const next = splitTypedPhone(e.target.value, dial);
10072
+ onChange(next.dial, next.national);
10073
+ },
10074
+ onBlur,
10075
+ style: { ...box, flex: "1 1 auto", minWidth: 0, width: "100%" }
10076
+ }
10077
+ )
10078
+ ] }),
10079
+ error ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { role: "alert", style: { marginTop: 6, fontSize: 12, fontWeight: 500, color: t.danger }, children: error }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { marginTop: 6, fontSize: 12, fontWeight: 400, color: t.muted }, children: hint })
10080
+ ] });
10081
+ }
9847
10082
 
9848
10083
  // src/rejection.ts
9849
10084
  var DETAILS_MAX_LENGTH = 1e3;
@@ -10434,8 +10669,18 @@ function GlitchgrabProviderInner({
10434
10669
  const [signedUsers, setSignedUsers] = (0, import_react6.useState)("OFF");
10435
10670
  const aiBlockedUnsigned = signedUsers === "ENFORCE" && !signature;
10436
10671
  const [booking, setBooking] = (0, import_react6.useState)("closed");
10437
- const openBookingDialog = (0, import_react6.useCallback)(() => setBooking("live"), []);
10438
- const openBookingPreview = (0, import_react6.useCallback)(() => setBooking("preview"), []);
10672
+ const [bookingOptions, setBookingOptions] = (0, import_react6.useState)({});
10673
+ const openBookingDialog = (0, import_react6.useCallback)((options) => {
10674
+ setBookingOptions({
10675
+ intro: typeof (options == null ? void 0 : options.intro) === "string" ? options.intro : void 0,
10676
+ onBooked: typeof (options == null ? void 0 : options.onBooked) === "function" ? options.onBooked : void 0
10677
+ });
10678
+ setBooking("live");
10679
+ }, []);
10680
+ const openBookingPreview = (0, import_react6.useCallback)(() => {
10681
+ setBookingOptions({});
10682
+ setBooking("preview");
10683
+ }, []);
10439
10684
  (0, import_react6.useEffect)(() => {
10440
10685
  let cancelled = false;
10441
10686
  fetch(`${baseUrl}/api/v1/sdk/project`, {
@@ -10534,6 +10779,8 @@ function GlitchgrabProviderInner({
10534
10779
  baseUrl: baseUrl != null ? baseUrl : DEFAULT_BASE_URL2,
10535
10780
  open: booking !== "closed",
10536
10781
  preview: booking === "preview",
10782
+ intro: bookingOptions.intro,
10783
+ onBooked: bookingOptions.onBooked,
10537
10784
  onClose: () => setBooking("closed")
10538
10785
  }
10539
10786
  ),
@@ -10675,12 +10922,13 @@ function BookDemoButton({
10675
10922
  children
10676
10923
  }) {
10677
10924
  const { openBookingDialog } = useGlitchgrab();
10678
- if (children) return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: children({ onClick: openBookingDialog }) });
10925
+ const open = () => openBookingDialog();
10926
+ if (children) return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: children({ onClick: open }) });
10679
10927
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
10680
10928
  "button",
10681
10929
  {
10682
10930
  type: "button",
10683
- onClick: openBookingDialog,
10931
+ onClick: open,
10684
10932
  className,
10685
10933
  style: className ? void 0 : {
10686
10934
  padding: "10px 18px",