glitchgrab 1.60.0 → 1.61.1

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
@@ -72,6 +72,61 @@ __export(index_exports, {
72
72
  });
73
73
  module.exports = __toCommonJS(index_exports);
74
74
 
75
+ // src/origin.ts
76
+ var EXTENSION_RE = /\b(?:chrome|safari|moz|edge)-extension:\/\//;
77
+ var FRAME_RE = /^\s*at\s+(?:.*?\s+\()?(.+?):(\d+):(\d+)\)?\s*$/;
78
+ var MAX_FRAMES = 10;
79
+ function sameOriginAs(file, pageOrigin) {
80
+ if (file.startsWith("/")) return true;
81
+ try {
82
+ return new URL(file).origin === pageOrigin;
83
+ } catch (e) {
84
+ return false;
85
+ }
86
+ }
87
+ function parseFrames(stack, pageOrigin) {
88
+ if (!stack) return [];
89
+ const frames = [];
90
+ for (const raw of stack.split("\n")) {
91
+ const m = FRAME_RE.exec(raw);
92
+ if (!m) continue;
93
+ const file = m[1].replace(/^eval at .*?, /, "");
94
+ frames.push({
95
+ file,
96
+ line: Number(m[2]),
97
+ column: Number(m[3]),
98
+ sameOrigin: sameOriginAs(file, pageOrigin)
99
+ });
100
+ if (frames.length >= MAX_FRAMES) break;
101
+ }
102
+ return frames;
103
+ }
104
+ function classifyOrigin(stack, filename, pageOrigin) {
105
+ var _a, _b, _c;
106
+ const frames = parseFrames(stack, pageOrigin);
107
+ const top = (_c = (_b = (_a = frames[0]) == null ? void 0 : _a.file) != null ? _b : filename) != null ? _c : "";
108
+ const hasExtensionFrame = EXTENSION_RE.test(stack != null ? stack : "") || EXTENSION_RE.test(filename != null ? filename : "");
109
+ let origin;
110
+ if (hasExtensionFrame) origin = "extension";
111
+ else if (!top) origin = "unknown";
112
+ else if (top === "<anonymous>" || /\beval\b/.test(top)) origin = "eval";
113
+ else if (/^(?:blob|data):/.test(top)) origin = "injected";
114
+ else if (!sameOriginAs(top, pageOrigin)) origin = "injected";
115
+ else origin = "app";
116
+ return { origin, frames };
117
+ }
118
+ function originMetadata(stack, filename) {
119
+ try {
120
+ const { origin, frames } = classifyOrigin(stack, filename, window.location.origin);
121
+ return {
122
+ codeOrigin: origin,
123
+ ...frames.length ? { frames: JSON.stringify(frames) } : {}
124
+ };
125
+ } catch (e) {
126
+ return {};
127
+ }
128
+ }
129
+
75
130
  // src/provider.tsx
76
131
  var import_react6 = require("react");
77
132
 
@@ -1312,6 +1367,7 @@ function buildCapturedErrorPayload(error, options, cfg, capturedBy = "captureErr
1312
1367
  ...contextMetadata(context),
1313
1368
  ...(options == null ? void 0 : options.boundary) ? { boundary: options.boundary } : {},
1314
1369
  ...digest ? { digest } : {},
1370
+ ...originMetadata(err == null ? void 0 : err.stack),
1315
1371
  ...sessionMetadata(cfg.session),
1316
1372
  ...options == null ? void 0 : options.metadata
1317
1373
  }
@@ -4085,7 +4141,9 @@ function AssistSheet({
4085
4141
  backgroundColor: t.bg,
4086
4142
  // The "already filed?" card can be taller than the sheet; scroll
4087
4143
  // it instead of clipping its buttons off the bottom (#590).
4088
- ...similarSlot ? { maxHeight: "70%", overflowY: "auto" } : {}
4144
+ // The bottom sheet has only a max-height, so a % here resolves
4145
+ // to auto and never scrolls (#596): use the viewport there.
4146
+ ...similarSlot ? { maxHeight: narrow ? "55dvh" : "70%", overflowY: "auto" } : {}
4089
4147
  },
4090
4148
  children: [
4091
4149
  phase === "solved" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
@@ -8806,6 +8864,7 @@ var WEEKDAYS = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
8806
8864
  var DAY_MS = 864e5;
8807
8865
  var ZONE_PAD_MS = 14 * 36e5;
8808
8866
  var WIDE_QUERY = "(min-width: 900px)";
8867
+ var SPLIT_QUERY = "(min-width: 1120px)";
8809
8868
  function localZone() {
8810
8869
  try {
8811
8870
  return Intl.DateTimeFormat().resolvedOptions().timeZone;
@@ -8912,13 +8971,14 @@ function BookingDialog({
8912
8971
  }) {
8913
8972
  var _a, _b, _c, _d, _e;
8914
8973
  const wide = useMediaQuery(WIDE_QUERY, true);
8974
+ const split = useMediaQuery(SPLIT_QUERY, true) && wide;
8915
8975
  const t = (0, import_react5.useMemo)(() => {
8916
8976
  if (!open) return LIGHT;
8917
8977
  const base = detectDark() ? DARK : LIGHT;
8918
8978
  const accent = detectHostAccent();
8919
8979
  return accent ? { ...base, ink: accent.accent, onInk: accent.accentText } : base;
8920
8980
  }, [open]);
8921
- const [step, setStep] = (0, import_react5.useState)("slots");
8981
+ const [step, setStep] = (0, import_react5.useState)("pick");
8922
8982
  const [zone, setZone] = (0, import_react5.useState)(localZone);
8923
8983
  const [twelve, setTwelve] = (0, import_react5.useState)(prefers12h);
8924
8984
  const [month, setMonth] = (0, import_react5.useState)(() => dayKeyIn(Date.now(), localZone()).slice(0, 7));
@@ -8933,11 +8993,10 @@ function BookingDialog({
8933
8993
  const [phone, setPhone] = (0, import_react5.useState)("");
8934
8994
  const [dial, setDial] = (0, import_react5.useState)(() => defaultDialForZone(localZone()));
8935
8995
  const [phoneTouched, setPhoneTouched] = (0, import_react5.useState)(false);
8936
- const [note, setNote] = (0, import_react5.useState)("");
8996
+ const [tried, setTried] = (0, import_react5.useState)(false);
8937
8997
  const [questions, setQuestions] = (0, import_react5.useState)([]);
8938
8998
  const [answers, setAnswers] = (0, import_react5.useState)({});
8939
8999
  const [pageLoaded, setPageLoaded] = (0, import_react5.useState)(false);
8940
- const [asked, setAsked] = (0, import_react5.useState)(false);
8941
9000
  const [requireOtp, setRequireOtp] = (0, import_react5.useState)(true);
8942
9001
  const [code, setCode] = (0, import_react5.useState)("");
8943
9002
  const [bookingId, setBookingId] = (0, import_react5.useState)(null);
@@ -8997,7 +9056,7 @@ function BookingDialog({
8997
9056
  (0, import_react5.useEffect)(() => {
8998
9057
  if (!open) return;
8999
9058
  const now = localZone();
9000
- setStep("slots");
9059
+ setStep("pick");
9001
9060
  setZone(now);
9002
9061
  setMonth(dayKeyIn(Date.now(), now).slice(0, 7));
9003
9062
  setSlotsByMonth({});
@@ -9009,7 +9068,7 @@ function BookingDialog({
9009
9068
  setPreviewEnded(false);
9010
9069
  setAvatarFailed(false);
9011
9070
  setPageLoaded(false);
9012
- setAsked(false);
9071
+ setTried(false);
9013
9072
  }, [open]);
9014
9073
  const monthLoaded = month in slotsByMonth;
9015
9074
  (0, import_react5.useEffect)(() => {
@@ -9039,13 +9098,22 @@ function BookingDialog({
9039
9098
  const atFirstMonth = month <= today.slice(0, 7);
9040
9099
  const pastHorizon = monthLoaded && !error && byDay.size === 0 && !atFirstMonth;
9041
9100
  const given = questions.flatMap((q) => q.options.includes(answers[q.id]) ? [{ ...q, answer: answers[q.id] }] : []);
9042
- const canContinue = questions.every((q) => !q.required || q.options.includes(answers[q.id]));
9043
- const view = step !== "slots" ? step : !pageLoaded ? "loading" : questions.length > 0 && !asked ? "questions" : "slots";
9044
- const roomy = step === "slots";
9101
+ const unanswered = questions.filter((q) => q.required && !q.options.includes(answers[q.id]));
9102
+ const phoneError = phoneProblem(dial, phone);
9103
+ const nameMissing = !name.trim();
9104
+ const emailMissing = !email.includes("@");
9105
+ const missing = [
9106
+ ...nameMissing ? ["your name"] : [],
9107
+ ...phoneError ? ["a valid mobile number"] : [],
9108
+ ...emailMissing ? ["your email"] : [],
9109
+ ...unanswered.map((q) => `an answer to \u201C${q.label}\u201D`),
9110
+ ...selected ? [] : ["a day and time"]
9111
+ ];
9112
+ const roomy = step === "pick";
9045
9113
  async function startBooking() {
9046
9114
  var _a2, _b2, _c2;
9047
- if (!selected) return;
9048
- if (phoneError) {
9115
+ if (missing.length > 0 || !selected) {
9116
+ setTried(true);
9049
9117
  setPhoneTouched(true);
9050
9118
  return;
9051
9119
  }
@@ -9063,7 +9131,6 @@ function BookingDialog({
9063
9131
  name,
9064
9132
  email,
9065
9133
  phone: toE164(dial, phone),
9066
- note,
9067
9134
  answers: Object.fromEntries(given.map((q) => [q.id, q.answer])),
9068
9135
  startsAt: selected.startsAt,
9069
9136
  // The zone the times were shown in, which is the one the visitor chose.
@@ -9125,8 +9192,6 @@ function BookingDialog({
9125
9192
  setBusy(false);
9126
9193
  }
9127
9194
  }
9128
- const phoneError = phoneProblem(dial, phone);
9129
- const canSubmitDetails = Boolean(name.trim() && email.includes("@"));
9130
9195
  const selectedEnd = selected ? (_e = selected.endsAt) != null ? _e : new Date(new Date(selected.startsAt).getTime() + page.slotMinutes * 6e4).toISOString() : null;
9131
9196
  const monthDate = new Date(keyToUtc(`${month}-01`));
9132
9197
  const muted = { color: t.muted };
@@ -9284,7 +9349,7 @@ function BookingDialog({
9284
9349
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { fontSize: 20, fontWeight: 600, lineHeight: 1.25, paddingRight: 32, overflowWrap: "anywhere" }, children: page.title }),
9285
9350
  page.description && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { fontSize: 13, lineHeight: 1.5, overflowWrap: "anywhere", ...muted }, children: page.description }),
9286
9351
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 10, marginTop: 4, fontSize: 14 }, children: [
9287
- selected && step !== "slots" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Row, { icon: "calendar", t, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { children: [
9352
+ selected && step !== "pick" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Row, { icon: "calendar", t, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { children: [
9288
9353
  new Date(selected.startsAt).toLocaleDateString("en-US", {
9289
9354
  weekday: "long",
9290
9355
  month: "long",
@@ -9299,33 +9364,7 @@ function BookingDialog({
9299
9364
  selectedEnd && formatTime(selectedEnd, zone, twelve)
9300
9365
  ] })
9301
9366
  ] }) }),
9302
- asked && given.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Row, { icon: "check", t, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { children: [
9303
- given.map((q) => q.answer).join(" \xB7 "),
9304
- view === "slots" && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
9305
- " ",
9306
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9307
- "button",
9308
- {
9309
- type: "button",
9310
- onClick: () => setAsked(false),
9311
- className: "gg-bk-link",
9312
- style: {
9313
- border: 0,
9314
- // Room for a thumb without pushing the rows apart.
9315
- padding: "8px 6px",
9316
- margin: "-8px 0",
9317
- background: "transparent",
9318
- color: t.muted,
9319
- fontFamily: "inherit",
9320
- fontSize: 13,
9321
- textDecoration: "underline",
9322
- cursor: "pointer"
9323
- },
9324
- children: "Change"
9325
- }
9326
- )
9327
- ] })
9328
- ] }) }),
9367
+ step !== "pick" && given.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Row, { icon: "check", t, children: given.map((q) => q.answer).join(" \xB7 ") }),
9329
9368
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Row, { icon: "clock", t, children: formatDuration(page.slotMinutes) }),
9330
9369
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Row, { icon: "video", t, children: "Google Meet" }),
9331
9370
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Row, { icon: "globe", t, children: roomy ? (
@@ -9382,328 +9421,365 @@ function BookingDialog({
9382
9421
  ]
9383
9422
  }
9384
9423
  );
9385
- const calendar = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
9386
- "div",
9387
- {
9388
- style: {
9389
- flex: "1 1 auto",
9390
- minWidth: 0,
9391
- padding: wide ? "24px 24px 20px" : "16px 16px 8px",
9392
- boxSizing: "border-box",
9393
- overflowY: wide ? "auto" : void 0
9394
- },
9395
- children: [
9396
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: 14 }, children: [
9397
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { fontSize: 16, fontWeight: 600 }, children: [
9398
- monthDate.toLocaleDateString("en-US", { month: "long", timeZone: "UTC" }),
9399
- " ",
9400
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { fontWeight: 500, ...muted }, children: monthDate.getUTCFullYear() })
9401
- ] }),
9402
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", gap: 4 }, children: [
9403
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9404
- NavButton,
9405
- {
9406
- t,
9407
- label: "Previous month",
9408
- icon: "left",
9409
- disabled: atFirstMonth,
9410
- onClick: () => setMonth(shiftMonth(month, -1))
9411
- }
9412
- ),
9413
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9414
- NavButton,
9415
- {
9416
- t,
9417
- label: "Next month",
9418
- icon: "right",
9419
- disabled: pastHorizon,
9420
- onClick: () => setMonth(shiftMonth(month, 1))
9421
- }
9422
- )
9423
- ] })
9424
- ] }),
9425
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "repeat(7, minmax(0, 1fr))", gap: wide ? 6 : 4 }, children: [
9426
- WEEKDAYS.map((w) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9427
- "div",
9424
+ const calendar = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { padding: wide ? "22px 20px 12px" : "16px 16px 8px", boxSizing: "border-box" }, children: [
9425
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: 14 }, children: [
9426
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { fontSize: 16, fontWeight: 600 }, children: [
9427
+ monthDate.toLocaleDateString("en-US", { month: "long", timeZone: "UTC" }),
9428
+ " ",
9429
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { fontWeight: 500, ...muted }, children: monthDate.getUTCFullYear() })
9430
+ ] }),
9431
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", gap: 4 }, children: [
9432
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9433
+ NavButton,
9434
+ {
9435
+ t,
9436
+ label: "Previous month",
9437
+ icon: "left",
9438
+ disabled: atFirstMonth,
9439
+ onClick: () => setMonth(shiftMonth(month, -1))
9440
+ }
9441
+ ),
9442
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9443
+ NavButton,
9444
+ {
9445
+ t,
9446
+ label: "Next month",
9447
+ icon: "right",
9448
+ disabled: pastHorizon,
9449
+ onClick: () => setMonth(shiftMonth(month, 1))
9450
+ }
9451
+ )
9452
+ ] })
9453
+ ] }),
9454
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "repeat(7, minmax(0, 1fr))", gap: 4 }, children: [
9455
+ WEEKDAYS.map((w) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9456
+ "div",
9457
+ {
9458
+ style: {
9459
+ textAlign: "center",
9460
+ fontSize: 11,
9461
+ fontWeight: 500,
9462
+ letterSpacing: ".08em",
9463
+ textTransform: "uppercase",
9464
+ padding: "6px 0 8px",
9465
+ color: t.text
9466
+ },
9467
+ children: w
9468
+ },
9469
+ w
9470
+ )),
9471
+ grid.map((key) => {
9472
+ const inMonth = key.startsWith(month);
9473
+ const bookable = byDay.has(key);
9474
+ const isSelected = key === day;
9475
+ const dayNum = Number(key.slice(8));
9476
+ if (!inMonth && !bookable) return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { "aria-hidden": true }, key);
9477
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
9478
+ "button",
9479
+ {
9480
+ type: "button",
9481
+ disabled: !bookable,
9482
+ onClick: () => setPickedDay(key),
9483
+ "aria-pressed": isSelected,
9484
+ "aria-label": new Date(keyToUtc(key)).toLocaleDateString("en-US", {
9485
+ weekday: "long",
9486
+ month: "long",
9487
+ day: "numeric",
9488
+ timeZone: "UTC"
9489
+ }),
9490
+ className: bookable && !isSelected ? "gg-bk-day" : void 0,
9491
+ style: {
9492
+ position: "relative",
9493
+ // Shorter than square: the times sit under the month now, and
9494
+ // both should fit without scrolling on a laptop.
9495
+ aspectRatio: wide ? "5 / 4" : "1 / 1",
9496
+ minHeight: 36,
9497
+ border: 0,
9498
+ borderRadius: 8,
9499
+ padding: 0,
9500
+ fontFamily: "inherit",
9501
+ fontSize: wide ? 15 : 14,
9502
+ fontWeight: bookable ? 600 : 400,
9503
+ cursor: bookable ? "pointer" : "default",
9504
+ background: isSelected ? t.ink : bookable ? t.open : "transparent",
9505
+ color: isSelected ? t.onInk : bookable ? t.text : t.faint,
9506
+ opacity: monthLoaded ? 1 : 0.5
9507
+ },
9508
+ children: [
9509
+ !inMonth && dayNum === 1 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9510
+ "span",
9511
+ {
9512
+ style: {
9513
+ position: "absolute",
9514
+ top: 4,
9515
+ left: 0,
9516
+ right: 0,
9517
+ fontSize: 9,
9518
+ fontWeight: 500,
9519
+ letterSpacing: ".06em",
9520
+ textTransform: "uppercase"
9521
+ },
9522
+ children: new Date(keyToUtc(key)).toLocaleDateString("en-US", { month: "short", timeZone: "UTC" })
9523
+ }
9524
+ ),
9525
+ dayNum,
9526
+ key === today && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9527
+ "span",
9528
+ {
9529
+ "aria-hidden": true,
9530
+ style: {
9531
+ position: "absolute",
9532
+ bottom: 6,
9533
+ left: "50%",
9534
+ width: 4,
9535
+ height: 4,
9536
+ marginLeft: -2,
9537
+ borderRadius: 999,
9538
+ background: isSelected ? t.onInk : t.text
9539
+ }
9540
+ }
9541
+ )
9542
+ ]
9543
+ },
9544
+ key
9545
+ );
9546
+ })
9547
+ ] })
9548
+ ] });
9549
+ 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: [
9550
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 14 }, children: [
9551
+ /* @__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: [
9552
+ new Date(keyToUtc(day)).toLocaleDateString("en-US", { weekday: "short", timeZone: "UTC" }),
9553
+ " ",
9554
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { fontWeight: 500, ...muted }, children: ordinal(Number(day.slice(8))) })
9555
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { fontWeight: 500, ...muted }, children: "Times" }) }),
9556
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9557
+ "div",
9558
+ {
9559
+ role: "group",
9560
+ "aria-label": "Clock format",
9561
+ style: { display: "flex", padding: 3, borderRadius: 8, background: t.open, flex: "0 0 auto" },
9562
+ children: [true, false].map((h12) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9563
+ "button",
9428
9564
  {
9565
+ type: "button",
9566
+ "aria-pressed": twelve === h12,
9567
+ onClick: () => setTwelve(h12),
9429
9568
  style: {
9430
- textAlign: "center",
9431
- fontSize: 11,
9569
+ border: 0,
9570
+ borderRadius: 6,
9571
+ padding: "4px 9px",
9572
+ fontFamily: "inherit",
9573
+ fontSize: 13,
9432
9574
  fontWeight: 500,
9433
- letterSpacing: ".08em",
9434
- textTransform: "uppercase",
9435
- padding: "6px 0 8px",
9436
- color: t.text
9575
+ cursor: "pointer",
9576
+ background: twelve === h12 ? t.bg : "transparent",
9577
+ color: twelve === h12 ? t.text : t.muted,
9578
+ boxShadow: twelve === h12 ? "0 1px 2px rgba(0,0,0,.12)" : "none"
9437
9579
  },
9438
- children: w
9580
+ children: h12 ? "12h" : "24h"
9439
9581
  },
9440
- w
9441
- )),
9442
- grid.map((key) => {
9443
- const inMonth = key.startsWith(month);
9444
- const bookable = byDay.has(key);
9445
- const isSelected = key === day;
9446
- const dayNum = Number(key.slice(8));
9447
- if (!inMonth && !bookable) return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { "aria-hidden": true }, key);
9448
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
9582
+ String(h12)
9583
+ ))
9584
+ }
9585
+ )
9586
+ ] }),
9587
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
9588
+ "div",
9589
+ {
9590
+ role: "group",
9591
+ "aria-label": "Times",
9592
+ style: {
9593
+ paddingBottom: 20,
9594
+ display: "grid",
9595
+ gridTemplateColumns: "repeat(auto-fill, minmax(84px, 1fr))",
9596
+ gap: 8
9597
+ },
9598
+ children: [
9599
+ error && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { color: t.danger, fontSize: 13, lineHeight: 1.5, gridColumn: "1 / -1" }, children: error }),
9600
+ !monthLoaded && !error && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { fontSize: 13, gridColumn: "1 / -1", ...muted }, children: "Finding times\u2026" }),
9601
+ 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." }),
9602
+ monthLoaded && daySlots.map((slot) => {
9603
+ const on = (selected == null ? void 0 : selected.startsAt) === slot.startsAt;
9604
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9449
9605
  "button",
9450
9606
  {
9451
9607
  type: "button",
9452
- disabled: !bookable,
9453
- onClick: () => setPickedDay(key),
9454
- "aria-pressed": isSelected,
9455
- "aria-label": new Date(keyToUtc(key)).toLocaleDateString("en-US", {
9456
- weekday: "long",
9457
- month: "long",
9458
- day: "numeric",
9459
- timeZone: "UTC"
9460
- }),
9461
- className: bookable && !isSelected ? "gg-bk-day" : void 0,
9608
+ "aria-pressed": on,
9609
+ className: on ? void 0 : "gg-bk-slot",
9610
+ onClick: () => {
9611
+ setSelected(slot);
9612
+ setError(null);
9613
+ },
9462
9614
  style: {
9463
- position: "relative",
9464
- aspectRatio: "1 / 1",
9465
- minHeight: 36,
9466
- border: 0,
9615
+ padding: "10px 8px",
9467
9616
  borderRadius: 8,
9468
- padding: 0,
9617
+ border: `1px solid ${on ? t.ink : t.border}`,
9618
+ background: on ? t.ink : t.pane,
9619
+ color: on ? t.onInk : t.text,
9469
9620
  fontFamily: "inherit",
9470
- fontSize: wide ? 15 : 14,
9471
- fontWeight: bookable ? 600 : 400,
9472
- cursor: bookable ? "pointer" : "default",
9473
- background: isSelected ? t.ink : bookable ? t.open : "transparent",
9474
- color: isSelected ? t.onInk : bookable ? t.text : t.faint,
9475
- opacity: monthLoaded ? 1 : 0.5
9621
+ fontSize: 14,
9622
+ fontWeight: 500,
9623
+ cursor: "pointer",
9624
+ textAlign: "center"
9476
9625
  },
9477
- children: [
9478
- !inMonth && dayNum === 1 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9479
- "span",
9480
- {
9481
- style: {
9482
- position: "absolute",
9483
- top: 4,
9484
- left: 0,
9485
- right: 0,
9486
- fontSize: 9,
9487
- fontWeight: 500,
9488
- letterSpacing: ".06em",
9489
- textTransform: "uppercase"
9490
- },
9491
- children: new Date(keyToUtc(key)).toLocaleDateString("en-US", { month: "short", timeZone: "UTC" })
9492
- }
9493
- ),
9494
- dayNum,
9495
- key === today && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9496
- "span",
9497
- {
9498
- "aria-hidden": true,
9499
- style: {
9500
- position: "absolute",
9501
- bottom: 6,
9502
- left: "50%",
9503
- width: 4,
9504
- height: 4,
9505
- marginLeft: -2,
9506
- borderRadius: 999,
9507
- background: isSelected ? t.onInk : t.text
9508
- }
9509
- }
9510
- )
9511
- ]
9626
+ children: formatTime(slot.startsAt, zone, twelve)
9512
9627
  },
9513
- key
9628
+ slot.startsAt
9514
9629
  );
9515
9630
  })
9516
- ] })
9517
- ]
9518
- }
9519
- );
9520
- const times = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
9631
+ ]
9632
+ }
9633
+ )
9634
+ ] });
9635
+ const details = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
9521
9636
  "div",
9522
9637
  {
9523
9638
  style: {
9524
- width: wide ? 260 : void 0,
9525
- flex: wide ? "0 0 260px" : void 0,
9526
- borderLeft: wide ? `1px solid ${t.border}` : void 0,
9527
- borderTop: wide ? void 0 : `1px solid ${t.border}`,
9528
- padding: wide ? "24px 20px 0" : "16px 16px 0",
9639
+ flex: "1 1 auto",
9640
+ minWidth: 0,
9641
+ padding: wide ? "24px 28px" : "20px",
9529
9642
  boxSizing: "border-box",
9643
+ overflowY: split ? "auto" : void 0,
9530
9644
  display: "flex",
9531
9645
  flexDirection: "column",
9532
- minHeight: 0
9646
+ gap: 16
9533
9647
  },
9534
9648
  children: [
9535
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 14 }, children: [
9536
- /* @__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: [
9537
- new Date(keyToUtc(day)).toLocaleDateString("en-US", { weekday: "short", timeZone: "UTC" }),
9538
- " ",
9539
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { fontWeight: 500, ...muted }, children: ordinal(Number(day.slice(8))) })
9540
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { fontWeight: 500, ...muted }, children: "Times" }) }),
9541
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9542
- "div",
9543
- {
9544
- role: "group",
9545
- "aria-label": "Clock format",
9546
- style: { display: "flex", padding: 3, borderRadius: 8, background: t.open, flex: "0 0 auto" },
9547
- children: [true, false].map((h12) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9548
- "button",
9549
- {
9550
- type: "button",
9551
- "aria-pressed": twelve === h12,
9552
- onClick: () => setTwelve(h12),
9553
- style: {
9554
- border: 0,
9555
- borderRadius: 6,
9556
- padding: "4px 9px",
9557
- fontFamily: "inherit",
9558
- fontSize: 13,
9559
- fontWeight: 500,
9560
- cursor: "pointer",
9561
- background: twelve === h12 ? t.bg : "transparent",
9562
- color: twelve === h12 ? t.text : t.muted,
9563
- boxShadow: twelve === h12 ? "0 1px 2px rgba(0,0,0,.12)" : "none"
9564
- },
9565
- children: h12 ? "12h" : "24h"
9566
- },
9567
- String(h12)
9568
- ))
9569
- }
9570
- )
9571
- ] }),
9572
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
9573
- "div",
9649
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9650
+ Field,
9574
9651
  {
9575
- style: {
9576
- overflowY: wide ? "auto" : void 0,
9577
- flex: "1 1 auto",
9578
- minHeight: 0,
9579
- paddingBottom: 20,
9580
- display: wide ? "flex" : "grid",
9581
- flexDirection: "column",
9582
- gridTemplateColumns: "repeat(auto-fill, minmax(96px, 1fr))",
9583
- gap: 8
9652
+ t,
9653
+ label: "Full name",
9654
+ value: name,
9655
+ onChange: setName,
9656
+ autoComplete: "name",
9657
+ error: tried && nameMissing ? "Add your name" : null
9658
+ }
9659
+ ),
9660
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9661
+ PhoneField,
9662
+ {
9663
+ t,
9664
+ dial,
9665
+ national: phone,
9666
+ onChange: (nextDial, national) => {
9667
+ setDial(nextDial);
9668
+ setPhone(national);
9584
9669
  },
9585
- children: [
9586
- error && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { color: t.danger, fontSize: 13, lineHeight: 1.5, gridColumn: "1 / -1" }, children: error }),
9587
- !monthLoaded && !error && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { fontSize: 13, gridColumn: "1 / -1", ...muted }, children: "Finding times\u2026" }),
9588
- 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." }),
9589
- monthLoaded && daySlots.map((slot) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9670
+ onBlur: () => setPhoneTouched(true),
9671
+ error: phoneTouched ? phoneError : null,
9672
+ hint: requireOtp ? "We text a code here to confirm, then a reminder before the call." : "We send a reminder here before the call."
9673
+ }
9674
+ ),
9675
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9676
+ Field,
9677
+ {
9678
+ t,
9679
+ label: "Email",
9680
+ value: email,
9681
+ onChange: setEmail,
9682
+ type: "email",
9683
+ autoComplete: "email",
9684
+ error: tried && emailMissing ? "Add an email \u2014 the invite goes there" : null
9685
+ }
9686
+ ),
9687
+ !pageLoaded && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { fontSize: 13, ...muted }, children: "Loading\u2026" }),
9688
+ questions.map((q) => {
9689
+ const gap = tried && unanswered.includes(q);
9690
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { role: "group", "aria-label": q.label, children: [
9691
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { fontSize: 13, fontWeight: 500, overflowWrap: "anywhere" }, children: [
9692
+ q.label,
9693
+ !q.required && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { fontWeight: 400, ...muted }, children: " (optional)" })
9694
+ ] }),
9695
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: 8, marginTop: 8 }, children: q.options.map((option) => {
9696
+ const on = answers[q.id] === option;
9697
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9590
9698
  "button",
9591
9699
  {
9592
9700
  type: "button",
9593
- className: "gg-bk-slot",
9594
- onClick: () => {
9595
- setSelected(slot);
9596
- setError(null);
9597
- setStep("details");
9598
- },
9701
+ "aria-pressed": on,
9702
+ className: on ? void 0 : "gg-bk-slot",
9703
+ onClick: () => setAnswers((prev) => {
9704
+ if (on && !q.required) {
9705
+ const rest = { ...prev };
9706
+ delete rest[q.id];
9707
+ return rest;
9708
+ }
9709
+ return { ...prev, [q.id]: option };
9710
+ }),
9599
9711
  style: {
9600
- flex: "0 0 auto",
9601
- padding: "11px 12px",
9712
+ padding: "7px 12px",
9713
+ minHeight: 36,
9602
9714
  borderRadius: 8,
9603
- border: `1px solid ${t.border}`,
9604
- background: t.pane,
9605
- color: t.text,
9715
+ border: `1px solid ${on ? t.ink : gap ? t.danger : t.border}`,
9716
+ background: on ? t.ink : t.pane,
9717
+ color: on ? t.onInk : t.text,
9606
9718
  fontFamily: "inherit",
9607
9719
  fontSize: 14,
9608
9720
  fontWeight: 500,
9609
9721
  cursor: "pointer",
9610
- textAlign: "center"
9722
+ overflowWrap: "anywhere",
9723
+ textAlign: "left"
9611
9724
  },
9612
- children: formatTime(slot.startsAt, zone, twelve)
9725
+ children: option
9613
9726
  },
9614
- slot.startsAt
9615
- ))
9616
- ]
9617
- }
9618
- )
9727
+ option
9728
+ );
9729
+ }) }),
9730
+ gap && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { role: "alert", style: { marginTop: 6, fontSize: 12, fontWeight: 500, color: t.danger }, children: "Pick one" })
9731
+ ] }, q.id);
9732
+ })
9619
9733
  ]
9620
9734
  }
9621
9735
  );
9622
- const loading = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9736
+ const pickedLabel = selected ? `${new Date(selected.startsAt).toLocaleDateString("en-US", {
9737
+ weekday: "short",
9738
+ month: "short",
9739
+ day: "numeric",
9740
+ timeZone: zone
9741
+ })} \xB7 ${formatTime(selected.startsAt, zone, twelve)} \u2013 ${selectedEnd && formatTime(selectedEnd, zone, twelve)}` : null;
9742
+ const footer = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
9623
9743
  "div",
9624
9744
  {
9625
9745
  style: {
9626
- flex: "1 1 auto",
9627
- minHeight: wide ? void 0 : 200,
9746
+ borderTop: `1px solid ${t.border}`,
9747
+ padding: wide ? "14px 28px" : "14px 16px",
9628
9748
  display: "flex",
9749
+ flexWrap: "wrap",
9629
9750
  alignItems: "center",
9630
- justifyContent: "center",
9631
- fontSize: 13,
9632
- ...muted
9633
- },
9634
- children: "Loading\u2026"
9635
- }
9636
- );
9637
- const ask = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9638
- "div",
9639
- {
9640
- style: {
9641
- flex: "1 1 auto",
9642
- minWidth: 0,
9643
- padding: wide ? "28px 32px" : "20px",
9644
- boxSizing: "border-box",
9645
- overflowY: wide ? "auto" : void 0
9751
+ justifyContent: "space-between",
9752
+ gap: "10px 16px",
9753
+ background: t.bg,
9754
+ // Stacked, the dialog scrolls as one page; the button stays in reach.
9755
+ position: wide ? void 0 : "sticky",
9756
+ // Past the overlay's 12px padding, so nothing shows under the bar.
9757
+ bottom: wide ? void 0 : -12
9646
9758
  },
9647
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { maxWidth: 520, display: "flex", flexDirection: "column", gap: 22 }, children: [
9648
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
9649
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { fontSize: 16, fontWeight: 600 }, children: questions.length === 1 ? "One question first" : "A few questions first" }),
9650
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { fontSize: 13, lineHeight: 1.5, marginTop: 4, ...muted }, children: "So the right person takes your demo." })
9651
- ] }),
9652
- questions.map((q) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { role: "group", "aria-label": q.label, children: [
9653
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { fontSize: 14, fontWeight: 500, overflowWrap: "anywhere" }, children: [
9654
- q.label,
9655
- !q.required && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { fontWeight: 400, ...muted }, children: " (optional)" })
9759
+ children: [
9760
+ /* @__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: [
9761
+ pickedLabel ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { fontWeight: 600 }, children: pickedLabel }) : !tried && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: muted, children: [
9762
+ "Pick a day and a time ",
9763
+ split ? "on the right" : "below",
9764
+ "."
9656
9765
  ] }),
9657
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: 8, marginTop: 10 }, children: q.options.map((option) => {
9658
- const on = answers[q.id] === option;
9659
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9660
- "button",
9661
- {
9662
- type: "button",
9663
- "aria-pressed": on,
9664
- className: on ? void 0 : "gg-bk-slot",
9665
- onClick: () => setAnswers((prev) => {
9666
- if (on && !q.required) {
9667
- const rest = { ...prev };
9668
- delete rest[q.id];
9669
- return rest;
9670
- }
9671
- return { ...prev, [q.id]: option };
9672
- }),
9673
- style: {
9674
- padding: "9px 14px",
9675
- minHeight: 40,
9676
- borderRadius: 8,
9677
- border: `1px solid ${on ? t.ink : t.border}`,
9678
- background: on ? t.ink : t.pane,
9679
- color: on ? t.onInk : t.text,
9680
- fontFamily: "inherit",
9681
- fontSize: 14,
9682
- fontWeight: 500,
9683
- cursor: "pointer",
9684
- overflowWrap: "anywhere",
9685
- textAlign: "left"
9686
- },
9687
- children: option
9688
- },
9689
- option
9690
- );
9691
- }) })
9692
- ] }, q.id)),
9693
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", flexWrap: "wrap", alignItems: "center", gap: "8px 12px", marginTop: 2 }, children: [
9694
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9695
- "button",
9696
- {
9697
- type: "button",
9698
- onClick: () => setAsked(true),
9699
- disabled: !canContinue,
9700
- style: { ...primaryStyle(t, !canContinue), whiteSpace: "nowrap" },
9701
- children: "See available times"
9702
- }
9703
- ),
9704
- !canContinue && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { fontSize: 12, ...muted }, children: "Pick one for each to continue" })
9705
- ] })
9706
- ] })
9766
+ tried && missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { role: "alert", style: { color: t.danger }, children: [
9767
+ "Still needed: ",
9768
+ missing.join(", ")
9769
+ ] })
9770
+ ] }) }),
9771
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9772
+ "button",
9773
+ {
9774
+ type: "button",
9775
+ onClick: startBooking,
9776
+ disabled: busy,
9777
+ "aria-disabled": missing.length > 0,
9778
+ style: { ...primaryStyle(t, busy || missing.length > 0), cursor: busy ? "default" : "pointer", whiteSpace: "nowrap" },
9779
+ children: requireOtp ? busy ? "Sending code\u2026" : "Send verification code" : busy ? "Booking\u2026" : "Book demo"
9780
+ }
9781
+ )
9782
+ ]
9707
9783
  }
9708
9784
  );
9709
9785
  const form = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
@@ -9718,54 +9794,15 @@ function BookingDialog({
9718
9794
  },
9719
9795
  children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { maxWidth: 440, display: "flex", flexDirection: "column", gap: 14 }, children: [
9720
9796
  error && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { color: t.danger, fontSize: 13, lineHeight: 1.5 }, children: error }),
9721
- 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." }),
9722
- step === "details" && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
9723
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Field, { t, label: "Your name", value: name, onChange: setName, autoComplete: "name" }),
9724
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Field, { t, label: "Email", value: email, onChange: setEmail, type: "email", autoComplete: "email" }),
9725
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9726
- PhoneField,
9727
- {
9728
- t,
9729
- dial,
9730
- national: phone,
9731
- onChange: (nextDial, national) => {
9732
- setDial(nextDial);
9733
- setPhone(national);
9734
- },
9735
- onBlur: () => setPhoneTouched(true),
9736
- error: phoneTouched ? phoneError : null,
9737
- hint: requireOtp ? "We send a code here to confirm, then a reminder before the call." : "We send a reminder here before the call."
9738
- }
9739
- ),
9740
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Field, { t, label: "Anything we should know? (optional)", value: note, onChange: setNote, multiline: true }),
9741
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", justifyContent: "flex-end", gap: 8, marginTop: 4 }, children: [
9742
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9743
- "button",
9744
- {
9745
- type: "button",
9746
- className: "gg-bk-ghost",
9747
- onClick: () => {
9748
- setError(null);
9749
- setStep("slots");
9750
- },
9751
- style: secondaryStyle(t),
9752
- children: "Back"
9753
- }
9754
- ),
9755
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9756
- "button",
9757
- {
9758
- type: "button",
9759
- onClick: startBooking,
9760
- disabled: !canSubmitDetails || busy,
9761
- style: primaryStyle(t, !canSubmitDetails || busy),
9762
- children: requireOtp ? busy ? "Sending code\u2026" : "Send verification code" : busy ? "Booking\u2026" : "Book demo"
9763
- }
9764
- )
9765
- ] })
9766
- ] }),
9767
9797
  step === "code" && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
9768
- /* @__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." }),
9798
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { fontSize: 16, fontWeight: 600 }, children: "Verify your mobile" }),
9799
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { fontSize: 14, lineHeight: 1.5, ...muted }, children: [
9800
+ "We texted a code to +",
9801
+ dial,
9802
+ " ",
9803
+ phone,
9804
+ ". Your slot is held for 10 minutes."
9805
+ ] }),
9769
9806
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Field, { t, label: "Code", value: code, onChange: setCode, autoComplete: "one-time-code", inputMode: "numeric" }),
9770
9807
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { display: "flex", justifyContent: "flex-end", marginTop: 4 }, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
9771
9808
  "button",
@@ -9780,6 +9817,11 @@ function BookingDialog({
9780
9817
  ] }),
9781
9818
  step === "done" && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
9782
9819
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { fontSize: 20, fontWeight: 600 }, children: "You're booked." }),
9820
+ pickedLabel && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 8, fontSize: 14 }, children: [
9821
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Row, { icon: "calendar", t, children: pickedLabel }),
9822
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Row, { icon: "globe", t, children: zone }),
9823
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Row, { icon: "video", t, children: "Google Meet" })
9824
+ ] }),
9783
9825
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { fontSize: 14, lineHeight: 1.6, ...muted }, children: [
9784
9826
  "A calendar invite is on its way to ",
9785
9827
  email,
@@ -9823,7 +9865,6 @@ function BookingDialog({
9823
9865
  .gg-bk-day:hover { box-shadow: inset 0 0 0 1.5px ${t.ink}; }
9824
9866
  .gg-bk-slot:hover { border-color: ${t.ink} !important; }
9825
9867
  .gg-bk-ghost:hover { background: ${t.open} !important; }
9826
- .gg-bk-link:hover { color: ${t.text} !important; }
9827
9868
  .gg-bk-root button:focus-visible, .gg-bk-root a:focus-visible,
9828
9869
  .gg-bk-root span:has(> select:focus-visible), .gg-bk-root input:focus-visible, .gg-bk-root textarea:focus-visible {
9829
9870
  outline: 2px solid ${t.ink}; outline-offset: 2px;
@@ -9837,10 +9878,11 @@ function BookingDialog({
9837
9878
  "aria-label": page.title,
9838
9879
  className: "gg-bk-root",
9839
9880
  style: {
9840
- width: roomy ? "min(1060px, 100%)" : "min(820px, 100%)",
9841
- // A month grid should not jump in height between months; the form
9842
- // steps are short and would sit in a mostly empty box.
9843
- height: wide && roomy ? "min(640px, calc(100vh - 48px))" : void 0,
9881
+ width: roomy ? "min(1180px, 100%)" : "min(820px, 100%)",
9882
+ // The one screen holds a month grid and a form side by side; a fixed
9883
+ // height keeps it from jumping between months, and each column
9884
+ // scrolls inside it. The code and done steps are short.
9885
+ height: wide && roomy ? "min(720px, calc(100vh - 48px))" : void 0,
9844
9886
  minHeight: wide && !roomy ? 420 : void 0,
9845
9887
  margin: wide ? void 0 : "auto 0",
9846
9888
  display: "flex",
@@ -9850,16 +9892,48 @@ function BookingDialog({
9850
9892
  border: `1px solid ${t.border}`,
9851
9893
  borderRadius: 14,
9852
9894
  boxShadow: "0 24px 64px rgba(0,0,0,.35)",
9853
- overflow: "hidden",
9895
+ // Stacked, the footer sticks to the bottom of the scrolling overlay,
9896
+ // which `overflow: hidden` here would cut off.
9897
+ overflow: wide ? "hidden" : "clip",
9854
9898
  boxSizing: "border-box",
9855
9899
  textAlign: "left",
9856
9900
  lineHeight: 1.4
9857
9901
  },
9858
9902
  children: [
9859
9903
  summary,
9860
- view === "loading" ? loading : view === "questions" ? ask : view === "slots" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
9861
- calendar,
9862
- times
9904
+ roomy ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { flex: "1 1 auto", minWidth: 0, display: "flex", flexDirection: "column" }, children: [
9905
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
9906
+ "div",
9907
+ {
9908
+ style: {
9909
+ flex: "1 1 auto",
9910
+ minHeight: 0,
9911
+ display: "flex",
9912
+ flexDirection: split ? "row" : "column",
9913
+ // A tablet-wide dialog stacks the two and scrolls them as one.
9914
+ overflowY: wide && !split ? "auto" : void 0
9915
+ },
9916
+ children: [
9917
+ details,
9918
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
9919
+ "div",
9920
+ {
9921
+ style: {
9922
+ flex: split ? "0 0 420px" : void 0,
9923
+ borderLeft: split ? `1px solid ${t.border}` : void 0,
9924
+ borderTop: split ? void 0 : `1px solid ${t.border}`,
9925
+ overflowY: split ? "auto" : void 0
9926
+ },
9927
+ children: [
9928
+ calendar,
9929
+ times
9930
+ ]
9931
+ }
9932
+ )
9933
+ ]
9934
+ }
9935
+ ),
9936
+ footer
9863
9937
  ] }) : form,
9864
9938
  !wide && credit
9865
9939
  ]
@@ -9883,19 +9957,6 @@ function primaryStyle(t, disabled) {
9883
9957
  cursor: disabled ? "default" : "pointer"
9884
9958
  };
9885
9959
  }
9886
- function secondaryStyle(t) {
9887
- return {
9888
- padding: "10px 16px",
9889
- borderRadius: 8,
9890
- border: 0,
9891
- background: "transparent",
9892
- color: t.text,
9893
- fontFamily: "inherit",
9894
- fontSize: 14,
9895
- fontWeight: 500,
9896
- cursor: "pointer"
9897
- };
9898
- }
9899
9960
  function Row({ icon, t, children }) {
9900
9961
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "flex", alignItems: "flex-start", gap: 10, color: t.text, minWidth: 0 }, children: [
9901
9962
  /* @__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 }) }),
@@ -9985,40 +10046,38 @@ function Field({
9985
10046
  value,
9986
10047
  onChange,
9987
10048
  type = "text",
9988
- hint,
9989
10049
  autoComplete,
9990
10050
  inputMode,
9991
- multiline
10051
+ error
9992
10052
  }) {
9993
- const inputStyle = {
9994
- display: "block",
9995
- width: "100%",
9996
- boxSizing: "border-box",
9997
- marginTop: 6,
9998
- padding: "9px 12px",
9999
- background: t.input,
10000
- color: t.text,
10001
- border: `1px solid ${t.border}`,
10002
- borderRadius: 8,
10003
- fontFamily: "inherit",
10004
- fontSize: 14,
10005
- outline: "none",
10006
- resize: "vertical"
10007
- };
10008
10053
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { style: { display: "block", fontSize: 13, fontWeight: 500, color: t.text }, children: [
10009
10054
  label,
10010
- 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)(
10055
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
10011
10056
  "input",
10012
10057
  {
10013
10058
  type,
10014
10059
  value,
10015
10060
  autoComplete,
10016
10061
  inputMode,
10062
+ "aria-invalid": Boolean(error),
10017
10063
  onChange: (e) => onChange(e.target.value),
10018
- style: inputStyle
10064
+ style: {
10065
+ display: "block",
10066
+ width: "100%",
10067
+ boxSizing: "border-box",
10068
+ marginTop: 6,
10069
+ padding: "9px 12px",
10070
+ background: t.input,
10071
+ color: t.text,
10072
+ border: `1px solid ${error ? t.danger : t.border}`,
10073
+ borderRadius: 8,
10074
+ fontFamily: "inherit",
10075
+ fontSize: 14,
10076
+ outline: "none"
10077
+ }
10019
10078
  }
10020
10079
  ),
10021
- hint && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: { marginTop: 6, fontSize: 12, fontWeight: 400, color: t.muted }, children: hint })
10080
+ error && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { role: "alert", style: { marginTop: 6, fontSize: 12, fontWeight: 500, color: t.danger }, children: error })
10022
10081
  ] });
10023
10082
  }
10024
10083
  function PhoneField({
@@ -10323,7 +10382,7 @@ function GlitchgrabProviderInner({
10323
10382
  return matchesIgnorePatterns(message, ignoreErrors);
10324
10383
  };
10325
10384
  const handleError = (event) => {
10326
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
10385
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
10327
10386
  try {
10328
10387
  const isOpaqueCrossOrigin = event.message === "Script error." || event.message === "Script error" || !event.error && !event.filename;
10329
10388
  if (isOpaqueCrossOrigin) {
@@ -10362,11 +10421,12 @@ function GlitchgrabProviderInner({
10362
10421
  visitedPages: JSON.stringify(context.visitedPages),
10363
10422
  ...contextMetadata(context),
10364
10423
  filename: (_e = event.filename) != null ? _e : "",
10365
- lineno: String((_f = event.lineno) != null ? _f : ""),
10366
- colno: String((_g = event.colno) != null ? _g : ""),
10424
+ ...originMetadata((_f = event.error) == null ? void 0 : _f.stack, event.filename),
10425
+ lineno: String((_g = event.lineno) != null ? _g : ""),
10426
+ colno: String((_h = event.colno) != null ? _h : ""),
10367
10427
  // The root patch could not attach (React internals moved, or a
10368
10428
  // root it does not know): still label it and send the DOM context.
10369
- ...isHydrationError((_h = event.error) != null ? _h : event.message) ? hydrationMetadata((_i = event.error) != null ? _i : event.message) : {},
10429
+ ...isHydrationError((_i = event.error) != null ? _i : event.message) ? hydrationMetadata((_j = event.error) != null ? _j : event.message) : {},
10370
10430
  ...(session == null ? void 0 : session.userId) ? { sessionUserId: session.userId } : {},
10371
10431
  ...(session == null ? void 0 : session.name) ? { sessionUserName: String(session.name) } : {},
10372
10432
  ...(session == null ? void 0 : session.email) ? { sessionUserEmail: String(session.email) } : {},
@@ -10418,6 +10478,7 @@ function GlitchgrabProviderInner({
10418
10478
  visitedPages: JSON.stringify(context.visitedPages),
10419
10479
  ...contextMetadata(context),
10420
10480
  type: "unhandledrejection",
10481
+ ...originMetadata(errStack),
10421
10482
  ...description.details ? { rejectionReason: description.details } : {},
10422
10483
  ...(session == null ? void 0 : session.userId) ? { sessionUserId: session.userId } : {},
10423
10484
  ...(session == null ? void 0 : session.name) ? { sessionUserName: String(session.name) } : {},