glitchgrab 1.57.0 → 1.58.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/server.d.mts CHANGED
@@ -375,6 +375,44 @@ interface BookingSettings {
375
375
  * change it; leave the field out and it keeps what is stored.
376
376
  */
377
377
  notifyRecipients: BookingNotifyRecipient[];
378
+ /**
379
+ * What a prospect is asked before they see the calendar — in the booking
380
+ * dialog and over WhatsApp — so the right person takes the demo. At most 5.
381
+ * Send the whole list to change it (`[]` asks nothing); leave the field out
382
+ * and it keeps what is stored. The answers come back on {@link Booking.answers}.
383
+ */
384
+ questions: BookingQuestion[];
385
+ }
386
+ /** One question asked before a demo is booked. The prospect taps one of `options`. */
387
+ interface BookingQuestion {
388
+ /**
389
+ * Stable name for the question, e.g. `"language"` — lower case letters,
390
+ * digits, `-` and `_`. Leave it out on a new question and one is made from
391
+ * the label; keep it when rewording so earlier answers still line up.
392
+ */
393
+ id: string;
394
+ /** What is asked, up to 80 characters. */
395
+ label: string;
396
+ /** 2–9 choices, up to 40 characters each. */
397
+ options: string[];
398
+ /** False lets the prospect skip it. */
399
+ required: boolean;
400
+ }
401
+ /** A question as you send it: `id` and `required` may be left out on a new one. */
402
+ type BookingQuestionInput = Omit<BookingQuestion, "id" | "required"> & {
403
+ id?: string;
404
+ required?: boolean;
405
+ };
406
+ /** What {@link updateBookingSettings} accepts — any subset of the settings. */
407
+ type BookingSettingsChanges = Partial<Omit<BookingSettings, "questions">> & {
408
+ questions?: BookingQuestionInput[];
409
+ };
410
+ /** One answer a prospect gave, with the question as it was worded when they booked. */
411
+ interface BookingAnswer {
412
+ /** The {@link BookingQuestion.id} it answers. */
413
+ id: string;
414
+ question: string;
415
+ answer: string;
378
416
  }
379
417
  /** One extra person alerted when a demo is booked. */
380
418
  interface BookingNotifyRecipient {
@@ -414,7 +452,7 @@ declare function getBookingSettings(options?: CallsOptions): Promise<BookingSett
414
452
  * `error` is worth showing: a WhatsApp code already taken by another project
415
453
  * comes back as one.
416
454
  */
417
- declare function updateBookingSettings(changes: Partial<BookingSettings>, options?: CallsOptions): Promise<BookingSettingsResult>;
455
+ declare function updateBookingSettings(changes: BookingSettingsChanges, options?: CallsOptions): Promise<BookingSettingsResult>;
418
456
  /** One booked demo. Times are ISO strings in UTC; `timezone` is what the prospect picked in. */
419
457
  interface Booking {
420
458
  id: string;
@@ -429,6 +467,8 @@ interface Booking {
429
467
  timezone: string | null;
430
468
  /** What they typed when booking, if anything. */
431
469
  note: string | null;
470
+ /** What they answered to the project's {@link BookingSettings.questions}. Empty when nothing was asked. */
471
+ answers: BookingAnswer[];
432
472
  /** `CONFIRMED` or `CANCELLED`. Unverified holds are never returned. */
433
473
  status: string;
434
474
  /** The Google Meet room. Null until the booking is confirmed. */
@@ -551,4 +591,4 @@ interface ListLeadsOptions extends CallsOptions {
551
591
  */
552
592
  declare function listLeads(options?: ListLeadsOptions): Promise<Lead[]>;
553
593
 
554
- export { type Booking, type BookingClientNotice, type BookingMutationResult, type BookingNotifyRecipient, type BookingSettings, type BookingSettingsResult, type BookingSettingsState, type BookingWorkingHours, type Call, type CallAudio, type CallListItem, type CallMoment, type CallParticipant, type CallsOptions, type CaptureServerErrorsOptions, type DeleteCallResult, type GetCallOptions, type Guide, type GuideReadOptions, type GuideSummary, type Lead, type ListBookingsOptions, type ListCallsOptions, type ListLeadsOptions, ReportResult, ReportSeverity, ReportType, type ServerReportOptions, type ServerReporterConfig, type ServerReporterIdentity, type SignSessionOptions, cancelBooking, captureServerErrors, configureServerReporter, deleteCall, escapeJsonForScript, getBookingSettings, getCall, getGuide, listBookings, listCalls, listGuides, listLeads, reportServerError, rescheduleBooking, resetServerReporter, signSession, updateBookingSettings };
594
+ export { type Booking, type BookingAnswer, type BookingClientNotice, type BookingMutationResult, type BookingNotifyRecipient, type BookingQuestion, type BookingQuestionInput, type BookingSettings, type BookingSettingsChanges, type BookingSettingsResult, type BookingSettingsState, type BookingWorkingHours, type Call, type CallAudio, type CallListItem, type CallMoment, type CallParticipant, type CallsOptions, type CaptureServerErrorsOptions, type DeleteCallResult, type GetCallOptions, type Guide, type GuideReadOptions, type GuideSummary, type Lead, type ListBookingsOptions, type ListCallsOptions, type ListLeadsOptions, ReportResult, ReportSeverity, ReportType, type ServerReportOptions, type ServerReporterConfig, type ServerReporterIdentity, type SignSessionOptions, cancelBooking, captureServerErrors, configureServerReporter, deleteCall, escapeJsonForScript, getBookingSettings, getCall, getGuide, listBookings, listCalls, listGuides, listLeads, reportServerError, rescheduleBooking, resetServerReporter, signSession, updateBookingSettings };
package/dist/server.d.ts CHANGED
@@ -375,6 +375,44 @@ interface BookingSettings {
375
375
  * change it; leave the field out and it keeps what is stored.
376
376
  */
377
377
  notifyRecipients: BookingNotifyRecipient[];
378
+ /**
379
+ * What a prospect is asked before they see the calendar — in the booking
380
+ * dialog and over WhatsApp — so the right person takes the demo. At most 5.
381
+ * Send the whole list to change it (`[]` asks nothing); leave the field out
382
+ * and it keeps what is stored. The answers come back on {@link Booking.answers}.
383
+ */
384
+ questions: BookingQuestion[];
385
+ }
386
+ /** One question asked before a demo is booked. The prospect taps one of `options`. */
387
+ interface BookingQuestion {
388
+ /**
389
+ * Stable name for the question, e.g. `"language"` — lower case letters,
390
+ * digits, `-` and `_`. Leave it out on a new question and one is made from
391
+ * the label; keep it when rewording so earlier answers still line up.
392
+ */
393
+ id: string;
394
+ /** What is asked, up to 80 characters. */
395
+ label: string;
396
+ /** 2–9 choices, up to 40 characters each. */
397
+ options: string[];
398
+ /** False lets the prospect skip it. */
399
+ required: boolean;
400
+ }
401
+ /** A question as you send it: `id` and `required` may be left out on a new one. */
402
+ type BookingQuestionInput = Omit<BookingQuestion, "id" | "required"> & {
403
+ id?: string;
404
+ required?: boolean;
405
+ };
406
+ /** What {@link updateBookingSettings} accepts — any subset of the settings. */
407
+ type BookingSettingsChanges = Partial<Omit<BookingSettings, "questions">> & {
408
+ questions?: BookingQuestionInput[];
409
+ };
410
+ /** One answer a prospect gave, with the question as it was worded when they booked. */
411
+ interface BookingAnswer {
412
+ /** The {@link BookingQuestion.id} it answers. */
413
+ id: string;
414
+ question: string;
415
+ answer: string;
378
416
  }
379
417
  /** One extra person alerted when a demo is booked. */
380
418
  interface BookingNotifyRecipient {
@@ -414,7 +452,7 @@ declare function getBookingSettings(options?: CallsOptions): Promise<BookingSett
414
452
  * `error` is worth showing: a WhatsApp code already taken by another project
415
453
  * comes back as one.
416
454
  */
417
- declare function updateBookingSettings(changes: Partial<BookingSettings>, options?: CallsOptions): Promise<BookingSettingsResult>;
455
+ declare function updateBookingSettings(changes: BookingSettingsChanges, options?: CallsOptions): Promise<BookingSettingsResult>;
418
456
  /** One booked demo. Times are ISO strings in UTC; `timezone` is what the prospect picked in. */
419
457
  interface Booking {
420
458
  id: string;
@@ -429,6 +467,8 @@ interface Booking {
429
467
  timezone: string | null;
430
468
  /** What they typed when booking, if anything. */
431
469
  note: string | null;
470
+ /** What they answered to the project's {@link BookingSettings.questions}. Empty when nothing was asked. */
471
+ answers: BookingAnswer[];
432
472
  /** `CONFIRMED` or `CANCELLED`. Unverified holds are never returned. */
433
473
  status: string;
434
474
  /** The Google Meet room. Null until the booking is confirmed. */
@@ -551,4 +591,4 @@ interface ListLeadsOptions extends CallsOptions {
551
591
  */
552
592
  declare function listLeads(options?: ListLeadsOptions): Promise<Lead[]>;
553
593
 
554
- export { type Booking, type BookingClientNotice, type BookingMutationResult, type BookingNotifyRecipient, type BookingSettings, type BookingSettingsResult, type BookingSettingsState, type BookingWorkingHours, type Call, type CallAudio, type CallListItem, type CallMoment, type CallParticipant, type CallsOptions, type CaptureServerErrorsOptions, type DeleteCallResult, type GetCallOptions, type Guide, type GuideReadOptions, type GuideSummary, type Lead, type ListBookingsOptions, type ListCallsOptions, type ListLeadsOptions, ReportResult, ReportSeverity, ReportType, type ServerReportOptions, type ServerReporterConfig, type ServerReporterIdentity, type SignSessionOptions, cancelBooking, captureServerErrors, configureServerReporter, deleteCall, escapeJsonForScript, getBookingSettings, getCall, getGuide, listBookings, listCalls, listGuides, listLeads, reportServerError, rescheduleBooking, resetServerReporter, signSession, updateBookingSettings };
594
+ export { type Booking, type BookingAnswer, type BookingClientNotice, type BookingMutationResult, type BookingNotifyRecipient, type BookingQuestion, type BookingQuestionInput, type BookingSettings, type BookingSettingsChanges, type BookingSettingsResult, type BookingSettingsState, type BookingWorkingHours, type Call, type CallAudio, type CallListItem, type CallMoment, type CallParticipant, type CallsOptions, type CaptureServerErrorsOptions, type DeleteCallResult, type GetCallOptions, type Guide, type GuideReadOptions, type GuideSummary, type Lead, type ListBookingsOptions, type ListCallsOptions, type ListLeadsOptions, ReportResult, ReportSeverity, ReportType, type ServerReportOptions, type ServerReporterConfig, type ServerReporterIdentity, type SignSessionOptions, cancelBooking, captureServerErrors, configureServerReporter, deleteCall, escapeJsonForScript, getBookingSettings, getCall, getGuide, listBookings, listCalls, listGuides, listLeads, reportServerError, rescheduleBooking, resetServerReporter, signSession, updateBookingSettings };
package/dist/server.js CHANGED
@@ -500,7 +500,16 @@ function readBookingSettingsState(value) {
500
500
  name: (_a2 = stringOrNull(row.name)) != null ? _a2 : "",
501
501
  phone: (_b2 = stringOrNull(row.phone)) != null ? _b2 : ""
502
502
  };
503
- }).filter((row) => row.phone !== "") : []
503
+ }).filter((row) => row.phone !== "") : [],
504
+ questions: Array.isArray(s.questions) ? s.questions.filter(isRecord).map((row) => {
505
+ var _a2, _b2;
506
+ return {
507
+ id: (_a2 = stringOrNull(row.id)) != null ? _a2 : "",
508
+ label: (_b2 = stringOrNull(row.label)) != null ? _b2 : "",
509
+ options: Array.isArray(row.options) ? row.options.filter((option) => typeof option === "string") : [],
510
+ required: row.required !== false
511
+ };
512
+ }).filter((row) => row.id !== "" && row.label !== "") : []
504
513
  },
505
514
  saved: value.saved === true,
506
515
  calendarConnected: value.calendarConnected === true
@@ -544,6 +553,14 @@ function readBooking(value) {
544
553
  endsAt: (_e = stringOrNull(value.endsAt)) != null ? _e : "",
545
554
  timezone: stringOrNull(value.timezone),
546
555
  note: stringOrNull(value.note),
556
+ answers: Array.isArray(value.answers) ? value.answers.filter(isRecord).map((row) => {
557
+ var _a2, _b2, _c2;
558
+ return {
559
+ id: (_a2 = stringOrNull(row.id)) != null ? _a2 : "",
560
+ question: (_b2 = stringOrNull(row.question)) != null ? _b2 : "",
561
+ answer: (_c2 = stringOrNull(row.answer)) != null ? _c2 : ""
562
+ };
563
+ }).filter((row) => row.answer !== "") : [],
547
564
  status: (_f = stringOrNull(value.status)) != null ? _f : "CONFIRMED",
548
565
  meetUrl: stringOrNull(value.meetUrl),
549
566
  createdAt: (_g = stringOrNull(value.createdAt)) != null ? _g : ""