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.mjs CHANGED
@@ -689,9 +689,18 @@ function readFollowUp(value) {
689
689
  externalId: stringOrNull(value.externalId),
690
690
  phone: stringOrNull(value.phone),
691
691
  name: stringOrNull(value.name),
692
+ businessName: stringOrNull(value.businessName),
692
693
  nextCallAt: stringOrNull(value.nextCallAt),
693
694
  nextCallBookedBy: stringOrNull(value.nextCallBookedBy),
694
695
  due: typeof value.due === "string" && DUES.has(value.due) ? value.due : "none",
696
+ booking: isRecord(value.booking) && typeof value.booking.at === "string" ? {
697
+ at: value.booking.at,
698
+ reason: stringOrNull(value.booking.reason),
699
+ auto: value.booking.auto === true,
700
+ confirmedAt: stringOrNull(value.booking.confirmedAt),
701
+ askedOnWhatsApp: value.booking.askedOnWhatsApp === true,
702
+ bookedBy: stringOrNull(value.booking.bookedBy)
703
+ } : null,
695
704
  suggestedNextCallAt: stringOrNull(value.suggestedNextCallAt),
696
705
  suggestedNextCallReason: stringOrNull(value.suggestedNextCallReason),
697
706
  lastNote: stringOrNull(value.lastNote),
@@ -724,6 +733,7 @@ function readFollowUpDetail(value) {
724
733
  author: stringOrNull(n.author),
725
734
  callId: stringOrNull(n.callId),
726
735
  editedAt: stringOrNull(n.editedAt),
736
+ editedBy: stringOrNull(n.editedBy),
727
737
  createdAt: (_b = stringOrNull(n.createdAt)) != null ? _b : ""
728
738
  };
729
739
  }) : [],
@@ -792,14 +802,26 @@ async function getFollowUp(externalId, options = {}) {
792
802
  }
793
803
  }
794
804
  function addFollowUpNote(externalId, note, options = {}) {
795
- return writeFollowUp(followUpPath(externalId, "/notes"), "POST", note, options, (d) => ({
805
+ const iso = (v) => v instanceof Date ? v.toISOString() : v;
806
+ const body = { ...note, createdAt: iso(note.createdAt), editedAt: iso(note.editedAt) };
807
+ return writeFollowUp(followUpPath(externalId, "/notes"), "POST", body, options, (d) => ({
796
808
  id: typeof d.id === "string" ? d.id : ""
797
809
  }));
798
810
  }
811
+ function editFollowUpNote(externalId, noteId, edit, options = {}) {
812
+ return writeFollowUp(
813
+ followUpPath(externalId, `/notes/${encodeURIComponent(noteId)}`),
814
+ "PATCH",
815
+ edit,
816
+ options,
817
+ (d) => ({ id: typeof d.id === "string" ? d.id : "" })
818
+ );
819
+ }
799
820
  function setFollowUpBooking(externalId, booking, options = {}) {
800
821
  const at = booking.nextCallAt instanceof Date ? booking.nextCallAt.toISOString() : booking.nextCallAt;
801
822
  return writeFollowUp(followUpPath(externalId, "/booking"), "PUT", { ...booking, nextCallAt: at }, options, (d) => ({
802
- nextCallAt: stringOrNull(d.nextCallAt)
823
+ nextCallAt: stringOrNull(d.nextCallAt),
824
+ reason: stringOrNull(d.reason)
803
825
  }));
804
826
  }
805
827
  function dialFollowUp(externalId, call, options = {}) {
@@ -936,6 +958,7 @@ export {
936
958
  deleteCall,
937
959
  dialFollowUp,
938
960
  discardBookingQuestionsDraft,
961
+ editFollowUpNote,
939
962
  escapeJsonForScript,
940
963
  getBookingSettings,
941
964
  getCall,