glitchgrab 1.59.1 → 1.61.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.mjs CHANGED
@@ -1426,10 +1426,21 @@ function drawStroke(ctx, s) {
1426
1426
  ctx.moveTo(s.points[0].x, s.points[0].y);
1427
1427
  for (let i = 1; i < s.points.length; i++) ctx.lineTo(s.points[i].x, s.points[i].y);
1428
1428
  ctx.stroke();
1429
- } else {
1429
+ } else if (s.type === "circle") {
1430
1430
  ctx.beginPath();
1431
1431
  ctx.arc(s.cx, s.cy, s.r, 0, Math.PI * 2);
1432
1432
  ctx.stroke();
1433
+ } else {
1434
+ if (Math.hypot(s.x2 - s.x1, s.y2 - s.y1) < 3) return;
1435
+ const angle = Math.atan2(s.y2 - s.y1, s.x2 - s.x1);
1436
+ const head = Math.max(14, s.width * 4);
1437
+ ctx.beginPath();
1438
+ ctx.moveTo(s.x1, s.y1);
1439
+ ctx.lineTo(s.x2, s.y2);
1440
+ ctx.moveTo(s.x2 - head * Math.cos(angle - Math.PI / 6), s.y2 - head * Math.sin(angle - Math.PI / 6));
1441
+ ctx.lineTo(s.x2, s.y2);
1442
+ ctx.lineTo(s.x2 - head * Math.cos(angle + Math.PI / 6), s.y2 - head * Math.sin(angle + Math.PI / 6));
1443
+ ctx.stroke();
1433
1444
  }
1434
1445
  }
1435
1446
  function AnnotationCanvas({ imageSrc, onSave, onCancel }) {
@@ -1478,7 +1489,7 @@ function AnnotationCanvas({ imageSrc, onSave, onCancel }) {
1478
1489
  e.currentTarget.setPointerCapture(e.pointerId);
1479
1490
  const { x, y } = getPos(e);
1480
1491
  setCurrentStroke(
1481
- tool === "pen" ? { type: "freehand", color, width: strokeWidth, points: [{ x, y }] } : { type: "circle", color, width: strokeWidth, cx: x, cy: y, r: 0 }
1492
+ 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 }
1482
1493
  );
1483
1494
  };
1484
1495
  const handlePointerMove = (e) => {
@@ -1487,6 +1498,7 @@ function AnnotationCanvas({ imageSrc, onSave, onCancel }) {
1487
1498
  setCurrentStroke((prev) => {
1488
1499
  if (!prev) return prev;
1489
1500
  if (prev.type === "freehand") return { ...prev, points: [...prev.points, { x, y }] };
1501
+ if (prev.type === "arrow") return { ...prev, x2: x, y2: y };
1490
1502
  return { ...prev, r: Math.hypot(x - prev.cx, y - prev.cy) };
1491
1503
  });
1492
1504
  };
@@ -1567,6 +1579,7 @@ function AnnotationCanvas({ imageSrc, onSave, onCancel }) {
1567
1579
  children: [
1568
1580
  /* @__PURE__ */ jsx("button", { type: "button", onClick: () => setTool("pen"), style: iconBtn(tool === "pen"), title: "Freehand", "aria-label": "Freehand tool", children: /* @__PURE__ */ jsx("svg", { width: "15", height: "15", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ 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" }) }) }),
1569
1581
  /* @__PURE__ */ jsx("button", { type: "button", onClick: () => setTool("circle"), style: iconBtn(tool === "circle"), title: "Circle", "aria-label": "Circle tool", children: /* @__PURE__ */ jsx("svg", { width: "15", height: "15", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "8", stroke: "currentColor", strokeWidth: "1.8" }) }) }),
1582
+ /* @__PURE__ */ jsx("button", { type: "button", onClick: () => setTool("arrow"), style: iconBtn(tool === "arrow"), title: "Arrow", "aria-label": "Arrow tool", children: /* @__PURE__ */ jsx("svg", { width: "15", height: "15", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M5 19L19 5M19 5h-8M19 5v8", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) }) }),
1570
1583
  /* @__PURE__ */ jsx("div", { style: { width: "1px", height: "20px", background: "rgba(255,255,255,0.15)" } }),
1571
1584
  PALETTE.map((c) => /* @__PURE__ */ jsx(
1572
1585
  "button",
@@ -2441,6 +2454,7 @@ function AssistSheet({
2441
2454
  canReadPdf = false,
2442
2455
  onRemoveFile,
2443
2456
  onRemoveImage,
2457
+ onAnnotateImage,
2444
2458
  attachmentCount,
2445
2459
  context,
2446
2460
  reportTypeLabel,
@@ -2560,6 +2574,12 @@ function AssistSheet({
2560
2574
  const id = setTimeout(() => setAutoFileLeft((n) => n === null ? null : n - 1), 1e3);
2561
2575
  return () => clearTimeout(id);
2562
2576
  }, [autoFileLeft, isSubmitting, submitted, phase]);
2577
+ function markUp(index, shot) {
2578
+ if (!onAnnotateImage) return;
2579
+ stopAutoFile("marked up an image");
2580
+ logEvent("image_markup", pageShot && shot === pageShot ? "page capture" : "attached");
2581
+ onAnnotateImage(index);
2582
+ }
2563
2583
  function stopAutoFile(reason) {
2564
2584
  if (autoFileLeft === null) return;
2565
2585
  setAutoFileLeft(null);
@@ -2985,7 +3005,7 @@ function AssistSheet({
2985
3005
  @keyframes gg-autofile{from{transform:scaleX(0)}to{transform:scaleX(1)}}
2986
3006
  @keyframes gg-spin{to{transform:rotate(360deg)}}
2987
3007
  @keyframes gg-dot{0%,80%,100%{transform:translateY(0);opacity:.4}40%{transform:translateY(-3px);opacity:1}}
2988
- [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}
3008
+ [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}
2989
3009
  ` }),
2990
3010
  /* @__PURE__ */ jsx3(
2991
3011
  "div",
@@ -3039,7 +3059,10 @@ function AssistSheet({
3039
3059
  display: "flex",
3040
3060
  alignItems: "flex-start",
3041
3061
  justifyContent: "space-between",
3042
- gap: "12px",
3062
+ // The title is one unbreakable line, so on a phone-width sheet the
3063
+ // pills drop to their own row instead of landing on the Beta tag (#591).
3064
+ flexWrap: "wrap",
3065
+ gap: "8px 12px",
3043
3066
  minWidth: 0
3044
3067
  },
3045
3068
  children: [
@@ -3084,7 +3107,7 @@ function AssistSheet({
3084
3107
  projectSlot ? /* @__PURE__ */ jsx3("span", { style: { marginLeft: "6px" }, children: projectSlot }) : null
3085
3108
  ] })
3086
3109
  ] }),
3087
- /* @__PURE__ */ jsxs3("div", { style: { display: "flex", gap: "6px", flexShrink: 0 }, children: [
3110
+ /* @__PURE__ */ jsxs3("div", { style: { display: "flex", gap: "6px", flexShrink: 0, marginLeft: "auto" }, children: [
3088
3111
  historyKey && (showChats || otherChats.length > 0) && /* @__PURE__ */ jsx3(
3089
3112
  "button",
3090
3113
  {
@@ -3147,7 +3170,8 @@ function AssistSheet({
3147
3170
  ref: scrollRef,
3148
3171
  style: {
3149
3172
  flex: 1,
3150
- minHeight: narrow ? "180px" : 0,
3173
+ // 0 while the "already filed?" card is up: its footer scrolls instead (#590).
3174
+ minHeight: narrow && !similarSlot ? "180px" : 0,
3151
3175
  overflowY: "auto",
3152
3176
  padding: "16px",
3153
3177
  display: "flex",
@@ -3999,7 +4023,12 @@ function AssistSheet({
3999
4023
  borderTop: `1px solid ${t.border}`,
4000
4024
  padding: "12px 16px",
4001
4025
  paddingBottom: narrow ? "max(12px, env(safe-area-inset-bottom))" : "12px",
4002
- backgroundColor: t.bg
4026
+ backgroundColor: t.bg,
4027
+ // The "already filed?" card can be taller than the sheet; scroll
4028
+ // it instead of clipping its buttons off the bottom (#590).
4029
+ // The bottom sheet has only a max-height, so a % here resolves
4030
+ // to auto and never scrolls (#596): use the viewport there.
4031
+ ...similarSlot ? { maxHeight: narrow ? "55dvh" : "70%", overflowY: "auto" } : {}
4003
4032
  },
4004
4033
  children: [
4005
4034
  phase === "solved" ? /* @__PURE__ */ jsx3(
@@ -4079,7 +4108,9 @@ function AssistSheet({
4079
4108
  src: shot,
4080
4109
  alt: read ? "Attached image the assistant reads" : "Attached image",
4081
4110
  "data-gg-assist-thumb": "",
4111
+ onClick: onAnnotateImage ? () => markUp(i, shot) : void 0,
4082
4112
  style: {
4113
+ cursor: onAnnotateImage ? "pointer" : void 0,
4083
4114
  display: "block",
4084
4115
  width: "100%",
4085
4116
  height: "100%",
@@ -4091,6 +4122,59 @@ function AssistSheet({
4091
4122
  }
4092
4123
  }
4093
4124
  ),
4125
+ onAnnotateImage && /* @__PURE__ */ jsx3(
4126
+ "button",
4127
+ {
4128
+ type: "button",
4129
+ "data-gg-assist-annotate": "",
4130
+ "aria-label": `Draw on image ${i + 1}`,
4131
+ title: "Draw or circle on this image",
4132
+ onClick: () => markUp(i, shot),
4133
+ style: {
4134
+ position: "absolute",
4135
+ bottom: "-13px",
4136
+ right: "-13px",
4137
+ width: "32px",
4138
+ height: "32px",
4139
+ border: "none",
4140
+ background: "transparent",
4141
+ padding: 0,
4142
+ cursor: "pointer",
4143
+ display: "flex",
4144
+ alignItems: "center",
4145
+ justifyContent: "center",
4146
+ borderRadius: "50%"
4147
+ },
4148
+ children: /* @__PURE__ */ jsx3(
4149
+ "span",
4150
+ {
4151
+ "aria-hidden": "true",
4152
+ style: {
4153
+ width: "20px",
4154
+ height: "20px",
4155
+ boxSizing: "border-box",
4156
+ borderRadius: "50%",
4157
+ border: `2px solid ${t.bg}`,
4158
+ background: t.accent,
4159
+ color: t.accentText,
4160
+ display: "flex",
4161
+ alignItems: "center",
4162
+ justifyContent: "center"
4163
+ },
4164
+ children: /* @__PURE__ */ jsx3("svg", { width: "10", height: "10", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx3(
4165
+ "path",
4166
+ {
4167
+ d: "M16.5 3.5a2.12 2.12 0 013 3L7 19l-4 1 1-4L16.5 3.5z",
4168
+ stroke: "currentColor",
4169
+ strokeWidth: "2.6",
4170
+ strokeLinecap: "round",
4171
+ strokeLinejoin: "round"
4172
+ }
4173
+ ) })
4174
+ }
4175
+ )
4176
+ }
4177
+ ),
4094
4178
  onRemoveImage && /* @__PURE__ */ jsx3(
4095
4179
  "button",
4096
4180
  {
@@ -6282,6 +6366,10 @@ function ReportDialog({
6282
6366
  setAttachingTo(null);
6283
6367
  }
6284
6368
  };
6369
+ const plainIssueTitle = (title) => (
6370
+ // Only emphasis markers: a lone "_" is part of a name (task_module).
6371
+ title.replace(/(\*\*|__)(?=\S)(.+?)(?<=\S)\1/g, "$2").replace(/[*`]+/g, "").replace(/\s+/g, " ").trim() || title
6372
+ );
6285
6373
  const similarCard = similarIssues ? /* @__PURE__ */ jsxs5(
6286
6374
  "div",
6287
6375
  {
@@ -6369,10 +6457,7 @@ function ReportDialog({
6369
6457
  fontSize: "12.5px",
6370
6458
  lineHeight: 1.45,
6371
6459
  wordBreak: "break-word",
6372
- overflow: "hidden",
6373
- display: "-webkit-box",
6374
- WebkitLineClamp: 3,
6375
- WebkitBoxOrient: "vertical"
6460
+ overflowWrap: "anywhere"
6376
6461
  },
6377
6462
  children: [
6378
6463
  /* @__PURE__ */ jsxs5("span", { style: { color: t.textMuted, fontWeight: 600 }, children: [
@@ -6380,7 +6465,7 @@ function ReportDialog({
6380
6465
  issue.number
6381
6466
  ] }),
6382
6467
  " ",
6383
- issue.title
6468
+ plainIssueTitle(issue.title)
6384
6469
  ]
6385
6470
  }
6386
6471
  ),
@@ -8353,6 +8438,7 @@ function ReportDialog({
8353
8438
  pageShot,
8354
8439
  onAddFiles: addFiles,
8355
8440
  onRemoveImage: (index) => setScreenshots((prev) => prev.filter((_, i) => i !== index)),
8441
+ onAnnotateImage: setAnnotatingIndex,
8356
8442
  files: heldFiles,
8357
8443
  canReadPdf: !!readFile,
8358
8444
  onRemoveFile: (index) => setAttachments((prev) => prev.filter((_, i) => i !== index)),
@@ -8663,6 +8749,7 @@ var WEEKDAYS = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
8663
8749
  var DAY_MS = 864e5;
8664
8750
  var ZONE_PAD_MS = 14 * 36e5;
8665
8751
  var WIDE_QUERY = "(min-width: 900px)";
8752
+ var SPLIT_QUERY = "(min-width: 1120px)";
8666
8753
  function localZone() {
8667
8754
  try {
8668
8755
  return Intl.DateTimeFormat().resolvedOptions().timeZone;
@@ -8769,13 +8856,14 @@ function BookingDialog({
8769
8856
  }) {
8770
8857
  var _a, _b, _c, _d, _e;
8771
8858
  const wide = useMediaQuery(WIDE_QUERY, true);
8859
+ const split = useMediaQuery(SPLIT_QUERY, true) && wide;
8772
8860
  const t = useMemo3(() => {
8773
8861
  if (!open) return LIGHT;
8774
8862
  const base = detectDark() ? DARK : LIGHT;
8775
8863
  const accent = detectHostAccent();
8776
8864
  return accent ? { ...base, ink: accent.accent, onInk: accent.accentText } : base;
8777
8865
  }, [open]);
8778
- const [step, setStep] = useState5("slots");
8866
+ const [step, setStep] = useState5("pick");
8779
8867
  const [zone, setZone] = useState5(localZone);
8780
8868
  const [twelve, setTwelve] = useState5(prefers12h);
8781
8869
  const [month, setMonth] = useState5(() => dayKeyIn(Date.now(), localZone()).slice(0, 7));
@@ -8790,11 +8878,10 @@ function BookingDialog({
8790
8878
  const [phone, setPhone] = useState5("");
8791
8879
  const [dial, setDial] = useState5(() => defaultDialForZone(localZone()));
8792
8880
  const [phoneTouched, setPhoneTouched] = useState5(false);
8793
- const [note, setNote] = useState5("");
8881
+ const [tried, setTried] = useState5(false);
8794
8882
  const [questions, setQuestions] = useState5([]);
8795
8883
  const [answers, setAnswers] = useState5({});
8796
8884
  const [pageLoaded, setPageLoaded] = useState5(false);
8797
- const [asked, setAsked] = useState5(false);
8798
8885
  const [requireOtp, setRequireOtp] = useState5(true);
8799
8886
  const [code, setCode] = useState5("");
8800
8887
  const [bookingId, setBookingId] = useState5(null);
@@ -8854,7 +8941,7 @@ function BookingDialog({
8854
8941
  useEffect5(() => {
8855
8942
  if (!open) return;
8856
8943
  const now = localZone();
8857
- setStep("slots");
8944
+ setStep("pick");
8858
8945
  setZone(now);
8859
8946
  setMonth(dayKeyIn(Date.now(), now).slice(0, 7));
8860
8947
  setSlotsByMonth({});
@@ -8866,7 +8953,7 @@ function BookingDialog({
8866
8953
  setPreviewEnded(false);
8867
8954
  setAvatarFailed(false);
8868
8955
  setPageLoaded(false);
8869
- setAsked(false);
8956
+ setTried(false);
8870
8957
  }, [open]);
8871
8958
  const monthLoaded = month in slotsByMonth;
8872
8959
  useEffect5(() => {
@@ -8896,13 +8983,22 @@ function BookingDialog({
8896
8983
  const atFirstMonth = month <= today.slice(0, 7);
8897
8984
  const pastHorizon = monthLoaded && !error && byDay.size === 0 && !atFirstMonth;
8898
8985
  const given = questions.flatMap((q) => q.options.includes(answers[q.id]) ? [{ ...q, answer: answers[q.id] }] : []);
8899
- const canContinue = questions.every((q) => !q.required || q.options.includes(answers[q.id]));
8900
- const view = step !== "slots" ? step : !pageLoaded ? "loading" : questions.length > 0 && !asked ? "questions" : "slots";
8901
- const roomy = step === "slots";
8986
+ const unanswered = questions.filter((q) => q.required && !q.options.includes(answers[q.id]));
8987
+ const phoneError = phoneProblem(dial, phone);
8988
+ const nameMissing = !name.trim();
8989
+ const emailMissing = !email.includes("@");
8990
+ const missing = [
8991
+ ...nameMissing ? ["your name"] : [],
8992
+ ...phoneError ? ["a valid mobile number"] : [],
8993
+ ...emailMissing ? ["your email"] : [],
8994
+ ...unanswered.map((q) => `an answer to \u201C${q.label}\u201D`),
8995
+ ...selected ? [] : ["a day and time"]
8996
+ ];
8997
+ const roomy = step === "pick";
8902
8998
  async function startBooking() {
8903
8999
  var _a2, _b2, _c2;
8904
- if (!selected) return;
8905
- if (phoneError) {
9000
+ if (missing.length > 0 || !selected) {
9001
+ setTried(true);
8906
9002
  setPhoneTouched(true);
8907
9003
  return;
8908
9004
  }
@@ -8920,7 +9016,6 @@ function BookingDialog({
8920
9016
  name,
8921
9017
  email,
8922
9018
  phone: toE164(dial, phone),
8923
- note,
8924
9019
  answers: Object.fromEntries(given.map((q) => [q.id, q.answer])),
8925
9020
  startsAt: selected.startsAt,
8926
9021
  // The zone the times were shown in, which is the one the visitor chose.
@@ -8982,8 +9077,6 @@ function BookingDialog({
8982
9077
  setBusy(false);
8983
9078
  }
8984
9079
  }
8985
- const phoneError = phoneProblem(dial, phone);
8986
- const canSubmitDetails = Boolean(name.trim() && email.includes("@"));
8987
9080
  const selectedEnd = selected ? (_e = selected.endsAt) != null ? _e : new Date(new Date(selected.startsAt).getTime() + page.slotMinutes * 6e4).toISOString() : null;
8988
9081
  const monthDate = new Date(keyToUtc(`${month}-01`));
8989
9082
  const muted = { color: t.muted };
@@ -9141,7 +9234,7 @@ function BookingDialog({
9141
9234
  /* @__PURE__ */ jsx6("div", { style: { fontSize: 20, fontWeight: 600, lineHeight: 1.25, paddingRight: 32, overflowWrap: "anywhere" }, children: page.title }),
9142
9235
  page.description && /* @__PURE__ */ jsx6("div", { style: { fontSize: 13, lineHeight: 1.5, overflowWrap: "anywhere", ...muted }, children: page.description }),
9143
9236
  /* @__PURE__ */ jsxs6("div", { style: { display: "flex", flexDirection: "column", gap: 10, marginTop: 4, fontSize: 14 }, children: [
9144
- selected && step !== "slots" && /* @__PURE__ */ jsx6(Row, { icon: "calendar", t, children: /* @__PURE__ */ jsxs6("span", { children: [
9237
+ selected && step !== "pick" && /* @__PURE__ */ jsx6(Row, { icon: "calendar", t, children: /* @__PURE__ */ jsxs6("span", { children: [
9145
9238
  new Date(selected.startsAt).toLocaleDateString("en-US", {
9146
9239
  weekday: "long",
9147
9240
  month: "long",
@@ -9156,33 +9249,7 @@ function BookingDialog({
9156
9249
  selectedEnd && formatTime(selectedEnd, zone, twelve)
9157
9250
  ] })
9158
9251
  ] }) }),
9159
- asked && given.length > 0 && /* @__PURE__ */ jsx6(Row, { icon: "check", t, children: /* @__PURE__ */ jsxs6("span", { children: [
9160
- given.map((q) => q.answer).join(" \xB7 "),
9161
- view === "slots" && /* @__PURE__ */ jsxs6(Fragment5, { children: [
9162
- " ",
9163
- /* @__PURE__ */ jsx6(
9164
- "button",
9165
- {
9166
- type: "button",
9167
- onClick: () => setAsked(false),
9168
- className: "gg-bk-link",
9169
- style: {
9170
- border: 0,
9171
- // Room for a thumb without pushing the rows apart.
9172
- padding: "8px 6px",
9173
- margin: "-8px 0",
9174
- background: "transparent",
9175
- color: t.muted,
9176
- fontFamily: "inherit",
9177
- fontSize: 13,
9178
- textDecoration: "underline",
9179
- cursor: "pointer"
9180
- },
9181
- children: "Change"
9182
- }
9183
- )
9184
- ] })
9185
- ] }) }),
9252
+ step !== "pick" && given.length > 0 && /* @__PURE__ */ jsx6(Row, { icon: "check", t, children: given.map((q) => q.answer).join(" \xB7 ") }),
9186
9253
  /* @__PURE__ */ jsx6(Row, { icon: "clock", t, children: formatDuration(page.slotMinutes) }),
9187
9254
  /* @__PURE__ */ jsx6(Row, { icon: "video", t, children: "Google Meet" }),
9188
9255
  /* @__PURE__ */ jsx6(Row, { icon: "globe", t, children: roomy ? (
@@ -9239,328 +9306,365 @@ function BookingDialog({
9239
9306
  ]
9240
9307
  }
9241
9308
  );
9242
- const calendar = /* @__PURE__ */ jsxs6(
9243
- "div",
9244
- {
9245
- style: {
9246
- flex: "1 1 auto",
9247
- minWidth: 0,
9248
- padding: wide ? "24px 24px 20px" : "16px 16px 8px",
9249
- boxSizing: "border-box",
9250
- overflowY: wide ? "auto" : void 0
9251
- },
9252
- children: [
9253
- /* @__PURE__ */ jsxs6("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: 14 }, children: [
9254
- /* @__PURE__ */ jsxs6("div", { style: { fontSize: 16, fontWeight: 600 }, children: [
9255
- monthDate.toLocaleDateString("en-US", { month: "long", timeZone: "UTC" }),
9256
- " ",
9257
- /* @__PURE__ */ jsx6("span", { style: { fontWeight: 500, ...muted }, children: monthDate.getUTCFullYear() })
9258
- ] }),
9259
- /* @__PURE__ */ jsxs6("div", { style: { display: "flex", gap: 4 }, children: [
9260
- /* @__PURE__ */ jsx6(
9261
- NavButton,
9262
- {
9263
- t,
9264
- label: "Previous month",
9265
- icon: "left",
9266
- disabled: atFirstMonth,
9267
- onClick: () => setMonth(shiftMonth(month, -1))
9268
- }
9269
- ),
9270
- /* @__PURE__ */ jsx6(
9271
- NavButton,
9272
- {
9273
- t,
9274
- label: "Next month",
9275
- icon: "right",
9276
- disabled: pastHorizon,
9277
- onClick: () => setMonth(shiftMonth(month, 1))
9278
- }
9279
- )
9280
- ] })
9281
- ] }),
9282
- /* @__PURE__ */ jsxs6("div", { style: { display: "grid", gridTemplateColumns: "repeat(7, minmax(0, 1fr))", gap: wide ? 6 : 4 }, children: [
9283
- WEEKDAYS.map((w) => /* @__PURE__ */ jsx6(
9284
- "div",
9309
+ const calendar = /* @__PURE__ */ jsxs6("div", { style: { padding: wide ? "22px 20px 12px" : "16px 16px 8px", boxSizing: "border-box" }, children: [
9310
+ /* @__PURE__ */ jsxs6("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: 14 }, children: [
9311
+ /* @__PURE__ */ jsxs6("div", { style: { fontSize: 16, fontWeight: 600 }, children: [
9312
+ monthDate.toLocaleDateString("en-US", { month: "long", timeZone: "UTC" }),
9313
+ " ",
9314
+ /* @__PURE__ */ jsx6("span", { style: { fontWeight: 500, ...muted }, children: monthDate.getUTCFullYear() })
9315
+ ] }),
9316
+ /* @__PURE__ */ jsxs6("div", { style: { display: "flex", gap: 4 }, children: [
9317
+ /* @__PURE__ */ jsx6(
9318
+ NavButton,
9319
+ {
9320
+ t,
9321
+ label: "Previous month",
9322
+ icon: "left",
9323
+ disabled: atFirstMonth,
9324
+ onClick: () => setMonth(shiftMonth(month, -1))
9325
+ }
9326
+ ),
9327
+ /* @__PURE__ */ jsx6(
9328
+ NavButton,
9329
+ {
9330
+ t,
9331
+ label: "Next month",
9332
+ icon: "right",
9333
+ disabled: pastHorizon,
9334
+ onClick: () => setMonth(shiftMonth(month, 1))
9335
+ }
9336
+ )
9337
+ ] })
9338
+ ] }),
9339
+ /* @__PURE__ */ jsxs6("div", { style: { display: "grid", gridTemplateColumns: "repeat(7, minmax(0, 1fr))", gap: 4 }, children: [
9340
+ WEEKDAYS.map((w) => /* @__PURE__ */ jsx6(
9341
+ "div",
9342
+ {
9343
+ style: {
9344
+ textAlign: "center",
9345
+ fontSize: 11,
9346
+ fontWeight: 500,
9347
+ letterSpacing: ".08em",
9348
+ textTransform: "uppercase",
9349
+ padding: "6px 0 8px",
9350
+ color: t.text
9351
+ },
9352
+ children: w
9353
+ },
9354
+ w
9355
+ )),
9356
+ grid.map((key) => {
9357
+ const inMonth = key.startsWith(month);
9358
+ const bookable = byDay.has(key);
9359
+ const isSelected = key === day;
9360
+ const dayNum = Number(key.slice(8));
9361
+ if (!inMonth && !bookable) return /* @__PURE__ */ jsx6("div", { "aria-hidden": true }, key);
9362
+ return /* @__PURE__ */ jsxs6(
9363
+ "button",
9364
+ {
9365
+ type: "button",
9366
+ disabled: !bookable,
9367
+ onClick: () => setPickedDay(key),
9368
+ "aria-pressed": isSelected,
9369
+ "aria-label": new Date(keyToUtc(key)).toLocaleDateString("en-US", {
9370
+ weekday: "long",
9371
+ month: "long",
9372
+ day: "numeric",
9373
+ timeZone: "UTC"
9374
+ }),
9375
+ className: bookable && !isSelected ? "gg-bk-day" : void 0,
9376
+ style: {
9377
+ position: "relative",
9378
+ // Shorter than square: the times sit under the month now, and
9379
+ // both should fit without scrolling on a laptop.
9380
+ aspectRatio: wide ? "5 / 4" : "1 / 1",
9381
+ minHeight: 36,
9382
+ border: 0,
9383
+ borderRadius: 8,
9384
+ padding: 0,
9385
+ fontFamily: "inherit",
9386
+ fontSize: wide ? 15 : 14,
9387
+ fontWeight: bookable ? 600 : 400,
9388
+ cursor: bookable ? "pointer" : "default",
9389
+ background: isSelected ? t.ink : bookable ? t.open : "transparent",
9390
+ color: isSelected ? t.onInk : bookable ? t.text : t.faint,
9391
+ opacity: monthLoaded ? 1 : 0.5
9392
+ },
9393
+ children: [
9394
+ !inMonth && dayNum === 1 && /* @__PURE__ */ jsx6(
9395
+ "span",
9396
+ {
9397
+ style: {
9398
+ position: "absolute",
9399
+ top: 4,
9400
+ left: 0,
9401
+ right: 0,
9402
+ fontSize: 9,
9403
+ fontWeight: 500,
9404
+ letterSpacing: ".06em",
9405
+ textTransform: "uppercase"
9406
+ },
9407
+ children: new Date(keyToUtc(key)).toLocaleDateString("en-US", { month: "short", timeZone: "UTC" })
9408
+ }
9409
+ ),
9410
+ dayNum,
9411
+ key === today && /* @__PURE__ */ jsx6(
9412
+ "span",
9413
+ {
9414
+ "aria-hidden": true,
9415
+ style: {
9416
+ position: "absolute",
9417
+ bottom: 6,
9418
+ left: "50%",
9419
+ width: 4,
9420
+ height: 4,
9421
+ marginLeft: -2,
9422
+ borderRadius: 999,
9423
+ background: isSelected ? t.onInk : t.text
9424
+ }
9425
+ }
9426
+ )
9427
+ ]
9428
+ },
9429
+ key
9430
+ );
9431
+ })
9432
+ ] })
9433
+ ] });
9434
+ const times = /* @__PURE__ */ jsxs6("div", { style: { borderTop: `1px solid ${t.border}`, padding: wide ? "16px 20px 0" : "16px 16px 0", boxSizing: "border-box" }, children: [
9435
+ /* @__PURE__ */ jsxs6("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 14 }, children: [
9436
+ /* @__PURE__ */ jsx6("div", { style: { fontSize: 16, fontWeight: 600, whiteSpace: "nowrap" }, children: day ? /* @__PURE__ */ jsxs6(Fragment5, { children: [
9437
+ new Date(keyToUtc(day)).toLocaleDateString("en-US", { weekday: "short", timeZone: "UTC" }),
9438
+ " ",
9439
+ /* @__PURE__ */ jsx6("span", { style: { fontWeight: 500, ...muted }, children: ordinal(Number(day.slice(8))) })
9440
+ ] }) : /* @__PURE__ */ jsx6("span", { style: { fontWeight: 500, ...muted }, children: "Times" }) }),
9441
+ /* @__PURE__ */ jsx6(
9442
+ "div",
9443
+ {
9444
+ role: "group",
9445
+ "aria-label": "Clock format",
9446
+ style: { display: "flex", padding: 3, borderRadius: 8, background: t.open, flex: "0 0 auto" },
9447
+ children: [true, false].map((h12) => /* @__PURE__ */ jsx6(
9448
+ "button",
9285
9449
  {
9450
+ type: "button",
9451
+ "aria-pressed": twelve === h12,
9452
+ onClick: () => setTwelve(h12),
9286
9453
  style: {
9287
- textAlign: "center",
9288
- fontSize: 11,
9454
+ border: 0,
9455
+ borderRadius: 6,
9456
+ padding: "4px 9px",
9457
+ fontFamily: "inherit",
9458
+ fontSize: 13,
9289
9459
  fontWeight: 500,
9290
- letterSpacing: ".08em",
9291
- textTransform: "uppercase",
9292
- padding: "6px 0 8px",
9293
- color: t.text
9460
+ cursor: "pointer",
9461
+ background: twelve === h12 ? t.bg : "transparent",
9462
+ color: twelve === h12 ? t.text : t.muted,
9463
+ boxShadow: twelve === h12 ? "0 1px 2px rgba(0,0,0,.12)" : "none"
9294
9464
  },
9295
- children: w
9465
+ children: h12 ? "12h" : "24h"
9296
9466
  },
9297
- w
9298
- )),
9299
- grid.map((key) => {
9300
- const inMonth = key.startsWith(month);
9301
- const bookable = byDay.has(key);
9302
- const isSelected = key === day;
9303
- const dayNum = Number(key.slice(8));
9304
- if (!inMonth && !bookable) return /* @__PURE__ */ jsx6("div", { "aria-hidden": true }, key);
9305
- return /* @__PURE__ */ jsxs6(
9467
+ String(h12)
9468
+ ))
9469
+ }
9470
+ )
9471
+ ] }),
9472
+ /* @__PURE__ */ jsxs6(
9473
+ "div",
9474
+ {
9475
+ role: "group",
9476
+ "aria-label": "Times",
9477
+ style: {
9478
+ paddingBottom: 20,
9479
+ display: "grid",
9480
+ gridTemplateColumns: "repeat(auto-fill, minmax(84px, 1fr))",
9481
+ gap: 8
9482
+ },
9483
+ children: [
9484
+ error && /* @__PURE__ */ jsx6("div", { style: { color: t.danger, fontSize: 13, lineHeight: 1.5, gridColumn: "1 / -1" }, children: error }),
9485
+ !monthLoaded && !error && /* @__PURE__ */ jsx6("div", { style: { fontSize: 13, gridColumn: "1 / -1", ...muted }, children: "Finding times\u2026" }),
9486
+ monthLoaded && !error && !day && /* @__PURE__ */ jsx6("div", { style: { fontSize: 13, lineHeight: 1.5, gridColumn: "1 / -1", ...muted }, children: pastHorizon ? "Nothing can be booked this far ahead yet." : "No times left this month. Try the next one." }),
9487
+ monthLoaded && daySlots.map((slot) => {
9488
+ const on = (selected == null ? void 0 : selected.startsAt) === slot.startsAt;
9489
+ return /* @__PURE__ */ jsx6(
9306
9490
  "button",
9307
9491
  {
9308
9492
  type: "button",
9309
- disabled: !bookable,
9310
- onClick: () => setPickedDay(key),
9311
- "aria-pressed": isSelected,
9312
- "aria-label": new Date(keyToUtc(key)).toLocaleDateString("en-US", {
9313
- weekday: "long",
9314
- month: "long",
9315
- day: "numeric",
9316
- timeZone: "UTC"
9317
- }),
9318
- className: bookable && !isSelected ? "gg-bk-day" : void 0,
9493
+ "aria-pressed": on,
9494
+ className: on ? void 0 : "gg-bk-slot",
9495
+ onClick: () => {
9496
+ setSelected(slot);
9497
+ setError(null);
9498
+ },
9319
9499
  style: {
9320
- position: "relative",
9321
- aspectRatio: "1 / 1",
9322
- minHeight: 36,
9323
- border: 0,
9500
+ padding: "10px 8px",
9324
9501
  borderRadius: 8,
9325
- padding: 0,
9502
+ border: `1px solid ${on ? t.ink : t.border}`,
9503
+ background: on ? t.ink : t.pane,
9504
+ color: on ? t.onInk : t.text,
9326
9505
  fontFamily: "inherit",
9327
- fontSize: wide ? 15 : 14,
9328
- fontWeight: bookable ? 600 : 400,
9329
- cursor: bookable ? "pointer" : "default",
9330
- background: isSelected ? t.ink : bookable ? t.open : "transparent",
9331
- color: isSelected ? t.onInk : bookable ? t.text : t.faint,
9332
- opacity: monthLoaded ? 1 : 0.5
9506
+ fontSize: 14,
9507
+ fontWeight: 500,
9508
+ cursor: "pointer",
9509
+ textAlign: "center"
9333
9510
  },
9334
- children: [
9335
- !inMonth && dayNum === 1 && /* @__PURE__ */ jsx6(
9336
- "span",
9337
- {
9338
- style: {
9339
- position: "absolute",
9340
- top: 4,
9341
- left: 0,
9342
- right: 0,
9343
- fontSize: 9,
9344
- fontWeight: 500,
9345
- letterSpacing: ".06em",
9346
- textTransform: "uppercase"
9347
- },
9348
- children: new Date(keyToUtc(key)).toLocaleDateString("en-US", { month: "short", timeZone: "UTC" })
9349
- }
9350
- ),
9351
- dayNum,
9352
- key === today && /* @__PURE__ */ jsx6(
9353
- "span",
9354
- {
9355
- "aria-hidden": true,
9356
- style: {
9357
- position: "absolute",
9358
- bottom: 6,
9359
- left: "50%",
9360
- width: 4,
9361
- height: 4,
9362
- marginLeft: -2,
9363
- borderRadius: 999,
9364
- background: isSelected ? t.onInk : t.text
9365
- }
9366
- }
9367
- )
9368
- ]
9511
+ children: formatTime(slot.startsAt, zone, twelve)
9369
9512
  },
9370
- key
9513
+ slot.startsAt
9371
9514
  );
9372
9515
  })
9373
- ] })
9374
- ]
9375
- }
9376
- );
9377
- const times = /* @__PURE__ */ jsxs6(
9516
+ ]
9517
+ }
9518
+ )
9519
+ ] });
9520
+ const details = /* @__PURE__ */ jsxs6(
9378
9521
  "div",
9379
9522
  {
9380
9523
  style: {
9381
- width: wide ? 260 : void 0,
9382
- flex: wide ? "0 0 260px" : void 0,
9383
- borderLeft: wide ? `1px solid ${t.border}` : void 0,
9384
- borderTop: wide ? void 0 : `1px solid ${t.border}`,
9385
- padding: wide ? "24px 20px 0" : "16px 16px 0",
9524
+ flex: "1 1 auto",
9525
+ minWidth: 0,
9526
+ padding: wide ? "24px 28px" : "20px",
9386
9527
  boxSizing: "border-box",
9528
+ overflowY: split ? "auto" : void 0,
9387
9529
  display: "flex",
9388
9530
  flexDirection: "column",
9389
- minHeight: 0
9531
+ gap: 16
9390
9532
  },
9391
9533
  children: [
9392
- /* @__PURE__ */ jsxs6("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 14 }, children: [
9393
- /* @__PURE__ */ jsx6("div", { style: { fontSize: 16, fontWeight: 600, whiteSpace: "nowrap" }, children: day ? /* @__PURE__ */ jsxs6(Fragment5, { children: [
9394
- new Date(keyToUtc(day)).toLocaleDateString("en-US", { weekday: "short", timeZone: "UTC" }),
9395
- " ",
9396
- /* @__PURE__ */ jsx6("span", { style: { fontWeight: 500, ...muted }, children: ordinal(Number(day.slice(8))) })
9397
- ] }) : /* @__PURE__ */ jsx6("span", { style: { fontWeight: 500, ...muted }, children: "Times" }) }),
9398
- /* @__PURE__ */ jsx6(
9399
- "div",
9400
- {
9401
- role: "group",
9402
- "aria-label": "Clock format",
9403
- style: { display: "flex", padding: 3, borderRadius: 8, background: t.open, flex: "0 0 auto" },
9404
- children: [true, false].map((h12) => /* @__PURE__ */ jsx6(
9405
- "button",
9406
- {
9407
- type: "button",
9408
- "aria-pressed": twelve === h12,
9409
- onClick: () => setTwelve(h12),
9410
- style: {
9411
- border: 0,
9412
- borderRadius: 6,
9413
- padding: "4px 9px",
9414
- fontFamily: "inherit",
9415
- fontSize: 13,
9416
- fontWeight: 500,
9417
- cursor: "pointer",
9418
- background: twelve === h12 ? t.bg : "transparent",
9419
- color: twelve === h12 ? t.text : t.muted,
9420
- boxShadow: twelve === h12 ? "0 1px 2px rgba(0,0,0,.12)" : "none"
9421
- },
9422
- children: h12 ? "12h" : "24h"
9423
- },
9424
- String(h12)
9425
- ))
9426
- }
9427
- )
9428
- ] }),
9429
- /* @__PURE__ */ jsxs6(
9430
- "div",
9534
+ /* @__PURE__ */ jsx6(
9535
+ Field,
9431
9536
  {
9432
- style: {
9433
- overflowY: wide ? "auto" : void 0,
9434
- flex: "1 1 auto",
9435
- minHeight: 0,
9436
- paddingBottom: 20,
9437
- display: wide ? "flex" : "grid",
9438
- flexDirection: "column",
9439
- gridTemplateColumns: "repeat(auto-fill, minmax(96px, 1fr))",
9440
- gap: 8
9537
+ t,
9538
+ label: "Full name",
9539
+ value: name,
9540
+ onChange: setName,
9541
+ autoComplete: "name",
9542
+ error: tried && nameMissing ? "Add your name" : null
9543
+ }
9544
+ ),
9545
+ /* @__PURE__ */ jsx6(
9546
+ PhoneField,
9547
+ {
9548
+ t,
9549
+ dial,
9550
+ national: phone,
9551
+ onChange: (nextDial, national) => {
9552
+ setDial(nextDial);
9553
+ setPhone(national);
9441
9554
  },
9442
- children: [
9443
- error && /* @__PURE__ */ jsx6("div", { style: { color: t.danger, fontSize: 13, lineHeight: 1.5, gridColumn: "1 / -1" }, children: error }),
9444
- !monthLoaded && !error && /* @__PURE__ */ jsx6("div", { style: { fontSize: 13, gridColumn: "1 / -1", ...muted }, children: "Finding times\u2026" }),
9445
- monthLoaded && !error && !day && /* @__PURE__ */ jsx6("div", { style: { fontSize: 13, lineHeight: 1.5, gridColumn: "1 / -1", ...muted }, children: pastHorizon ? "Nothing can be booked this far ahead yet." : "No times left this month. Try the next one." }),
9446
- monthLoaded && daySlots.map((slot) => /* @__PURE__ */ jsx6(
9555
+ onBlur: () => setPhoneTouched(true),
9556
+ error: phoneTouched ? phoneError : null,
9557
+ hint: requireOtp ? "We text a code here to confirm, then a reminder before the call." : "We send a reminder here before the call."
9558
+ }
9559
+ ),
9560
+ /* @__PURE__ */ jsx6(
9561
+ Field,
9562
+ {
9563
+ t,
9564
+ label: "Email",
9565
+ value: email,
9566
+ onChange: setEmail,
9567
+ type: "email",
9568
+ autoComplete: "email",
9569
+ error: tried && emailMissing ? "Add an email \u2014 the invite goes there" : null
9570
+ }
9571
+ ),
9572
+ !pageLoaded && /* @__PURE__ */ jsx6("div", { style: { fontSize: 13, ...muted }, children: "Loading\u2026" }),
9573
+ questions.map((q) => {
9574
+ const gap = tried && unanswered.includes(q);
9575
+ return /* @__PURE__ */ jsxs6("div", { role: "group", "aria-label": q.label, children: [
9576
+ /* @__PURE__ */ jsxs6("div", { style: { fontSize: 13, fontWeight: 500, overflowWrap: "anywhere" }, children: [
9577
+ q.label,
9578
+ !q.required && /* @__PURE__ */ jsx6("span", { style: { fontWeight: 400, ...muted }, children: " (optional)" })
9579
+ ] }),
9580
+ /* @__PURE__ */ jsx6("div", { style: { display: "flex", flexWrap: "wrap", gap: 8, marginTop: 8 }, children: q.options.map((option) => {
9581
+ const on = answers[q.id] === option;
9582
+ return /* @__PURE__ */ jsx6(
9447
9583
  "button",
9448
9584
  {
9449
9585
  type: "button",
9450
- className: "gg-bk-slot",
9451
- onClick: () => {
9452
- setSelected(slot);
9453
- setError(null);
9454
- setStep("details");
9455
- },
9586
+ "aria-pressed": on,
9587
+ className: on ? void 0 : "gg-bk-slot",
9588
+ onClick: () => setAnswers((prev) => {
9589
+ if (on && !q.required) {
9590
+ const rest = { ...prev };
9591
+ delete rest[q.id];
9592
+ return rest;
9593
+ }
9594
+ return { ...prev, [q.id]: option };
9595
+ }),
9456
9596
  style: {
9457
- flex: "0 0 auto",
9458
- padding: "11px 12px",
9597
+ padding: "7px 12px",
9598
+ minHeight: 36,
9459
9599
  borderRadius: 8,
9460
- border: `1px solid ${t.border}`,
9461
- background: t.pane,
9462
- color: t.text,
9600
+ border: `1px solid ${on ? t.ink : gap ? t.danger : t.border}`,
9601
+ background: on ? t.ink : t.pane,
9602
+ color: on ? t.onInk : t.text,
9463
9603
  fontFamily: "inherit",
9464
9604
  fontSize: 14,
9465
9605
  fontWeight: 500,
9466
9606
  cursor: "pointer",
9467
- textAlign: "center"
9607
+ overflowWrap: "anywhere",
9608
+ textAlign: "left"
9468
9609
  },
9469
- children: formatTime(slot.startsAt, zone, twelve)
9610
+ children: option
9470
9611
  },
9471
- slot.startsAt
9472
- ))
9473
- ]
9474
- }
9475
- )
9612
+ option
9613
+ );
9614
+ }) }),
9615
+ gap && /* @__PURE__ */ jsx6("div", { role: "alert", style: { marginTop: 6, fontSize: 12, fontWeight: 500, color: t.danger }, children: "Pick one" })
9616
+ ] }, q.id);
9617
+ })
9476
9618
  ]
9477
9619
  }
9478
9620
  );
9479
- const loading = /* @__PURE__ */ jsx6(
9621
+ const pickedLabel = selected ? `${new Date(selected.startsAt).toLocaleDateString("en-US", {
9622
+ weekday: "short",
9623
+ month: "short",
9624
+ day: "numeric",
9625
+ timeZone: zone
9626
+ })} \xB7 ${formatTime(selected.startsAt, zone, twelve)} \u2013 ${selectedEnd && formatTime(selectedEnd, zone, twelve)}` : null;
9627
+ const footer = /* @__PURE__ */ jsxs6(
9480
9628
  "div",
9481
9629
  {
9482
9630
  style: {
9483
- flex: "1 1 auto",
9484
- minHeight: wide ? void 0 : 200,
9631
+ borderTop: `1px solid ${t.border}`,
9632
+ padding: wide ? "14px 28px" : "14px 16px",
9485
9633
  display: "flex",
9634
+ flexWrap: "wrap",
9486
9635
  alignItems: "center",
9487
- justifyContent: "center",
9488
- fontSize: 13,
9489
- ...muted
9490
- },
9491
- children: "Loading\u2026"
9492
- }
9493
- );
9494
- const ask = /* @__PURE__ */ jsx6(
9495
- "div",
9496
- {
9497
- style: {
9498
- flex: "1 1 auto",
9499
- minWidth: 0,
9500
- padding: wide ? "28px 32px" : "20px",
9501
- boxSizing: "border-box",
9502
- overflowY: wide ? "auto" : void 0
9636
+ justifyContent: "space-between",
9637
+ gap: "10px 16px",
9638
+ background: t.bg,
9639
+ // Stacked, the dialog scrolls as one page; the button stays in reach.
9640
+ position: wide ? void 0 : "sticky",
9641
+ // Past the overlay's 12px padding, so nothing shows under the bar.
9642
+ bottom: wide ? void 0 : -12
9503
9643
  },
9504
- children: /* @__PURE__ */ jsxs6("div", { style: { maxWidth: 520, display: "flex", flexDirection: "column", gap: 22 }, children: [
9505
- /* @__PURE__ */ jsxs6("div", { children: [
9506
- /* @__PURE__ */ jsx6("div", { style: { fontSize: 16, fontWeight: 600 }, children: questions.length === 1 ? "One question first" : "A few questions first" }),
9507
- /* @__PURE__ */ jsx6("div", { style: { fontSize: 13, lineHeight: 1.5, marginTop: 4, ...muted }, children: "So the right person takes your demo." })
9508
- ] }),
9509
- questions.map((q) => /* @__PURE__ */ jsxs6("div", { role: "group", "aria-label": q.label, children: [
9510
- /* @__PURE__ */ jsxs6("div", { style: { fontSize: 14, fontWeight: 500, overflowWrap: "anywhere" }, children: [
9511
- q.label,
9512
- !q.required && /* @__PURE__ */ jsx6("span", { style: { fontWeight: 400, ...muted }, children: " (optional)" })
9644
+ children: [
9645
+ /* @__PURE__ */ jsx6("div", { style: { flex: "1 1 240px", minWidth: 0, fontSize: 13, lineHeight: 1.5 }, children: error ? /* @__PURE__ */ jsx6("div", { role: "alert", style: { color: t.danger }, children: error }) : previewEnded ? /* @__PURE__ */ jsx6("div", { style: muted, children: "End of the preview \u2014 a prospect would be booked here. Nothing was booked and no code was sent." }) : /* @__PURE__ */ jsxs6(Fragment5, { children: [
9646
+ pickedLabel ? /* @__PURE__ */ jsx6("div", { style: { fontWeight: 600 }, children: pickedLabel }) : !tried && /* @__PURE__ */ jsxs6("div", { style: muted, children: [
9647
+ "Pick a day and a time ",
9648
+ split ? "on the right" : "below",
9649
+ "."
9513
9650
  ] }),
9514
- /* @__PURE__ */ jsx6("div", { style: { display: "flex", flexWrap: "wrap", gap: 8, marginTop: 10 }, children: q.options.map((option) => {
9515
- const on = answers[q.id] === option;
9516
- return /* @__PURE__ */ jsx6(
9517
- "button",
9518
- {
9519
- type: "button",
9520
- "aria-pressed": on,
9521
- className: on ? void 0 : "gg-bk-slot",
9522
- onClick: () => setAnswers((prev) => {
9523
- if (on && !q.required) {
9524
- const rest = { ...prev };
9525
- delete rest[q.id];
9526
- return rest;
9527
- }
9528
- return { ...prev, [q.id]: option };
9529
- }),
9530
- style: {
9531
- padding: "9px 14px",
9532
- minHeight: 40,
9533
- borderRadius: 8,
9534
- border: `1px solid ${on ? t.ink : t.border}`,
9535
- background: on ? t.ink : t.pane,
9536
- color: on ? t.onInk : t.text,
9537
- fontFamily: "inherit",
9538
- fontSize: 14,
9539
- fontWeight: 500,
9540
- cursor: "pointer",
9541
- overflowWrap: "anywhere",
9542
- textAlign: "left"
9543
- },
9544
- children: option
9545
- },
9546
- option
9547
- );
9548
- }) })
9549
- ] }, q.id)),
9550
- /* @__PURE__ */ jsxs6("div", { style: { display: "flex", flexWrap: "wrap", alignItems: "center", gap: "8px 12px", marginTop: 2 }, children: [
9551
- /* @__PURE__ */ jsx6(
9552
- "button",
9553
- {
9554
- type: "button",
9555
- onClick: () => setAsked(true),
9556
- disabled: !canContinue,
9557
- style: { ...primaryStyle(t, !canContinue), whiteSpace: "nowrap" },
9558
- children: "See available times"
9559
- }
9560
- ),
9561
- !canContinue && /* @__PURE__ */ jsx6("span", { style: { fontSize: 12, ...muted }, children: "Pick one for each to continue" })
9562
- ] })
9563
- ] })
9651
+ tried && missing.length > 0 && /* @__PURE__ */ jsxs6("div", { role: "alert", style: { color: t.danger }, children: [
9652
+ "Still needed: ",
9653
+ missing.join(", ")
9654
+ ] })
9655
+ ] }) }),
9656
+ /* @__PURE__ */ jsx6(
9657
+ "button",
9658
+ {
9659
+ type: "button",
9660
+ onClick: startBooking,
9661
+ disabled: busy,
9662
+ "aria-disabled": missing.length > 0,
9663
+ style: { ...primaryStyle(t, busy || missing.length > 0), cursor: busy ? "default" : "pointer", whiteSpace: "nowrap" },
9664
+ children: requireOtp ? busy ? "Sending code\u2026" : "Send verification code" : busy ? "Booking\u2026" : "Book demo"
9665
+ }
9666
+ )
9667
+ ]
9564
9668
  }
9565
9669
  );
9566
9670
  const form = /* @__PURE__ */ jsx6(
@@ -9575,54 +9679,15 @@ function BookingDialog({
9575
9679
  },
9576
9680
  children: /* @__PURE__ */ jsxs6("div", { style: { maxWidth: 440, display: "flex", flexDirection: "column", gap: 14 }, children: [
9577
9681
  error && /* @__PURE__ */ jsx6("div", { style: { color: t.danger, fontSize: 13, lineHeight: 1.5 }, children: error }),
9578
- previewEnded && /* @__PURE__ */ jsx6("div", { style: { fontSize: 13, lineHeight: 1.5, ...muted }, children: "End of the preview \u2014 a prospect would be booked here. Nothing was booked and no code was sent." }),
9579
- step === "details" && /* @__PURE__ */ jsxs6(Fragment5, { children: [
9580
- /* @__PURE__ */ jsx6(Field, { t, label: "Your name", value: name, onChange: setName, autoComplete: "name" }),
9581
- /* @__PURE__ */ jsx6(Field, { t, label: "Email", value: email, onChange: setEmail, type: "email", autoComplete: "email" }),
9582
- /* @__PURE__ */ jsx6(
9583
- PhoneField,
9584
- {
9585
- t,
9586
- dial,
9587
- national: phone,
9588
- onChange: (nextDial, national) => {
9589
- setDial(nextDial);
9590
- setPhone(national);
9591
- },
9592
- onBlur: () => setPhoneTouched(true),
9593
- error: phoneTouched ? phoneError : null,
9594
- hint: requireOtp ? "We send a code here to confirm, then a reminder before the call." : "We send a reminder here before the call."
9595
- }
9596
- ),
9597
- /* @__PURE__ */ jsx6(Field, { t, label: "Anything we should know? (optional)", value: note, onChange: setNote, multiline: true }),
9598
- /* @__PURE__ */ jsxs6("div", { style: { display: "flex", justifyContent: "flex-end", gap: 8, marginTop: 4 }, children: [
9599
- /* @__PURE__ */ jsx6(
9600
- "button",
9601
- {
9602
- type: "button",
9603
- className: "gg-bk-ghost",
9604
- onClick: () => {
9605
- setError(null);
9606
- setStep("slots");
9607
- },
9608
- style: secondaryStyle(t),
9609
- children: "Back"
9610
- }
9611
- ),
9612
- /* @__PURE__ */ jsx6(
9613
- "button",
9614
- {
9615
- type: "button",
9616
- onClick: startBooking,
9617
- disabled: !canSubmitDetails || busy,
9618
- style: primaryStyle(t, !canSubmitDetails || busy),
9619
- children: requireOtp ? busy ? "Sending code\u2026" : "Send verification code" : busy ? "Booking\u2026" : "Book demo"
9620
- }
9621
- )
9622
- ] })
9623
- ] }),
9624
9682
  step === "code" && /* @__PURE__ */ jsxs6(Fragment5, { children: [
9625
- /* @__PURE__ */ jsx6("div", { style: { fontSize: 14, lineHeight: 1.5, ...muted }, children: "We sent a code to your phone. Your slot is held for 10 minutes." }),
9683
+ /* @__PURE__ */ jsx6("div", { style: { fontSize: 16, fontWeight: 600 }, children: "Verify your mobile" }),
9684
+ /* @__PURE__ */ jsxs6("div", { style: { fontSize: 14, lineHeight: 1.5, ...muted }, children: [
9685
+ "We texted a code to +",
9686
+ dial,
9687
+ " ",
9688
+ phone,
9689
+ ". Your slot is held for 10 minutes."
9690
+ ] }),
9626
9691
  /* @__PURE__ */ jsx6(Field, { t, label: "Code", value: code, onChange: setCode, autoComplete: "one-time-code", inputMode: "numeric" }),
9627
9692
  /* @__PURE__ */ jsx6("div", { style: { display: "flex", justifyContent: "flex-end", marginTop: 4 }, children: /* @__PURE__ */ jsx6(
9628
9693
  "button",
@@ -9637,6 +9702,11 @@ function BookingDialog({
9637
9702
  ] }),
9638
9703
  step === "done" && /* @__PURE__ */ jsxs6(Fragment5, { children: [
9639
9704
  /* @__PURE__ */ jsx6("div", { style: { fontSize: 20, fontWeight: 600 }, children: "You're booked." }),
9705
+ pickedLabel && /* @__PURE__ */ jsxs6("div", { style: { display: "flex", flexDirection: "column", gap: 8, fontSize: 14 }, children: [
9706
+ /* @__PURE__ */ jsx6(Row, { icon: "calendar", t, children: pickedLabel }),
9707
+ /* @__PURE__ */ jsx6(Row, { icon: "globe", t, children: zone }),
9708
+ /* @__PURE__ */ jsx6(Row, { icon: "video", t, children: "Google Meet" })
9709
+ ] }),
9640
9710
  /* @__PURE__ */ jsxs6("div", { style: { fontSize: 14, lineHeight: 1.6, ...muted }, children: [
9641
9711
  "A calendar invite is on its way to ",
9642
9712
  email,
@@ -9680,7 +9750,6 @@ function BookingDialog({
9680
9750
  .gg-bk-day:hover { box-shadow: inset 0 0 0 1.5px ${t.ink}; }
9681
9751
  .gg-bk-slot:hover { border-color: ${t.ink} !important; }
9682
9752
  .gg-bk-ghost:hover { background: ${t.open} !important; }
9683
- .gg-bk-link:hover { color: ${t.text} !important; }
9684
9753
  .gg-bk-root button:focus-visible, .gg-bk-root a:focus-visible,
9685
9754
  .gg-bk-root span:has(> select:focus-visible), .gg-bk-root input:focus-visible, .gg-bk-root textarea:focus-visible {
9686
9755
  outline: 2px solid ${t.ink}; outline-offset: 2px;
@@ -9694,10 +9763,11 @@ function BookingDialog({
9694
9763
  "aria-label": page.title,
9695
9764
  className: "gg-bk-root",
9696
9765
  style: {
9697
- width: roomy ? "min(1060px, 100%)" : "min(820px, 100%)",
9698
- // A month grid should not jump in height between months; the form
9699
- // steps are short and would sit in a mostly empty box.
9700
- height: wide && roomy ? "min(640px, calc(100vh - 48px))" : void 0,
9766
+ width: roomy ? "min(1180px, 100%)" : "min(820px, 100%)",
9767
+ // The one screen holds a month grid and a form side by side; a fixed
9768
+ // height keeps it from jumping between months, and each column
9769
+ // scrolls inside it. The code and done steps are short.
9770
+ height: wide && roomy ? "min(720px, calc(100vh - 48px))" : void 0,
9701
9771
  minHeight: wide && !roomy ? 420 : void 0,
9702
9772
  margin: wide ? void 0 : "auto 0",
9703
9773
  display: "flex",
@@ -9707,16 +9777,48 @@ function BookingDialog({
9707
9777
  border: `1px solid ${t.border}`,
9708
9778
  borderRadius: 14,
9709
9779
  boxShadow: "0 24px 64px rgba(0,0,0,.35)",
9710
- overflow: "hidden",
9780
+ // Stacked, the footer sticks to the bottom of the scrolling overlay,
9781
+ // which `overflow: hidden` here would cut off.
9782
+ overflow: wide ? "hidden" : "clip",
9711
9783
  boxSizing: "border-box",
9712
9784
  textAlign: "left",
9713
9785
  lineHeight: 1.4
9714
9786
  },
9715
9787
  children: [
9716
9788
  summary,
9717
- view === "loading" ? loading : view === "questions" ? ask : view === "slots" ? /* @__PURE__ */ jsxs6(Fragment5, { children: [
9718
- calendar,
9719
- times
9789
+ roomy ? /* @__PURE__ */ jsxs6("div", { style: { flex: "1 1 auto", minWidth: 0, display: "flex", flexDirection: "column" }, children: [
9790
+ /* @__PURE__ */ jsxs6(
9791
+ "div",
9792
+ {
9793
+ style: {
9794
+ flex: "1 1 auto",
9795
+ minHeight: 0,
9796
+ display: "flex",
9797
+ flexDirection: split ? "row" : "column",
9798
+ // A tablet-wide dialog stacks the two and scrolls them as one.
9799
+ overflowY: wide && !split ? "auto" : void 0
9800
+ },
9801
+ children: [
9802
+ details,
9803
+ /* @__PURE__ */ jsxs6(
9804
+ "div",
9805
+ {
9806
+ style: {
9807
+ flex: split ? "0 0 420px" : void 0,
9808
+ borderLeft: split ? `1px solid ${t.border}` : void 0,
9809
+ borderTop: split ? void 0 : `1px solid ${t.border}`,
9810
+ overflowY: split ? "auto" : void 0
9811
+ },
9812
+ children: [
9813
+ calendar,
9814
+ times
9815
+ ]
9816
+ }
9817
+ )
9818
+ ]
9819
+ }
9820
+ ),
9821
+ footer
9720
9822
  ] }) : form,
9721
9823
  !wide && credit
9722
9824
  ]
@@ -9740,19 +9842,6 @@ function primaryStyle(t, disabled) {
9740
9842
  cursor: disabled ? "default" : "pointer"
9741
9843
  };
9742
9844
  }
9743
- function secondaryStyle(t) {
9744
- return {
9745
- padding: "10px 16px",
9746
- borderRadius: 8,
9747
- border: 0,
9748
- background: "transparent",
9749
- color: t.text,
9750
- fontFamily: "inherit",
9751
- fontSize: 14,
9752
- fontWeight: 500,
9753
- cursor: "pointer"
9754
- };
9755
- }
9756
9845
  function Row({ icon, t, children }) {
9757
9846
  return /* @__PURE__ */ jsxs6("div", { style: { display: "flex", alignItems: "flex-start", gap: 10, color: t.text, minWidth: 0 }, children: [
9758
9847
  /* @__PURE__ */ jsx6("span", { style: { color: t.muted, flex: "0 0 auto", marginTop: 1 }, children: /* @__PURE__ */ jsx6(Icon, { name: icon }) }),
@@ -9842,40 +9931,38 @@ function Field({
9842
9931
  value,
9843
9932
  onChange,
9844
9933
  type = "text",
9845
- hint,
9846
9934
  autoComplete,
9847
9935
  inputMode,
9848
- multiline
9936
+ error
9849
9937
  }) {
9850
- const inputStyle = {
9851
- display: "block",
9852
- width: "100%",
9853
- boxSizing: "border-box",
9854
- marginTop: 6,
9855
- padding: "9px 12px",
9856
- background: t.input,
9857
- color: t.text,
9858
- border: `1px solid ${t.border}`,
9859
- borderRadius: 8,
9860
- fontFamily: "inherit",
9861
- fontSize: 14,
9862
- outline: "none",
9863
- resize: "vertical"
9864
- };
9865
9938
  return /* @__PURE__ */ jsxs6("label", { style: { display: "block", fontSize: 13, fontWeight: 500, color: t.text }, children: [
9866
9939
  label,
9867
- multiline ? /* @__PURE__ */ jsx6("textarea", { rows: 3, value, onChange: (e) => onChange(e.target.value), style: inputStyle }) : /* @__PURE__ */ jsx6(
9940
+ /* @__PURE__ */ jsx6(
9868
9941
  "input",
9869
9942
  {
9870
9943
  type,
9871
9944
  value,
9872
9945
  autoComplete,
9873
9946
  inputMode,
9947
+ "aria-invalid": Boolean(error),
9874
9948
  onChange: (e) => onChange(e.target.value),
9875
- style: inputStyle
9949
+ style: {
9950
+ display: "block",
9951
+ width: "100%",
9952
+ boxSizing: "border-box",
9953
+ marginTop: 6,
9954
+ padding: "9px 12px",
9955
+ background: t.input,
9956
+ color: t.text,
9957
+ border: `1px solid ${error ? t.danger : t.border}`,
9958
+ borderRadius: 8,
9959
+ fontFamily: "inherit",
9960
+ fontSize: 14,
9961
+ outline: "none"
9962
+ }
9876
9963
  }
9877
9964
  ),
9878
- hint && /* @__PURE__ */ jsx6("div", { style: { marginTop: 6, fontSize: 12, fontWeight: 400, color: t.muted }, children: hint })
9965
+ error && /* @__PURE__ */ jsx6("div", { role: "alert", style: { marginTop: 6, fontSize: 12, fontWeight: 500, color: t.danger }, children: error })
9879
9966
  ] });
9880
9967
  }
9881
9968
  function PhoneField({