glitchgrab 1.58.0 → 1.58.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
@@ -7865,6 +7865,7 @@ function BookingDialog({
7865
7865
  const [answers, setAnswers] = (0, import_react5.useState)({});
7866
7866
  const [pageLoaded, setPageLoaded] = (0, import_react5.useState)(false);
7867
7867
  const [asked, setAsked] = (0, import_react5.useState)(false);
7868
+ const [requireOtp, setRequireOtp] = (0, import_react5.useState)(true);
7868
7869
  const [code, setCode] = (0, import_react5.useState)("");
7869
7870
  const [bookingId, setBookingId] = (0, import_react5.useState)(null);
7870
7871
  const [meetUrl, setMeetUrl] = (0, import_react5.useState)(null);
@@ -7907,6 +7908,7 @@ function BookingDialog({
7907
7908
  });
7908
7909
  setWhatsappUrl((_c2 = data.whatsappUrl) != null ? _c2 : null);
7909
7910
  setQuestions(readQuestions(data.questions));
7911
+ setRequireOtp(data.requireOtp !== false);
7910
7912
  setPageLoaded(true);
7911
7913
  } catch (e) {
7912
7914
  setError("Couldn't reach the booking service");
@@ -7964,7 +7966,7 @@ function BookingDialog({
7964
7966
  const view = step !== "slots" ? step : !pageLoaded ? "loading" : questions.length > 0 && !asked ? "questions" : "slots";
7965
7967
  const roomy = step === "slots";
7966
7968
  async function startBooking() {
7967
- var _a2;
7969
+ var _a2, _b2;
7968
7970
  if (!selected) return;
7969
7971
  setBusy(true);
7970
7972
  setError(null);
@@ -7980,7 +7982,10 @@ function BookingDialog({
7980
7982
  answers: Object.fromEntries(given.map((q) => [q.id, q.answer])),
7981
7983
  startsAt: selected.startsAt,
7982
7984
  // The zone the times were shown in, which is the one the visitor chose.
7983
- timezone: zone
7985
+ timezone: zone,
7986
+ // This dialog can show a booking confirmed in one step; the server
7987
+ // only skips the code for a dialog that says so.
7988
+ instant: true
7984
7989
  })
7985
7990
  });
7986
7991
  const json = await res.json();
@@ -7988,6 +7993,11 @@ function BookingDialog({
7988
7993
  setError((_a2 = json.error) != null ? _a2 : "Couldn't hold that slot");
7989
7994
  return;
7990
7995
  }
7996
+ if (json.data.confirmed) {
7997
+ setMeetUrl((_b2 = json.data.meetUrl) != null ? _b2 : null);
7998
+ setStep("done");
7999
+ return;
8000
+ }
7991
8001
  setBookingId(json.data.bookingId);
7992
8002
  setStep("code");
7993
8003
  } catch (e) {
@@ -8600,7 +8610,7 @@ function BookingDialog({
8600
8610
  onChange: setPhone,
8601
8611
  type: "tel",
8602
8612
  autoComplete: "tel",
8603
- hint: "We send a code here to confirm, then a reminder before the call."
8613
+ hint: requireOtp ? "We send a code here to confirm, then a reminder before the call." : "We send a reminder here before the call."
8604
8614
  }
8605
8615
  ),
8606
8616
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Field, { t, label: "Anything we should know? (optional)", value: note, onChange: setNote, multiline: true }),
@@ -8625,7 +8635,7 @@ function BookingDialog({
8625
8635
  onClick: startBooking,
8626
8636
  disabled: !canSubmitDetails || busy,
8627
8637
  style: primaryStyle(t, !canSubmitDetails || busy),
8628
- children: busy ? "Sending code\u2026" : "Send verification code"
8638
+ children: requireOtp ? busy ? "Sending code\u2026" : "Send verification code" : busy ? "Booking\u2026" : "Book demo"
8629
8639
  }
8630
8640
  )
8631
8641
  ] })