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.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,12 @@ 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
+ // The bottom sheet has only a max-height, so a % here resolves
4089
+ // to auto and never scrolls (#596): use the viewport there.
4090
+ ...similarSlot ? { maxHeight: narrow ? "55dvh" : "70%", overflowY: "auto" } : {}
4062
4091
  },
4063
4092
  children: [
4064
4093
  phase === "solved" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
@@ -4138,7 +4167,9 @@ function AssistSheet({
4138
4167
  src: shot,
4139
4168
  alt: read ? "Attached image the assistant reads" : "Attached image",
4140
4169
  "data-gg-assist-thumb": "",
4170
+ onClick: onAnnotateImage ? () => markUp(i, shot) : void 0,
4141
4171
  style: {
4172
+ cursor: onAnnotateImage ? "pointer" : void 0,
4142
4173
  display: "block",
4143
4174
  width: "100%",
4144
4175
  height: "100%",
@@ -4150,6 +4181,59 @@ function AssistSheet({
4150
4181
  }
4151
4182
  }
4152
4183
  ),
4184
+ onAnnotateImage && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4185
+ "button",
4186
+ {
4187
+ type: "button",
4188
+ "data-gg-assist-annotate": "",
4189
+ "aria-label": `Draw on image ${i + 1}`,
4190
+ title: "Draw or circle on this image",
4191
+ onClick: () => markUp(i, shot),
4192
+ style: {
4193
+ position: "absolute",
4194
+ bottom: "-13px",
4195
+ right: "-13px",
4196
+ width: "32px",
4197
+ height: "32px",
4198
+ border: "none",
4199
+ background: "transparent",
4200
+ padding: 0,
4201
+ cursor: "pointer",
4202
+ display: "flex",
4203
+ alignItems: "center",
4204
+ justifyContent: "center",
4205
+ borderRadius: "50%"
4206
+ },
4207
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4208
+ "span",
4209
+ {
4210
+ "aria-hidden": "true",
4211
+ style: {
4212
+ width: "20px",
4213
+ height: "20px",
4214
+ boxSizing: "border-box",
4215
+ borderRadius: "50%",
4216
+ border: `2px solid ${t.bg}`,
4217
+ background: t.accent,
4218
+ color: t.accentText,
4219
+ display: "flex",
4220
+ alignItems: "center",
4221
+ justifyContent: "center"
4222
+ },
4223
+ 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)(
4224
+ "path",
4225
+ {
4226
+ d: "M16.5 3.5a2.12 2.12 0 013 3L7 19l-4 1 1-4L16.5 3.5z",
4227
+ stroke: "currentColor",
4228
+ strokeWidth: "2.6",
4229
+ strokeLinecap: "round",
4230
+ strokeLinejoin: "round"
4231
+ }
4232
+ ) })
4233
+ }
4234
+ )
4235
+ }
4236
+ ),
4153
4237
  onRemoveImage && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4154
4238
  "button",
4155
4239
  {
@@ -6341,6 +6425,10 @@ function ReportDialog({
6341
6425
  setAttachingTo(null);
6342
6426
  }
6343
6427
  };
6428
+ const plainIssueTitle = (title) => (
6429
+ // Only emphasis markers: a lone "_" is part of a name (task_module).
6430
+ title.replace(/(\*\*|__)(?=\S)(.+?)(?<=\S)\1/g, "$2").replace(/[*`]+/g, "").replace(/\s+/g, " ").trim() || title
6431
+ );
6344
6432
  const similarCard = similarIssues ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
6345
6433
  "div",
6346
6434
  {
@@ -6428,10 +6516,7 @@ function ReportDialog({
6428
6516
  fontSize: "12.5px",
6429
6517
  lineHeight: 1.45,
6430
6518
  wordBreak: "break-word",
6431
- overflow: "hidden",
6432
- display: "-webkit-box",
6433
- WebkitLineClamp: 3,
6434
- WebkitBoxOrient: "vertical"
6519
+ overflowWrap: "anywhere"
6435
6520
  },
6436
6521
  children: [
6437
6522
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { style: { color: t.textMuted, fontWeight: 600 }, children: [
@@ -6439,7 +6524,7 @@ function ReportDialog({
6439
6524
  issue.number
6440
6525
  ] }),
6441
6526
  " ",
6442
- issue.title
6527
+ plainIssueTitle(issue.title)
6443
6528
  ]
6444
6529
  }
6445
6530
  ),
@@ -8412,6 +8497,7 @@ function ReportDialog({
8412
8497
  pageShot,
8413
8498
  onAddFiles: addFiles,
8414
8499
  onRemoveImage: (index) => setScreenshots((prev) => prev.filter((_, i) => i !== index)),
8500
+ onAnnotateImage: setAnnotatingIndex,
8415
8501
  files: heldFiles,
8416
8502
  canReadPdf: !!readFile,
8417
8503
  onRemoveFile: (index) => setAttachments((prev) => prev.filter((_, i) => i !== index)),
@@ -8722,6 +8808,7 @@ var WEEKDAYS = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
8722
8808
  var DAY_MS = 864e5;
8723
8809
  var ZONE_PAD_MS = 14 * 36e5;
8724
8810
  var WIDE_QUERY = "(min-width: 900px)";
8811
+ var SPLIT_QUERY = "(min-width: 1120px)";
8725
8812
  function localZone() {
8726
8813
  try {
8727
8814
  return Intl.DateTimeFormat().resolvedOptions().timeZone;
@@ -8828,13 +8915,14 @@ function BookingDialog({
8828
8915
  }) {
8829
8916
  var _a, _b, _c, _d, _e;
8830
8917
  const wide = useMediaQuery(WIDE_QUERY, true);
8918
+ const split = useMediaQuery(SPLIT_QUERY, true) && wide;
8831
8919
  const t = (0, import_react5.useMemo)(() => {
8832
8920
  if (!open) return LIGHT;
8833
8921
  const base = detectDark() ? DARK : LIGHT;
8834
8922
  const accent = detectHostAccent();
8835
8923
  return accent ? { ...base, ink: accent.accent, onInk: accent.accentText } : base;
8836
8924
  }, [open]);
8837
- const [step, setStep] = (0, import_react5.useState)("slots");
8925
+ const [step, setStep] = (0, import_react5.useState)("pick");
8838
8926
  const [zone, setZone] = (0, import_react5.useState)(localZone);
8839
8927
  const [twelve, setTwelve] = (0, import_react5.useState)(prefers12h);
8840
8928
  const [month, setMonth] = (0, import_react5.useState)(() => dayKeyIn(Date.now(), localZone()).slice(0, 7));
@@ -8849,11 +8937,10 @@ function BookingDialog({
8849
8937
  const [phone, setPhone] = (0, import_react5.useState)("");
8850
8938
  const [dial, setDial] = (0, import_react5.useState)(() => defaultDialForZone(localZone()));
8851
8939
  const [phoneTouched, setPhoneTouched] = (0, import_react5.useState)(false);
8852
- const [note, setNote] = (0, import_react5.useState)("");
8940
+ const [tried, setTried] = (0, import_react5.useState)(false);
8853
8941
  const [questions, setQuestions] = (0, import_react5.useState)([]);
8854
8942
  const [answers, setAnswers] = (0, import_react5.useState)({});
8855
8943
  const [pageLoaded, setPageLoaded] = (0, import_react5.useState)(false);
8856
- const [asked, setAsked] = (0, import_react5.useState)(false);
8857
8944
  const [requireOtp, setRequireOtp] = (0, import_react5.useState)(true);
8858
8945
  const [code, setCode] = (0, import_react5.useState)("");
8859
8946
  const [bookingId, setBookingId] = (0, import_react5.useState)(null);
@@ -8913,7 +9000,7 @@ function BookingDialog({
8913
9000
  (0, import_react5.useEffect)(() => {
8914
9001
  if (!open) return;
8915
9002
  const now = localZone();
8916
- setStep("slots");
9003
+ setStep("pick");
8917
9004
  setZone(now);
8918
9005
  setMonth(dayKeyIn(Date.now(), now).slice(0, 7));
8919
9006
  setSlotsByMonth({});
@@ -8925,7 +9012,7 @@ function BookingDialog({
8925
9012
  setPreviewEnded(false);
8926
9013
  setAvatarFailed(false);
8927
9014
  setPageLoaded(false);
8928
- setAsked(false);
9015
+ setTried(false);
8929
9016
  }, [open]);
8930
9017
  const monthLoaded = month in slotsByMonth;
8931
9018
  (0, import_react5.useEffect)(() => {
@@ -8955,13 +9042,22 @@ function BookingDialog({
8955
9042
  const atFirstMonth = month <= today.slice(0, 7);
8956
9043
  const pastHorizon = monthLoaded && !error && byDay.size === 0 && !atFirstMonth;
8957
9044
  const given = questions.flatMap((q) => q.options.includes(answers[q.id]) ? [{ ...q, answer: answers[q.id] }] : []);
8958
- const canContinue = questions.every((q) => !q.required || q.options.includes(answers[q.id]));
8959
- const view = step !== "slots" ? step : !pageLoaded ? "loading" : questions.length > 0 && !asked ? "questions" : "slots";
8960
- const roomy = step === "slots";
9045
+ const unanswered = questions.filter((q) => q.required && !q.options.includes(answers[q.id]));
9046
+ const phoneError = phoneProblem(dial, phone);
9047
+ const nameMissing = !name.trim();
9048
+ const emailMissing = !email.includes("@");
9049
+ const missing = [
9050
+ ...nameMissing ? ["your name"] : [],
9051
+ ...phoneError ? ["a valid mobile number"] : [],
9052
+ ...emailMissing ? ["your email"] : [],
9053
+ ...unanswered.map((q) => `an answer to \u201C${q.label}\u201D`),
9054
+ ...selected ? [] : ["a day and time"]
9055
+ ];
9056
+ const roomy = step === "pick";
8961
9057
  async function startBooking() {
8962
9058
  var _a2, _b2, _c2;
8963
- if (!selected) return;
8964
- if (phoneError) {
9059
+ if (missing.length > 0 || !selected) {
9060
+ setTried(true);
8965
9061
  setPhoneTouched(true);
8966
9062
  return;
8967
9063
  }
@@ -8979,7 +9075,6 @@ function BookingDialog({
8979
9075
  name,
8980
9076
  email,
8981
9077
  phone: toE164(dial, phone),
8982
- note,
8983
9078
  answers: Object.fromEntries(given.map((q) => [q.id, q.answer])),
8984
9079
  startsAt: selected.startsAt,
8985
9080
  // The zone the times were shown in, which is the one the visitor chose.
@@ -9041,8 +9136,6 @@ function BookingDialog({
9041
9136
  setBusy(false);
9042
9137
  }
9043
9138
  }
9044
- const phoneError = phoneProblem(dial, phone);
9045
- const canSubmitDetails = Boolean(name.trim() && email.includes("@"));
9046
9139
  const selectedEnd = selected ? (_e = selected.endsAt) != null ? _e : new Date(new Date(selected.startsAt).getTime() + page.slotMinutes * 6e4).toISOString() : null;
9047
9140
  const monthDate = new Date(keyToUtc(`${month}-01`));
9048
9141
  const muted = { color: t.muted };
@@ -9200,7 +9293,7 @@ function BookingDialog({
9200
9293
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { fontSize: 20, fontWeight: 600, lineHeight: 1.25, paddingRight: 32, overflowWrap: "anywhere" }, children: page.title }),
9201
9294
  page.description && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { fontSize: 13, lineHeight: 1.5, overflowWrap: "anywhere", ...muted }, children: page.description }),
9202
9295
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 10, marginTop: 4, fontSize: 14 }, children: [
9203
- selected && step !== "slots" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Row, { icon: "calendar", t, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { children: [
9296
+ selected && step !== "pick" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Row, { icon: "calendar", t, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { children: [
9204
9297
  new Date(selected.startsAt).toLocaleDateString("en-US", {
9205
9298
  weekday: "long",
9206
9299
  month: "long",
@@ -9215,33 +9308,7 @@ function BookingDialog({
9215
9308
  selectedEnd && formatTime(selectedEnd, zone, twelve)
9216
9309
  ] })
9217
9310
  ] }) }),
9218
- asked && given.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Row, { icon: "check", t, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { children: [
9219
- given.map((q) => q.answer).join(" \xB7 "),
9220
- view === "slots" && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
9221
- " ",
9222
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9223
- "button",
9224
- {
9225
- type: "button",
9226
- onClick: () => setAsked(false),
9227
- className: "gg-bk-link",
9228
- style: {
9229
- border: 0,
9230
- // Room for a thumb without pushing the rows apart.
9231
- padding: "8px 6px",
9232
- margin: "-8px 0",
9233
- background: "transparent",
9234
- color: t.muted,
9235
- fontFamily: "inherit",
9236
- fontSize: 13,
9237
- textDecoration: "underline",
9238
- cursor: "pointer"
9239
- },
9240
- children: "Change"
9241
- }
9242
- )
9243
- ] })
9244
- ] }) }),
9311
+ step !== "pick" && given.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Row, { icon: "check", t, children: given.map((q) => q.answer).join(" \xB7 ") }),
9245
9312
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Row, { icon: "clock", t, children: formatDuration(page.slotMinutes) }),
9246
9313
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Row, { icon: "video", t, children: "Google Meet" }),
9247
9314
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Row, { icon: "globe", t, children: roomy ? (
@@ -9298,328 +9365,365 @@ function BookingDialog({
9298
9365
  ]
9299
9366
  }
9300
9367
  );
9301
- const calendar = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
9302
- "div",
9303
- {
9304
- style: {
9305
- flex: "1 1 auto",
9306
- minWidth: 0,
9307
- padding: wide ? "24px 24px 20px" : "16px 16px 8px",
9308
- boxSizing: "border-box",
9309
- overflowY: wide ? "auto" : void 0
9310
- },
9311
- children: [
9312
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: 14 }, children: [
9313
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { fontSize: 16, fontWeight: 600 }, children: [
9314
- monthDate.toLocaleDateString("en-US", { month: "long", timeZone: "UTC" }),
9315
- " ",
9316
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { fontWeight: 500, ...muted }, children: monthDate.getUTCFullYear() })
9317
- ] }),
9318
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", gap: 4 }, children: [
9319
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9320
- NavButton,
9321
- {
9322
- t,
9323
- label: "Previous month",
9324
- icon: "left",
9325
- disabled: atFirstMonth,
9326
- onClick: () => setMonth(shiftMonth(month, -1))
9327
- }
9328
- ),
9329
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9330
- NavButton,
9331
- {
9332
- t,
9333
- label: "Next month",
9334
- icon: "right",
9335
- disabled: pastHorizon,
9336
- onClick: () => setMonth(shiftMonth(month, 1))
9337
- }
9338
- )
9339
- ] })
9340
- ] }),
9341
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "repeat(7, minmax(0, 1fr))", gap: wide ? 6 : 4 }, children: [
9342
- WEEKDAYS.map((w) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9343
- "div",
9368
+ const calendar = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { padding: wide ? "22px 20px 12px" : "16px 16px 8px", boxSizing: "border-box" }, children: [
9369
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: 14 }, children: [
9370
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { fontSize: 16, fontWeight: 600 }, children: [
9371
+ monthDate.toLocaleDateString("en-US", { month: "long", timeZone: "UTC" }),
9372
+ " ",
9373
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { fontWeight: 500, ...muted }, children: monthDate.getUTCFullYear() })
9374
+ ] }),
9375
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", gap: 4 }, children: [
9376
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9377
+ NavButton,
9378
+ {
9379
+ t,
9380
+ label: "Previous month",
9381
+ icon: "left",
9382
+ disabled: atFirstMonth,
9383
+ onClick: () => setMonth(shiftMonth(month, -1))
9384
+ }
9385
+ ),
9386
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9387
+ NavButton,
9388
+ {
9389
+ t,
9390
+ label: "Next month",
9391
+ icon: "right",
9392
+ disabled: pastHorizon,
9393
+ onClick: () => setMonth(shiftMonth(month, 1))
9394
+ }
9395
+ )
9396
+ ] })
9397
+ ] }),
9398
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "repeat(7, minmax(0, 1fr))", gap: 4 }, children: [
9399
+ WEEKDAYS.map((w) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9400
+ "div",
9401
+ {
9402
+ style: {
9403
+ textAlign: "center",
9404
+ fontSize: 11,
9405
+ fontWeight: 500,
9406
+ letterSpacing: ".08em",
9407
+ textTransform: "uppercase",
9408
+ padding: "6px 0 8px",
9409
+ color: t.text
9410
+ },
9411
+ children: w
9412
+ },
9413
+ w
9414
+ )),
9415
+ grid.map((key) => {
9416
+ const inMonth = key.startsWith(month);
9417
+ const bookable = byDay.has(key);
9418
+ const isSelected = key === day;
9419
+ const dayNum = Number(key.slice(8));
9420
+ if (!inMonth && !bookable) return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { "aria-hidden": true }, key);
9421
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
9422
+ "button",
9423
+ {
9424
+ type: "button",
9425
+ disabled: !bookable,
9426
+ onClick: () => setPickedDay(key),
9427
+ "aria-pressed": isSelected,
9428
+ "aria-label": new Date(keyToUtc(key)).toLocaleDateString("en-US", {
9429
+ weekday: "long",
9430
+ month: "long",
9431
+ day: "numeric",
9432
+ timeZone: "UTC"
9433
+ }),
9434
+ className: bookable && !isSelected ? "gg-bk-day" : void 0,
9435
+ style: {
9436
+ position: "relative",
9437
+ // Shorter than square: the times sit under the month now, and
9438
+ // both should fit without scrolling on a laptop.
9439
+ aspectRatio: wide ? "5 / 4" : "1 / 1",
9440
+ minHeight: 36,
9441
+ border: 0,
9442
+ borderRadius: 8,
9443
+ padding: 0,
9444
+ fontFamily: "inherit",
9445
+ fontSize: wide ? 15 : 14,
9446
+ fontWeight: bookable ? 600 : 400,
9447
+ cursor: bookable ? "pointer" : "default",
9448
+ background: isSelected ? t.ink : bookable ? t.open : "transparent",
9449
+ color: isSelected ? t.onInk : bookable ? t.text : t.faint,
9450
+ opacity: monthLoaded ? 1 : 0.5
9451
+ },
9452
+ children: [
9453
+ !inMonth && dayNum === 1 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9454
+ "span",
9455
+ {
9456
+ style: {
9457
+ position: "absolute",
9458
+ top: 4,
9459
+ left: 0,
9460
+ right: 0,
9461
+ fontSize: 9,
9462
+ fontWeight: 500,
9463
+ letterSpacing: ".06em",
9464
+ textTransform: "uppercase"
9465
+ },
9466
+ children: new Date(keyToUtc(key)).toLocaleDateString("en-US", { month: "short", timeZone: "UTC" })
9467
+ }
9468
+ ),
9469
+ dayNum,
9470
+ key === today && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9471
+ "span",
9472
+ {
9473
+ "aria-hidden": true,
9474
+ style: {
9475
+ position: "absolute",
9476
+ bottom: 6,
9477
+ left: "50%",
9478
+ width: 4,
9479
+ height: 4,
9480
+ marginLeft: -2,
9481
+ borderRadius: 999,
9482
+ background: isSelected ? t.onInk : t.text
9483
+ }
9484
+ }
9485
+ )
9486
+ ]
9487
+ },
9488
+ key
9489
+ );
9490
+ })
9491
+ ] })
9492
+ ] });
9493
+ const times = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { borderTop: `1px solid ${t.border}`, padding: wide ? "16px 20px 0" : "16px 16px 0", boxSizing: "border-box" }, children: [
9494
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 14 }, children: [
9495
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { fontSize: 16, fontWeight: 600, whiteSpace: "nowrap" }, children: day ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
9496
+ new Date(keyToUtc(day)).toLocaleDateString("en-US", { weekday: "short", timeZone: "UTC" }),
9497
+ " ",
9498
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { fontWeight: 500, ...muted }, children: ordinal(Number(day.slice(8))) })
9499
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { fontWeight: 500, ...muted }, children: "Times" }) }),
9500
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9501
+ "div",
9502
+ {
9503
+ role: "group",
9504
+ "aria-label": "Clock format",
9505
+ style: { display: "flex", padding: 3, borderRadius: 8, background: t.open, flex: "0 0 auto" },
9506
+ children: [true, false].map((h12) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9507
+ "button",
9344
9508
  {
9509
+ type: "button",
9510
+ "aria-pressed": twelve === h12,
9511
+ onClick: () => setTwelve(h12),
9345
9512
  style: {
9346
- textAlign: "center",
9347
- fontSize: 11,
9513
+ border: 0,
9514
+ borderRadius: 6,
9515
+ padding: "4px 9px",
9516
+ fontFamily: "inherit",
9517
+ fontSize: 13,
9348
9518
  fontWeight: 500,
9349
- letterSpacing: ".08em",
9350
- textTransform: "uppercase",
9351
- padding: "6px 0 8px",
9352
- color: t.text
9519
+ cursor: "pointer",
9520
+ background: twelve === h12 ? t.bg : "transparent",
9521
+ color: twelve === h12 ? t.text : t.muted,
9522
+ boxShadow: twelve === h12 ? "0 1px 2px rgba(0,0,0,.12)" : "none"
9353
9523
  },
9354
- children: w
9524
+ children: h12 ? "12h" : "24h"
9355
9525
  },
9356
- w
9357
- )),
9358
- grid.map((key) => {
9359
- const inMonth = key.startsWith(month);
9360
- const bookable = byDay.has(key);
9361
- const isSelected = key === day;
9362
- const dayNum = Number(key.slice(8));
9363
- if (!inMonth && !bookable) return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { "aria-hidden": true }, key);
9364
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
9526
+ String(h12)
9527
+ ))
9528
+ }
9529
+ )
9530
+ ] }),
9531
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
9532
+ "div",
9533
+ {
9534
+ role: "group",
9535
+ "aria-label": "Times",
9536
+ style: {
9537
+ paddingBottom: 20,
9538
+ display: "grid",
9539
+ gridTemplateColumns: "repeat(auto-fill, minmax(84px, 1fr))",
9540
+ gap: 8
9541
+ },
9542
+ children: [
9543
+ error && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { color: t.danger, fontSize: 13, lineHeight: 1.5, gridColumn: "1 / -1" }, children: error }),
9544
+ !monthLoaded && !error && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { fontSize: 13, gridColumn: "1 / -1", ...muted }, children: "Finding times\u2026" }),
9545
+ monthLoaded && !error && !day && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("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." }),
9546
+ monthLoaded && daySlots.map((slot) => {
9547
+ const on = (selected == null ? void 0 : selected.startsAt) === slot.startsAt;
9548
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9365
9549
  "button",
9366
9550
  {
9367
9551
  type: "button",
9368
- disabled: !bookable,
9369
- onClick: () => setPickedDay(key),
9370
- "aria-pressed": isSelected,
9371
- "aria-label": new Date(keyToUtc(key)).toLocaleDateString("en-US", {
9372
- weekday: "long",
9373
- month: "long",
9374
- day: "numeric",
9375
- timeZone: "UTC"
9376
- }),
9377
- className: bookable && !isSelected ? "gg-bk-day" : void 0,
9552
+ "aria-pressed": on,
9553
+ className: on ? void 0 : "gg-bk-slot",
9554
+ onClick: () => {
9555
+ setSelected(slot);
9556
+ setError(null);
9557
+ },
9378
9558
  style: {
9379
- position: "relative",
9380
- aspectRatio: "1 / 1",
9381
- minHeight: 36,
9382
- border: 0,
9559
+ padding: "10px 8px",
9383
9560
  borderRadius: 8,
9384
- padding: 0,
9561
+ border: `1px solid ${on ? t.ink : t.border}`,
9562
+ background: on ? t.ink : t.pane,
9563
+ color: on ? t.onInk : t.text,
9385
9564
  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
9565
+ fontSize: 14,
9566
+ fontWeight: 500,
9567
+ cursor: "pointer",
9568
+ textAlign: "center"
9392
9569
  },
9393
- children: [
9394
- !inMonth && dayNum === 1 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
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__ */ (0, import_jsx_runtime6.jsx)(
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
- ]
9570
+ children: formatTime(slot.startsAt, zone, twelve)
9428
9571
  },
9429
- key
9572
+ slot.startsAt
9430
9573
  );
9431
9574
  })
9432
- ] })
9433
- ]
9434
- }
9435
- );
9436
- const times = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
9575
+ ]
9576
+ }
9577
+ )
9578
+ ] });
9579
+ const details = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
9437
9580
  "div",
9438
9581
  {
9439
9582
  style: {
9440
- width: wide ? 260 : void 0,
9441
- flex: wide ? "0 0 260px" : void 0,
9442
- borderLeft: wide ? `1px solid ${t.border}` : void 0,
9443
- borderTop: wide ? void 0 : `1px solid ${t.border}`,
9444
- padding: wide ? "24px 20px 0" : "16px 16px 0",
9583
+ flex: "1 1 auto",
9584
+ minWidth: 0,
9585
+ padding: wide ? "24px 28px" : "20px",
9445
9586
  boxSizing: "border-box",
9587
+ overflowY: split ? "auto" : void 0,
9446
9588
  display: "flex",
9447
9589
  flexDirection: "column",
9448
- minHeight: 0
9590
+ gap: 16
9449
9591
  },
9450
9592
  children: [
9451
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 14 }, children: [
9452
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { fontSize: 16, fontWeight: 600, whiteSpace: "nowrap" }, children: day ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
9453
- new Date(keyToUtc(day)).toLocaleDateString("en-US", { weekday: "short", timeZone: "UTC" }),
9454
- " ",
9455
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { fontWeight: 500, ...muted }, children: ordinal(Number(day.slice(8))) })
9456
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { fontWeight: 500, ...muted }, children: "Times" }) }),
9457
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9458
- "div",
9459
- {
9460
- role: "group",
9461
- "aria-label": "Clock format",
9462
- style: { display: "flex", padding: 3, borderRadius: 8, background: t.open, flex: "0 0 auto" },
9463
- children: [true, false].map((h12) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9464
- "button",
9465
- {
9466
- type: "button",
9467
- "aria-pressed": twelve === h12,
9468
- onClick: () => setTwelve(h12),
9469
- style: {
9470
- border: 0,
9471
- borderRadius: 6,
9472
- padding: "4px 9px",
9473
- fontFamily: "inherit",
9474
- fontSize: 13,
9475
- fontWeight: 500,
9476
- cursor: "pointer",
9477
- background: twelve === h12 ? t.bg : "transparent",
9478
- color: twelve === h12 ? t.text : t.muted,
9479
- boxShadow: twelve === h12 ? "0 1px 2px rgba(0,0,0,.12)" : "none"
9480
- },
9481
- children: h12 ? "12h" : "24h"
9482
- },
9483
- String(h12)
9484
- ))
9485
- }
9486
- )
9487
- ] }),
9488
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
9489
- "div",
9593
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9594
+ Field,
9490
9595
  {
9491
- style: {
9492
- overflowY: wide ? "auto" : void 0,
9493
- flex: "1 1 auto",
9494
- minHeight: 0,
9495
- paddingBottom: 20,
9496
- display: wide ? "flex" : "grid",
9497
- flexDirection: "column",
9498
- gridTemplateColumns: "repeat(auto-fill, minmax(96px, 1fr))",
9499
- gap: 8
9596
+ t,
9597
+ label: "Full name",
9598
+ value: name,
9599
+ onChange: setName,
9600
+ autoComplete: "name",
9601
+ error: tried && nameMissing ? "Add your name" : null
9602
+ }
9603
+ ),
9604
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9605
+ PhoneField,
9606
+ {
9607
+ t,
9608
+ dial,
9609
+ national: phone,
9610
+ onChange: (nextDial, national) => {
9611
+ setDial(nextDial);
9612
+ setPhone(national);
9500
9613
  },
9501
- children: [
9502
- error && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { color: t.danger, fontSize: 13, lineHeight: 1.5, gridColumn: "1 / -1" }, children: error }),
9503
- !monthLoaded && !error && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { fontSize: 13, gridColumn: "1 / -1", ...muted }, children: "Finding times\u2026" }),
9504
- monthLoaded && !error && !day && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("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." }),
9505
- monthLoaded && daySlots.map((slot) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9614
+ onBlur: () => setPhoneTouched(true),
9615
+ error: phoneTouched ? phoneError : null,
9616
+ hint: requireOtp ? "We text a code here to confirm, then a reminder before the call." : "We send a reminder here before the call."
9617
+ }
9618
+ ),
9619
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9620
+ Field,
9621
+ {
9622
+ t,
9623
+ label: "Email",
9624
+ value: email,
9625
+ onChange: setEmail,
9626
+ type: "email",
9627
+ autoComplete: "email",
9628
+ error: tried && emailMissing ? "Add an email \u2014 the invite goes there" : null
9629
+ }
9630
+ ),
9631
+ !pageLoaded && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { fontSize: 13, ...muted }, children: "Loading\u2026" }),
9632
+ questions.map((q) => {
9633
+ const gap = tried && unanswered.includes(q);
9634
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { role: "group", "aria-label": q.label, children: [
9635
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { fontSize: 13, fontWeight: 500, overflowWrap: "anywhere" }, children: [
9636
+ q.label,
9637
+ !q.required && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { fontWeight: 400, ...muted }, children: " (optional)" })
9638
+ ] }),
9639
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: 8, marginTop: 8 }, children: q.options.map((option) => {
9640
+ const on = answers[q.id] === option;
9641
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9506
9642
  "button",
9507
9643
  {
9508
9644
  type: "button",
9509
- className: "gg-bk-slot",
9510
- onClick: () => {
9511
- setSelected(slot);
9512
- setError(null);
9513
- setStep("details");
9514
- },
9645
+ "aria-pressed": on,
9646
+ className: on ? void 0 : "gg-bk-slot",
9647
+ onClick: () => setAnswers((prev) => {
9648
+ if (on && !q.required) {
9649
+ const rest = { ...prev };
9650
+ delete rest[q.id];
9651
+ return rest;
9652
+ }
9653
+ return { ...prev, [q.id]: option };
9654
+ }),
9515
9655
  style: {
9516
- flex: "0 0 auto",
9517
- padding: "11px 12px",
9656
+ padding: "7px 12px",
9657
+ minHeight: 36,
9518
9658
  borderRadius: 8,
9519
- border: `1px solid ${t.border}`,
9520
- background: t.pane,
9521
- color: t.text,
9659
+ border: `1px solid ${on ? t.ink : gap ? t.danger : t.border}`,
9660
+ background: on ? t.ink : t.pane,
9661
+ color: on ? t.onInk : t.text,
9522
9662
  fontFamily: "inherit",
9523
9663
  fontSize: 14,
9524
9664
  fontWeight: 500,
9525
9665
  cursor: "pointer",
9526
- textAlign: "center"
9666
+ overflowWrap: "anywhere",
9667
+ textAlign: "left"
9527
9668
  },
9528
- children: formatTime(slot.startsAt, zone, twelve)
9669
+ children: option
9529
9670
  },
9530
- slot.startsAt
9531
- ))
9532
- ]
9533
- }
9534
- )
9671
+ option
9672
+ );
9673
+ }) }),
9674
+ gap && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { role: "alert", style: { marginTop: 6, fontSize: 12, fontWeight: 500, color: t.danger }, children: "Pick one" })
9675
+ ] }, q.id);
9676
+ })
9535
9677
  ]
9536
9678
  }
9537
9679
  );
9538
- const loading = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9680
+ const pickedLabel = selected ? `${new Date(selected.startsAt).toLocaleDateString("en-US", {
9681
+ weekday: "short",
9682
+ month: "short",
9683
+ day: "numeric",
9684
+ timeZone: zone
9685
+ })} \xB7 ${formatTime(selected.startsAt, zone, twelve)} \u2013 ${selectedEnd && formatTime(selectedEnd, zone, twelve)}` : null;
9686
+ const footer = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
9539
9687
  "div",
9540
9688
  {
9541
9689
  style: {
9542
- flex: "1 1 auto",
9543
- minHeight: wide ? void 0 : 200,
9690
+ borderTop: `1px solid ${t.border}`,
9691
+ padding: wide ? "14px 28px" : "14px 16px",
9544
9692
  display: "flex",
9693
+ flexWrap: "wrap",
9545
9694
  alignItems: "center",
9546
- justifyContent: "center",
9547
- fontSize: 13,
9548
- ...muted
9549
- },
9550
- children: "Loading\u2026"
9551
- }
9552
- );
9553
- const ask = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9554
- "div",
9555
- {
9556
- style: {
9557
- flex: "1 1 auto",
9558
- minWidth: 0,
9559
- padding: wide ? "28px 32px" : "20px",
9560
- boxSizing: "border-box",
9561
- overflowY: wide ? "auto" : void 0
9695
+ justifyContent: "space-between",
9696
+ gap: "10px 16px",
9697
+ background: t.bg,
9698
+ // Stacked, the dialog scrolls as one page; the button stays in reach.
9699
+ position: wide ? void 0 : "sticky",
9700
+ // Past the overlay's 12px padding, so nothing shows under the bar.
9701
+ bottom: wide ? void 0 : -12
9562
9702
  },
9563
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { maxWidth: 520, display: "flex", flexDirection: "column", gap: 22 }, children: [
9564
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
9565
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { fontSize: 16, fontWeight: 600 }, children: questions.length === 1 ? "One question first" : "A few questions first" }),
9566
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { fontSize: 13, lineHeight: 1.5, marginTop: 4, ...muted }, children: "So the right person takes your demo." })
9567
- ] }),
9568
- questions.map((q) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { role: "group", "aria-label": q.label, children: [
9569
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { fontSize: 14, fontWeight: 500, overflowWrap: "anywhere" }, children: [
9570
- q.label,
9571
- !q.required && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { fontWeight: 400, ...muted }, children: " (optional)" })
9703
+ children: [
9704
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { flex: "1 1 240px", minWidth: 0, fontSize: 13, lineHeight: 1.5 }, children: error ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { role: "alert", style: { color: t.danger }, children: error }) : previewEnded ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: muted, children: "End of the preview \u2014 a prospect would be booked here. Nothing was booked and no code was sent." }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
9705
+ pickedLabel ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { fontWeight: 600 }, children: pickedLabel }) : !tried && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: muted, children: [
9706
+ "Pick a day and a time ",
9707
+ split ? "on the right" : "below",
9708
+ "."
9572
9709
  ] }),
9573
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: 8, marginTop: 10 }, children: q.options.map((option) => {
9574
- const on = answers[q.id] === option;
9575
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9576
- "button",
9577
- {
9578
- type: "button",
9579
- "aria-pressed": on,
9580
- className: on ? void 0 : "gg-bk-slot",
9581
- onClick: () => setAnswers((prev) => {
9582
- if (on && !q.required) {
9583
- const rest = { ...prev };
9584
- delete rest[q.id];
9585
- return rest;
9586
- }
9587
- return { ...prev, [q.id]: option };
9588
- }),
9589
- style: {
9590
- padding: "9px 14px",
9591
- minHeight: 40,
9592
- borderRadius: 8,
9593
- border: `1px solid ${on ? t.ink : t.border}`,
9594
- background: on ? t.ink : t.pane,
9595
- color: on ? t.onInk : t.text,
9596
- fontFamily: "inherit",
9597
- fontSize: 14,
9598
- fontWeight: 500,
9599
- cursor: "pointer",
9600
- overflowWrap: "anywhere",
9601
- textAlign: "left"
9602
- },
9603
- children: option
9604
- },
9605
- option
9606
- );
9607
- }) })
9608
- ] }, q.id)),
9609
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", flexWrap: "wrap", alignItems: "center", gap: "8px 12px", marginTop: 2 }, children: [
9610
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9611
- "button",
9612
- {
9613
- type: "button",
9614
- onClick: () => setAsked(true),
9615
- disabled: !canContinue,
9616
- style: { ...primaryStyle(t, !canContinue), whiteSpace: "nowrap" },
9617
- children: "See available times"
9618
- }
9619
- ),
9620
- !canContinue && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { fontSize: 12, ...muted }, children: "Pick one for each to continue" })
9621
- ] })
9622
- ] })
9710
+ tried && missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { role: "alert", style: { color: t.danger }, children: [
9711
+ "Still needed: ",
9712
+ missing.join(", ")
9713
+ ] })
9714
+ ] }) }),
9715
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9716
+ "button",
9717
+ {
9718
+ type: "button",
9719
+ onClick: startBooking,
9720
+ disabled: busy,
9721
+ "aria-disabled": missing.length > 0,
9722
+ style: { ...primaryStyle(t, busy || missing.length > 0), cursor: busy ? "default" : "pointer", whiteSpace: "nowrap" },
9723
+ children: requireOtp ? busy ? "Sending code\u2026" : "Send verification code" : busy ? "Booking\u2026" : "Book demo"
9724
+ }
9725
+ )
9726
+ ]
9623
9727
  }
9624
9728
  );
9625
9729
  const form = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
@@ -9634,54 +9738,15 @@ function BookingDialog({
9634
9738
  },
9635
9739
  children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { maxWidth: 440, display: "flex", flexDirection: "column", gap: 14 }, children: [
9636
9740
  error && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { color: t.danger, fontSize: 13, lineHeight: 1.5 }, children: error }),
9637
- previewEnded && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("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." }),
9638
- step === "details" && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
9639
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Field, { t, label: "Your name", value: name, onChange: setName, autoComplete: "name" }),
9640
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Field, { t, label: "Email", value: email, onChange: setEmail, type: "email", autoComplete: "email" }),
9641
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9642
- PhoneField,
9643
- {
9644
- t,
9645
- dial,
9646
- national: phone,
9647
- onChange: (nextDial, national) => {
9648
- setDial(nextDial);
9649
- setPhone(national);
9650
- },
9651
- onBlur: () => setPhoneTouched(true),
9652
- error: phoneTouched ? phoneError : null,
9653
- hint: requireOtp ? "We send a code here to confirm, then a reminder before the call." : "We send a reminder here before the call."
9654
- }
9655
- ),
9656
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Field, { t, label: "Anything we should know? (optional)", value: note, onChange: setNote, multiline: true }),
9657
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", justifyContent: "flex-end", gap: 8, marginTop: 4 }, children: [
9658
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9659
- "button",
9660
- {
9661
- type: "button",
9662
- className: "gg-bk-ghost",
9663
- onClick: () => {
9664
- setError(null);
9665
- setStep("slots");
9666
- },
9667
- style: secondaryStyle(t),
9668
- children: "Back"
9669
- }
9670
- ),
9671
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9672
- "button",
9673
- {
9674
- type: "button",
9675
- onClick: startBooking,
9676
- disabled: !canSubmitDetails || busy,
9677
- style: primaryStyle(t, !canSubmitDetails || busy),
9678
- children: requireOtp ? busy ? "Sending code\u2026" : "Send verification code" : busy ? "Booking\u2026" : "Book demo"
9679
- }
9680
- )
9681
- ] })
9682
- ] }),
9683
9741
  step === "code" && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
9684
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { fontSize: 14, lineHeight: 1.5, ...muted }, children: "We sent a code to your phone. Your slot is held for 10 minutes." }),
9742
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { fontSize: 16, fontWeight: 600 }, children: "Verify your mobile" }),
9743
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { fontSize: 14, lineHeight: 1.5, ...muted }, children: [
9744
+ "We texted a code to +",
9745
+ dial,
9746
+ " ",
9747
+ phone,
9748
+ ". Your slot is held for 10 minutes."
9749
+ ] }),
9685
9750
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Field, { t, label: "Code", value: code, onChange: setCode, autoComplete: "one-time-code", inputMode: "numeric" }),
9686
9751
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { display: "flex", justifyContent: "flex-end", marginTop: 4 }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9687
9752
  "button",
@@ -9696,6 +9761,11 @@ function BookingDialog({
9696
9761
  ] }),
9697
9762
  step === "done" && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
9698
9763
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { fontSize: 20, fontWeight: 600 }, children: "You're booked." }),
9764
+ pickedLabel && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 8, fontSize: 14 }, children: [
9765
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Row, { icon: "calendar", t, children: pickedLabel }),
9766
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Row, { icon: "globe", t, children: zone }),
9767
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Row, { icon: "video", t, children: "Google Meet" })
9768
+ ] }),
9699
9769
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { fontSize: 14, lineHeight: 1.6, ...muted }, children: [
9700
9770
  "A calendar invite is on its way to ",
9701
9771
  email,
@@ -9739,7 +9809,6 @@ function BookingDialog({
9739
9809
  .gg-bk-day:hover { box-shadow: inset 0 0 0 1.5px ${t.ink}; }
9740
9810
  .gg-bk-slot:hover { border-color: ${t.ink} !important; }
9741
9811
  .gg-bk-ghost:hover { background: ${t.open} !important; }
9742
- .gg-bk-link:hover { color: ${t.text} !important; }
9743
9812
  .gg-bk-root button:focus-visible, .gg-bk-root a:focus-visible,
9744
9813
  .gg-bk-root span:has(> select:focus-visible), .gg-bk-root input:focus-visible, .gg-bk-root textarea:focus-visible {
9745
9814
  outline: 2px solid ${t.ink}; outline-offset: 2px;
@@ -9753,10 +9822,11 @@ function BookingDialog({
9753
9822
  "aria-label": page.title,
9754
9823
  className: "gg-bk-root",
9755
9824
  style: {
9756
- width: roomy ? "min(1060px, 100%)" : "min(820px, 100%)",
9757
- // A month grid should not jump in height between months; the form
9758
- // steps are short and would sit in a mostly empty box.
9759
- height: wide && roomy ? "min(640px, calc(100vh - 48px))" : void 0,
9825
+ width: roomy ? "min(1180px, 100%)" : "min(820px, 100%)",
9826
+ // The one screen holds a month grid and a form side by side; a fixed
9827
+ // height keeps it from jumping between months, and each column
9828
+ // scrolls inside it. The code and done steps are short.
9829
+ height: wide && roomy ? "min(720px, calc(100vh - 48px))" : void 0,
9760
9830
  minHeight: wide && !roomy ? 420 : void 0,
9761
9831
  margin: wide ? void 0 : "auto 0",
9762
9832
  display: "flex",
@@ -9766,16 +9836,48 @@ function BookingDialog({
9766
9836
  border: `1px solid ${t.border}`,
9767
9837
  borderRadius: 14,
9768
9838
  boxShadow: "0 24px 64px rgba(0,0,0,.35)",
9769
- overflow: "hidden",
9839
+ // Stacked, the footer sticks to the bottom of the scrolling overlay,
9840
+ // which `overflow: hidden` here would cut off.
9841
+ overflow: wide ? "hidden" : "clip",
9770
9842
  boxSizing: "border-box",
9771
9843
  textAlign: "left",
9772
9844
  lineHeight: 1.4
9773
9845
  },
9774
9846
  children: [
9775
9847
  summary,
9776
- view === "loading" ? loading : view === "questions" ? ask : view === "slots" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
9777
- calendar,
9778
- times
9848
+ roomy ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { flex: "1 1 auto", minWidth: 0, display: "flex", flexDirection: "column" }, children: [
9849
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
9850
+ "div",
9851
+ {
9852
+ style: {
9853
+ flex: "1 1 auto",
9854
+ minHeight: 0,
9855
+ display: "flex",
9856
+ flexDirection: split ? "row" : "column",
9857
+ // A tablet-wide dialog stacks the two and scrolls them as one.
9858
+ overflowY: wide && !split ? "auto" : void 0
9859
+ },
9860
+ children: [
9861
+ details,
9862
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
9863
+ "div",
9864
+ {
9865
+ style: {
9866
+ flex: split ? "0 0 420px" : void 0,
9867
+ borderLeft: split ? `1px solid ${t.border}` : void 0,
9868
+ borderTop: split ? void 0 : `1px solid ${t.border}`,
9869
+ overflowY: split ? "auto" : void 0
9870
+ },
9871
+ children: [
9872
+ calendar,
9873
+ times
9874
+ ]
9875
+ }
9876
+ )
9877
+ ]
9878
+ }
9879
+ ),
9880
+ footer
9779
9881
  ] }) : form,
9780
9882
  !wide && credit
9781
9883
  ]
@@ -9799,19 +9901,6 @@ function primaryStyle(t, disabled) {
9799
9901
  cursor: disabled ? "default" : "pointer"
9800
9902
  };
9801
9903
  }
9802
- function secondaryStyle(t) {
9803
- return {
9804
- padding: "10px 16px",
9805
- borderRadius: 8,
9806
- border: 0,
9807
- background: "transparent",
9808
- color: t.text,
9809
- fontFamily: "inherit",
9810
- fontSize: 14,
9811
- fontWeight: 500,
9812
- cursor: "pointer"
9813
- };
9814
- }
9815
9904
  function Row({ icon, t, children }) {
9816
9905
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", alignItems: "flex-start", gap: 10, color: t.text, minWidth: 0 }, children: [
9817
9906
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { color: t.muted, flex: "0 0 auto", marginTop: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { name: icon }) }),
@@ -9901,40 +9990,38 @@ function Field({
9901
9990
  value,
9902
9991
  onChange,
9903
9992
  type = "text",
9904
- hint,
9905
9993
  autoComplete,
9906
9994
  inputMode,
9907
- multiline
9995
+ error
9908
9996
  }) {
9909
- const inputStyle = {
9910
- display: "block",
9911
- width: "100%",
9912
- boxSizing: "border-box",
9913
- marginTop: 6,
9914
- padding: "9px 12px",
9915
- background: t.input,
9916
- color: t.text,
9917
- border: `1px solid ${t.border}`,
9918
- borderRadius: 8,
9919
- fontFamily: "inherit",
9920
- fontSize: 14,
9921
- outline: "none",
9922
- resize: "vertical"
9923
- };
9924
9997
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { style: { display: "block", fontSize: 13, fontWeight: 500, color: t.text }, children: [
9925
9998
  label,
9926
- multiline ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("textarea", { rows: 3, value, onChange: (e) => onChange(e.target.value), style: inputStyle }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9999
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9927
10000
  "input",
9928
10001
  {
9929
10002
  type,
9930
10003
  value,
9931
10004
  autoComplete,
9932
10005
  inputMode,
10006
+ "aria-invalid": Boolean(error),
9933
10007
  onChange: (e) => onChange(e.target.value),
9934
- style: inputStyle
10008
+ style: {
10009
+ display: "block",
10010
+ width: "100%",
10011
+ boxSizing: "border-box",
10012
+ marginTop: 6,
10013
+ padding: "9px 12px",
10014
+ background: t.input,
10015
+ color: t.text,
10016
+ border: `1px solid ${error ? t.danger : t.border}`,
10017
+ borderRadius: 8,
10018
+ fontFamily: "inherit",
10019
+ fontSize: 14,
10020
+ outline: "none"
10021
+ }
9935
10022
  }
9936
10023
  ),
9937
- hint && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { marginTop: 6, fontSize: 12, fontWeight: 400, color: t.muted }, children: hint })
10024
+ error && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { role: "alert", style: { marginTop: 6, fontSize: 12, fontWeight: 500, color: t.danger }, children: error })
9938
10025
  ] });
9939
10026
  }
9940
10027
  function PhoneField({