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.mjs CHANGED
@@ -7810,6 +7810,7 @@ function BookingDialog({
7810
7810
  const [answers, setAnswers] = useState5({});
7811
7811
  const [pageLoaded, setPageLoaded] = useState5(false);
7812
7812
  const [asked, setAsked] = useState5(false);
7813
+ const [requireOtp, setRequireOtp] = useState5(true);
7813
7814
  const [code, setCode] = useState5("");
7814
7815
  const [bookingId, setBookingId] = useState5(null);
7815
7816
  const [meetUrl, setMeetUrl] = useState5(null);
@@ -7852,6 +7853,7 @@ function BookingDialog({
7852
7853
  });
7853
7854
  setWhatsappUrl((_c2 = data.whatsappUrl) != null ? _c2 : null);
7854
7855
  setQuestions(readQuestions(data.questions));
7856
+ setRequireOtp(data.requireOtp !== false);
7855
7857
  setPageLoaded(true);
7856
7858
  } catch (e) {
7857
7859
  setError("Couldn't reach the booking service");
@@ -7909,7 +7911,7 @@ function BookingDialog({
7909
7911
  const view = step !== "slots" ? step : !pageLoaded ? "loading" : questions.length > 0 && !asked ? "questions" : "slots";
7910
7912
  const roomy = step === "slots";
7911
7913
  async function startBooking() {
7912
- var _a2;
7914
+ var _a2, _b2;
7913
7915
  if (!selected) return;
7914
7916
  setBusy(true);
7915
7917
  setError(null);
@@ -7925,7 +7927,10 @@ function BookingDialog({
7925
7927
  answers: Object.fromEntries(given.map((q) => [q.id, q.answer])),
7926
7928
  startsAt: selected.startsAt,
7927
7929
  // The zone the times were shown in, which is the one the visitor chose.
7928
- timezone: zone
7930
+ timezone: zone,
7931
+ // This dialog can show a booking confirmed in one step; the server
7932
+ // only skips the code for a dialog that says so.
7933
+ instant: true
7929
7934
  })
7930
7935
  });
7931
7936
  const json = await res.json();
@@ -7933,6 +7938,11 @@ function BookingDialog({
7933
7938
  setError((_a2 = json.error) != null ? _a2 : "Couldn't hold that slot");
7934
7939
  return;
7935
7940
  }
7941
+ if (json.data.confirmed) {
7942
+ setMeetUrl((_b2 = json.data.meetUrl) != null ? _b2 : null);
7943
+ setStep("done");
7944
+ return;
7945
+ }
7936
7946
  setBookingId(json.data.bookingId);
7937
7947
  setStep("code");
7938
7948
  } catch (e) {
@@ -8545,7 +8555,7 @@ function BookingDialog({
8545
8555
  onChange: setPhone,
8546
8556
  type: "tel",
8547
8557
  autoComplete: "tel",
8548
- hint: "We send a code here to confirm, then a reminder before the call."
8558
+ hint: requireOtp ? "We send a code here to confirm, then a reminder before the call." : "We send a reminder here before the call."
8549
8559
  }
8550
8560
  ),
8551
8561
  /* @__PURE__ */ jsx6(Field, { t, label: "Anything we should know? (optional)", value: note, onChange: setNote, multiline: true }),
@@ -8570,7 +8580,7 @@ function BookingDialog({
8570
8580
  onClick: startBooking,
8571
8581
  disabled: !canSubmitDetails || busy,
8572
8582
  style: primaryStyle(t, !canSubmitDetails || busy),
8573
- children: busy ? "Sending code\u2026" : "Send verification code"
8583
+ children: requireOtp ? busy ? "Sending code\u2026" : "Send verification code" : busy ? "Booking\u2026" : "Book demo"
8574
8584
  }
8575
8585
  )
8576
8586
  ] })