glitchgrab 1.62.3 → 1.62.5

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
@@ -643,11 +643,19 @@ interface FollowUp {
643
643
  /** Digits, `91` + 10. */
644
644
  phone: string | null;
645
645
  name: string | null;
646
+ /** The customer's business (Abhyasika: the library name), as you sent it. */
647
+ businessName: string | null;
646
648
  /** ISO. The booked next call. */
647
649
  nextCallAt: string | null;
648
650
  nextCallBookedBy: string | null;
649
651
  due: FollowUpDue;
650
- /** ISO. Read from the last call's transcript — shown as a suggestion, never booked by itself. */
652
+ /** The next call with why it is happening (#670). Null when nothing is booked. */
653
+ booking: FollowUpBooking | null;
654
+ /**
655
+ * ISO. Read from the last call's transcript. Since #670 a call's suggestion
656
+ * is booked by itself (see `booking.auto`); it stays only a suggestion when
657
+ * a person's own booking already stands.
658
+ */
651
659
  suggestedNextCallAt: string | null;
652
660
  suggestedNextCallReason: string | null;
653
661
  lastNote: string | null;
@@ -665,6 +673,19 @@ interface FollowUp {
665
673
  ringingPhone: string | null;
666
674
  } | null;
667
675
  }
676
+ interface FollowUpBooking {
677
+ /** ISO. */
678
+ at: string;
679
+ /** "Ravi → Sunita Patil (Shanti Study Room): set up auto-pay again" — show it under "Next call". */
680
+ reason: string | null;
681
+ /** Booked by Glitchgrab from the call summary — label it "Booked from the call summary". */
682
+ auto: boolean;
683
+ /** ISO. The caller tapped "Yes, keep it" on WhatsApp. */
684
+ confirmedAt: string | null;
685
+ /** The "keep this call?" WhatsApp reached whoever made the call. */
686
+ askedOnWhatsApp: boolean;
687
+ bookedBy: string | null;
688
+ }
668
689
  interface FollowUpNote {
669
690
  id: string;
670
691
  body: string;
@@ -673,6 +694,8 @@ interface FollowUpNote {
673
694
  author: string | null;
674
695
  callId: string | null;
675
696
  editedAt: string | null;
697
+ /** Who last edited it, when your app (or an import) said so. */
698
+ editedBy: string | null;
676
699
  createdAt: string;
677
700
  }
678
701
  interface FollowUpCall {
@@ -746,33 +769,58 @@ declare function listFollowUps(externalIds: string[], options?: CallsOptions): P
746
769
  declare function getFollowUp(externalId: string, options?: CallsOptions): Promise<FollowUpDetail | null>;
747
770
  /**
748
771
  * Add a note from your own screen. `phone` is needed the first time Glitchgrab
749
- * sees this externalId. Never throws.
772
+ * sees this externalId. `createdAt` / `editedAt` / `editedBy` copy a note from
773
+ * your old store with its real dates (past only; no webhook fires for it).
774
+ * Never throws.
750
775
  */
751
776
  declare function addFollowUpNote(externalId: string, note: {
752
777
  body: string;
753
778
  author?: string;
754
779
  phone?: string;
755
780
  name?: string;
781
+ businessName?: string;
782
+ createdAt?: Date | string;
783
+ editedAt?: Date | string | null;
784
+ editedBy?: string | null;
785
+ }, options?: CallsOptions): Promise<FollowUpWriteResult<{
786
+ id: string;
787
+ }>>;
788
+ /**
789
+ * Edit a note from your own screen: your app's notes and the note written from
790
+ * a call. A note someone wrote inside Glitchgrab can't be edited here (404).
791
+ * `editor` is shown as who edited it. Never throws.
792
+ */
793
+ declare function editFollowUpNote(externalId: string, noteId: string, edit: {
794
+ body: string;
795
+ editor?: string;
756
796
  }, options?: CallsOptions): Promise<FollowUpWriteResult<{
757
797
  id: string;
758
798
  }>>;
759
799
  /**
760
800
  * Book, move (`Date`/ISO) or clear (`null`) the next call. The reminder
761
- * WhatsApp goes to `operator`, else the project owner. Never throws.
801
+ * WhatsApp goes to `operator`, else the project owner. `reason` is read back
802
+ * as `booking.reason`; left out, a moved booking keeps its reason. A booking
803
+ * made here is never replaced by the next call's automatic one. Never throws.
762
804
  */
763
805
  declare function setFollowUpBooking(externalId: string, booking: {
764
806
  nextCallAt: Date | string | null;
807
+ reason?: string | null;
765
808
  operator?: FollowUpOperator;
766
809
  author?: string;
767
810
  phone?: string;
768
811
  name?: string;
812
+ businessName?: string;
769
813
  }, options?: CallsOptions): Promise<FollowUpWriteResult<{
770
814
  nextCallAt: string | null;
815
+ reason: string | null;
771
816
  }>>;
772
817
  /**
773
818
  * Start a recorded call: Glitchgrab rings `operator`'s phone, then the
774
- * customer, from the project's line. The operator must be on that line. A note
775
- * and a suggested next call follow once the call is transcribed. Never throws.
819
+ * customer, from the project's line. The operator must be on that line. Once
820
+ * the call is transcribed a note is written and the next call is booked from
821
+ * it with a reason (#670) — unless a person's booking already stands — and the
822
+ * operator is asked on WhatsApp to keep or remove it. `businessName` (the
823
+ * customer's business) is named in that reason. Never throws.
776
824
  *
777
825
  * `ringPhone` picks which of the operator's verified phones rings first (list
778
826
  * them with {@link getOperatorRingNumbers}); omitted = their Default. If that
@@ -787,6 +835,7 @@ declare function dialFollowUp(externalId: string, call: {
787
835
  phone?: string;
788
836
  toPhone?: string;
789
837
  name?: string;
838
+ businessName?: string;
790
839
  lineId?: string;
791
840
  ringPhone?: string;
792
841
  }, options?: CallsOptions): Promise<FollowUpWriteResult<{
@@ -929,4 +978,4 @@ declare function testRingNumber(id: string, options?: CallsOptions): Promise<Rin
929
978
  verified: boolean;
930
979
  }>>;
931
980
 
932
- 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 FollowUp, type FollowUpCall, type FollowUpDetail, type FollowUpDue, type FollowUpNote, type FollowUpOperator, type FollowUpWriteResult, type GetCallOptions, type Guide, type GuideReadOptions, type GuideSummary, type Lead, type LineCallerResult, type ListBookingsOptions, type ListCallsOptions, type ListLeadsOptions, type OperatorRingNumber, type OperatorRingNumbersResult, ReportResult, ReportSeverity, ReportType, type RingErrorCode, type RingNumber, type RingNumberList, type RingNumberWriteResult, type ServerReportOptions, type ServerReporterConfig, type ServerReporterIdentity, type SignSessionOptions, addFollowUpNote, addLineCaller, addRingNumber, cancelBooking, captureServerErrors, configureServerReporter, deleteCall, dialFollowUp, discardBookingQuestionsDraft, escapeJsonForScript, getBookingSettings, getCall, getFollowUp, getGuide, getOperatorRingNumbers, listBookings, listCalls, listFollowUps, listGuides, listLeads, listRingNumbers, publishBookingQuestions, removeLineCaller, removeRingNumber, reportServerError, rescheduleBooking, resetServerReporter, setFollowUpBooking, signSession, testRingNumber, updateBookingSettings, updateRingNumber };
981
+ 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 FollowUp, type FollowUpBooking, type FollowUpCall, type FollowUpDetail, type FollowUpDue, type FollowUpNote, type FollowUpOperator, type FollowUpWriteResult, type GetCallOptions, type Guide, type GuideReadOptions, type GuideSummary, type Lead, type LineCallerResult, type ListBookingsOptions, type ListCallsOptions, type ListLeadsOptions, type OperatorRingNumber, type OperatorRingNumbersResult, ReportResult, ReportSeverity, ReportType, type RingErrorCode, type RingNumber, type RingNumberList, type RingNumberWriteResult, type ServerReportOptions, type ServerReporterConfig, type ServerReporterIdentity, type SignSessionOptions, addFollowUpNote, addLineCaller, addRingNumber, cancelBooking, captureServerErrors, configureServerReporter, deleteCall, dialFollowUp, discardBookingQuestionsDraft, editFollowUpNote, escapeJsonForScript, getBookingSettings, getCall, getFollowUp, getGuide, getOperatorRingNumbers, listBookings, listCalls, listFollowUps, listGuides, listLeads, listRingNumbers, publishBookingQuestions, removeLineCaller, removeRingNumber, reportServerError, rescheduleBooking, resetServerReporter, setFollowUpBooking, signSession, testRingNumber, updateBookingSettings, updateRingNumber };
package/dist/server.d.ts CHANGED
@@ -643,11 +643,19 @@ interface FollowUp {
643
643
  /** Digits, `91` + 10. */
644
644
  phone: string | null;
645
645
  name: string | null;
646
+ /** The customer's business (Abhyasika: the library name), as you sent it. */
647
+ businessName: string | null;
646
648
  /** ISO. The booked next call. */
647
649
  nextCallAt: string | null;
648
650
  nextCallBookedBy: string | null;
649
651
  due: FollowUpDue;
650
- /** ISO. Read from the last call's transcript — shown as a suggestion, never booked by itself. */
652
+ /** The next call with why it is happening (#670). Null when nothing is booked. */
653
+ booking: FollowUpBooking | null;
654
+ /**
655
+ * ISO. Read from the last call's transcript. Since #670 a call's suggestion
656
+ * is booked by itself (see `booking.auto`); it stays only a suggestion when
657
+ * a person's own booking already stands.
658
+ */
651
659
  suggestedNextCallAt: string | null;
652
660
  suggestedNextCallReason: string | null;
653
661
  lastNote: string | null;
@@ -665,6 +673,19 @@ interface FollowUp {
665
673
  ringingPhone: string | null;
666
674
  } | null;
667
675
  }
676
+ interface FollowUpBooking {
677
+ /** ISO. */
678
+ at: string;
679
+ /** "Ravi → Sunita Patil (Shanti Study Room): set up auto-pay again" — show it under "Next call". */
680
+ reason: string | null;
681
+ /** Booked by Glitchgrab from the call summary — label it "Booked from the call summary". */
682
+ auto: boolean;
683
+ /** ISO. The caller tapped "Yes, keep it" on WhatsApp. */
684
+ confirmedAt: string | null;
685
+ /** The "keep this call?" WhatsApp reached whoever made the call. */
686
+ askedOnWhatsApp: boolean;
687
+ bookedBy: string | null;
688
+ }
668
689
  interface FollowUpNote {
669
690
  id: string;
670
691
  body: string;
@@ -673,6 +694,8 @@ interface FollowUpNote {
673
694
  author: string | null;
674
695
  callId: string | null;
675
696
  editedAt: string | null;
697
+ /** Who last edited it, when your app (or an import) said so. */
698
+ editedBy: string | null;
676
699
  createdAt: string;
677
700
  }
678
701
  interface FollowUpCall {
@@ -746,33 +769,58 @@ declare function listFollowUps(externalIds: string[], options?: CallsOptions): P
746
769
  declare function getFollowUp(externalId: string, options?: CallsOptions): Promise<FollowUpDetail | null>;
747
770
  /**
748
771
  * Add a note from your own screen. `phone` is needed the first time Glitchgrab
749
- * sees this externalId. Never throws.
772
+ * sees this externalId. `createdAt` / `editedAt` / `editedBy` copy a note from
773
+ * your old store with its real dates (past only; no webhook fires for it).
774
+ * Never throws.
750
775
  */
751
776
  declare function addFollowUpNote(externalId: string, note: {
752
777
  body: string;
753
778
  author?: string;
754
779
  phone?: string;
755
780
  name?: string;
781
+ businessName?: string;
782
+ createdAt?: Date | string;
783
+ editedAt?: Date | string | null;
784
+ editedBy?: string | null;
785
+ }, options?: CallsOptions): Promise<FollowUpWriteResult<{
786
+ id: string;
787
+ }>>;
788
+ /**
789
+ * Edit a note from your own screen: your app's notes and the note written from
790
+ * a call. A note someone wrote inside Glitchgrab can't be edited here (404).
791
+ * `editor` is shown as who edited it. Never throws.
792
+ */
793
+ declare function editFollowUpNote(externalId: string, noteId: string, edit: {
794
+ body: string;
795
+ editor?: string;
756
796
  }, options?: CallsOptions): Promise<FollowUpWriteResult<{
757
797
  id: string;
758
798
  }>>;
759
799
  /**
760
800
  * Book, move (`Date`/ISO) or clear (`null`) the next call. The reminder
761
- * WhatsApp goes to `operator`, else the project owner. Never throws.
801
+ * WhatsApp goes to `operator`, else the project owner. `reason` is read back
802
+ * as `booking.reason`; left out, a moved booking keeps its reason. A booking
803
+ * made here is never replaced by the next call's automatic one. Never throws.
762
804
  */
763
805
  declare function setFollowUpBooking(externalId: string, booking: {
764
806
  nextCallAt: Date | string | null;
807
+ reason?: string | null;
765
808
  operator?: FollowUpOperator;
766
809
  author?: string;
767
810
  phone?: string;
768
811
  name?: string;
812
+ businessName?: string;
769
813
  }, options?: CallsOptions): Promise<FollowUpWriteResult<{
770
814
  nextCallAt: string | null;
815
+ reason: string | null;
771
816
  }>>;
772
817
  /**
773
818
  * Start a recorded call: Glitchgrab rings `operator`'s phone, then the
774
- * customer, from the project's line. The operator must be on that line. A note
775
- * and a suggested next call follow once the call is transcribed. Never throws.
819
+ * customer, from the project's line. The operator must be on that line. Once
820
+ * the call is transcribed a note is written and the next call is booked from
821
+ * it with a reason (#670) — unless a person's booking already stands — and the
822
+ * operator is asked on WhatsApp to keep or remove it. `businessName` (the
823
+ * customer's business) is named in that reason. Never throws.
776
824
  *
777
825
  * `ringPhone` picks which of the operator's verified phones rings first (list
778
826
  * them with {@link getOperatorRingNumbers}); omitted = their Default. If that
@@ -787,6 +835,7 @@ declare function dialFollowUp(externalId: string, call: {
787
835
  phone?: string;
788
836
  toPhone?: string;
789
837
  name?: string;
838
+ businessName?: string;
790
839
  lineId?: string;
791
840
  ringPhone?: string;
792
841
  }, options?: CallsOptions): Promise<FollowUpWriteResult<{
@@ -929,4 +978,4 @@ declare function testRingNumber(id: string, options?: CallsOptions): Promise<Rin
929
978
  verified: boolean;
930
979
  }>>;
931
980
 
932
- 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 FollowUp, type FollowUpCall, type FollowUpDetail, type FollowUpDue, type FollowUpNote, type FollowUpOperator, type FollowUpWriteResult, type GetCallOptions, type Guide, type GuideReadOptions, type GuideSummary, type Lead, type LineCallerResult, type ListBookingsOptions, type ListCallsOptions, type ListLeadsOptions, type OperatorRingNumber, type OperatorRingNumbersResult, ReportResult, ReportSeverity, ReportType, type RingErrorCode, type RingNumber, type RingNumberList, type RingNumberWriteResult, type ServerReportOptions, type ServerReporterConfig, type ServerReporterIdentity, type SignSessionOptions, addFollowUpNote, addLineCaller, addRingNumber, cancelBooking, captureServerErrors, configureServerReporter, deleteCall, dialFollowUp, discardBookingQuestionsDraft, escapeJsonForScript, getBookingSettings, getCall, getFollowUp, getGuide, getOperatorRingNumbers, listBookings, listCalls, listFollowUps, listGuides, listLeads, listRingNumbers, publishBookingQuestions, removeLineCaller, removeRingNumber, reportServerError, rescheduleBooking, resetServerReporter, setFollowUpBooking, signSession, testRingNumber, updateBookingSettings, updateRingNumber };
981
+ 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 FollowUp, type FollowUpBooking, type FollowUpCall, type FollowUpDetail, type FollowUpDue, type FollowUpNote, type FollowUpOperator, type FollowUpWriteResult, type GetCallOptions, type Guide, type GuideReadOptions, type GuideSummary, type Lead, type LineCallerResult, type ListBookingsOptions, type ListCallsOptions, type ListLeadsOptions, type OperatorRingNumber, type OperatorRingNumbersResult, ReportResult, ReportSeverity, ReportType, type RingErrorCode, type RingNumber, type RingNumberList, type RingNumberWriteResult, type ServerReportOptions, type ServerReporterConfig, type ServerReporterIdentity, type SignSessionOptions, addFollowUpNote, addLineCaller, addRingNumber, cancelBooking, captureServerErrors, configureServerReporter, deleteCall, dialFollowUp, discardBookingQuestionsDraft, editFollowUpNote, escapeJsonForScript, getBookingSettings, getCall, getFollowUp, getGuide, getOperatorRingNumbers, listBookings, listCalls, listFollowUps, listGuides, listLeads, listRingNumbers, publishBookingQuestions, removeLineCaller, removeRingNumber, reportServerError, rescheduleBooking, resetServerReporter, setFollowUpBooking, signSession, testRingNumber, updateBookingSettings, updateRingNumber };
package/dist/server.js CHANGED
@@ -29,6 +29,7 @@ __export(server_exports, {
29
29
  deleteCall: () => deleteCall,
30
30
  dialFollowUp: () => dialFollowUp,
31
31
  discardBookingQuestionsDraft: () => discardBookingQuestionsDraft,
32
+ editFollowUpNote: () => editFollowUpNote,
32
33
  escapeJsonForScript: () => escapeJsonForScript,
33
34
  getBookingSettings: () => getBookingSettings,
34
35
  getCall: () => getCall,
@@ -744,9 +745,18 @@ function readFollowUp(value) {
744
745
  externalId: stringOrNull(value.externalId),
745
746
  phone: stringOrNull(value.phone),
746
747
  name: stringOrNull(value.name),
748
+ businessName: stringOrNull(value.businessName),
747
749
  nextCallAt: stringOrNull(value.nextCallAt),
748
750
  nextCallBookedBy: stringOrNull(value.nextCallBookedBy),
749
751
  due: typeof value.due === "string" && DUES.has(value.due) ? value.due : "none",
752
+ booking: isRecord(value.booking) && typeof value.booking.at === "string" ? {
753
+ at: value.booking.at,
754
+ reason: stringOrNull(value.booking.reason),
755
+ auto: value.booking.auto === true,
756
+ confirmedAt: stringOrNull(value.booking.confirmedAt),
757
+ askedOnWhatsApp: value.booking.askedOnWhatsApp === true,
758
+ bookedBy: stringOrNull(value.booking.bookedBy)
759
+ } : null,
750
760
  suggestedNextCallAt: stringOrNull(value.suggestedNextCallAt),
751
761
  suggestedNextCallReason: stringOrNull(value.suggestedNextCallReason),
752
762
  lastNote: stringOrNull(value.lastNote),
@@ -779,6 +789,7 @@ function readFollowUpDetail(value) {
779
789
  author: stringOrNull(n.author),
780
790
  callId: stringOrNull(n.callId),
781
791
  editedAt: stringOrNull(n.editedAt),
792
+ editedBy: stringOrNull(n.editedBy),
782
793
  createdAt: (_b = stringOrNull(n.createdAt)) != null ? _b : ""
783
794
  };
784
795
  }) : [],
@@ -847,14 +858,26 @@ async function getFollowUp(externalId, options = {}) {
847
858
  }
848
859
  }
849
860
  function addFollowUpNote(externalId, note, options = {}) {
850
- return writeFollowUp(followUpPath(externalId, "/notes"), "POST", note, options, (d) => ({
861
+ const iso = (v) => v instanceof Date ? v.toISOString() : v;
862
+ const body = { ...note, createdAt: iso(note.createdAt), editedAt: iso(note.editedAt) };
863
+ return writeFollowUp(followUpPath(externalId, "/notes"), "POST", body, options, (d) => ({
851
864
  id: typeof d.id === "string" ? d.id : ""
852
865
  }));
853
866
  }
867
+ function editFollowUpNote(externalId, noteId, edit, options = {}) {
868
+ return writeFollowUp(
869
+ followUpPath(externalId, `/notes/${encodeURIComponent(noteId)}`),
870
+ "PATCH",
871
+ edit,
872
+ options,
873
+ (d) => ({ id: typeof d.id === "string" ? d.id : "" })
874
+ );
875
+ }
854
876
  function setFollowUpBooking(externalId, booking, options = {}) {
855
877
  const at = booking.nextCallAt instanceof Date ? booking.nextCallAt.toISOString() : booking.nextCallAt;
856
878
  return writeFollowUp(followUpPath(externalId, "/booking"), "PUT", { ...booking, nextCallAt: at }, options, (d) => ({
857
- nextCallAt: stringOrNull(d.nextCallAt)
879
+ nextCallAt: stringOrNull(d.nextCallAt),
880
+ reason: stringOrNull(d.reason)
858
881
  }));
859
882
  }
860
883
  function dialFollowUp(externalId, call, options = {}) {
@@ -992,6 +1015,7 @@ function testRingNumber(id, options = {}) {
992
1015
  deleteCall,
993
1016
  dialFollowUp,
994
1017
  discardBookingQuestionsDraft,
1018
+ editFollowUpNote,
995
1019
  escapeJsonForScript,
996
1020
  getBookingSettings,
997
1021
  getCall,