@vendasta/meetings 1.9.1 → 1.10.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.
@@ -7391,10 +7391,13 @@ class EventTypeSummary {
7391
7391
  return toReturn;
7392
7392
  }
7393
7393
  }
7394
- class ListAvailabilityRequestFilters {
7394
+ class ListBookedMeetingsRequestFilters {
7395
7395
  static fromProto(proto) {
7396
- let m = new ListAvailabilityRequestFilters();
7396
+ let m = new ListBookedMeetingsRequestFilters();
7397
7397
  m = Object.assign(m, proto);
7398
+ if (proto.timeSpan) {
7399
+ m.timeSpan = DateRange.fromProto(proto.timeSpan);
7400
+ }
7398
7401
  return m;
7399
7402
  }
7400
7403
  constructor(kwargs) {
@@ -7405,22 +7408,25 @@ class ListAvailabilityRequestFilters {
7405
7408
  }
7406
7409
  toApiJson() {
7407
7410
  const toReturn = {};
7411
+ if (typeof this.meetingTypeIds !== 'undefined') {
7412
+ toReturn['meetingTypeIds'] = this.meetingTypeIds;
7413
+ }
7408
7414
  if (typeof this.hostId !== 'undefined') {
7409
7415
  toReturn['hostId'] = this.hostId;
7410
7416
  }
7411
- if (typeof this.meetingTypeId !== 'undefined') {
7412
- toReturn['meetingTypeId'] = this.meetingTypeId;
7417
+ if (typeof this.timeSpan !== 'undefined' && this.timeSpan !== null) {
7418
+ toReturn['timeSpan'] = 'toApiJson' in this.timeSpan ? this.timeSpan.toApiJson() : this.timeSpan;
7419
+ }
7420
+ if (typeof this.userIds !== 'undefined') {
7421
+ toReturn['userIds'] = this.userIds;
7413
7422
  }
7414
7423
  return toReturn;
7415
7424
  }
7416
7425
  }
7417
- class ListBookedMeetingsRequestFilters {
7426
+ class ListAvailabilityRequestFilters {
7418
7427
  static fromProto(proto) {
7419
- let m = new ListBookedMeetingsRequestFilters();
7428
+ let m = new ListAvailabilityRequestFilters();
7420
7429
  m = Object.assign(m, proto);
7421
- if (proto.timeSpan) {
7422
- m.timeSpan = DateRange.fromProto(proto.timeSpan);
7423
- }
7424
7430
  return m;
7425
7431
  }
7426
7432
  constructor(kwargs) {
@@ -7431,17 +7437,11 @@ class ListBookedMeetingsRequestFilters {
7431
7437
  }
7432
7438
  toApiJson() {
7433
7439
  const toReturn = {};
7434
- if (typeof this.meetingTypeIds !== 'undefined') {
7435
- toReturn['meetingTypeIds'] = this.meetingTypeIds;
7436
- }
7437
7440
  if (typeof this.hostId !== 'undefined') {
7438
7441
  toReturn['hostId'] = this.hostId;
7439
7442
  }
7440
- if (typeof this.timeSpan !== 'undefined' && this.timeSpan !== null) {
7441
- toReturn['timeSpan'] = 'toApiJson' in this.timeSpan ? this.timeSpan.toApiJson() : this.timeSpan;
7442
- }
7443
- if (typeof this.userIds !== 'undefined') {
7444
- toReturn['userIds'] = this.userIds;
7443
+ if (typeof this.meetingTypeId !== 'undefined') {
7444
+ toReturn['meetingTypeId'] = this.meetingTypeId;
7445
7445
  }
7446
7446
  return toReturn;
7447
7447
  }
@@ -7673,6 +7673,109 @@ class GetHostsForCalendarResponse {
7673
7673
  return toReturn;
7674
7674
  }
7675
7675
  }
7676
+ class GetMeetingStatsRequest {
7677
+ static fromProto(proto) {
7678
+ let m = new GetMeetingStatsRequest();
7679
+ m = Object.assign(m, proto);
7680
+ if (proto.timeSpan) {
7681
+ m.timeSpan = DateRange.fromProto(proto.timeSpan);
7682
+ }
7683
+ if (proto.timeZone) {
7684
+ m.timeZone = TimeZone.fromProto(proto.timeZone);
7685
+ }
7686
+ return m;
7687
+ }
7688
+ constructor(kwargs) {
7689
+ if (!kwargs) {
7690
+ return;
7691
+ }
7692
+ Object.assign(this, kwargs);
7693
+ }
7694
+ toApiJson() {
7695
+ const toReturn = {};
7696
+ if (typeof this.timeSpan !== 'undefined' && this.timeSpan !== null) {
7697
+ toReturn['timeSpan'] = 'toApiJson' in this.timeSpan ? this.timeSpan.toApiJson() : this.timeSpan;
7698
+ }
7699
+ if (typeof this.timeZone !== 'undefined' && this.timeZone !== null) {
7700
+ toReturn['timeZone'] = 'toApiJson' in this.timeZone ? this.timeZone.toApiJson() : this.timeZone;
7701
+ }
7702
+ if (typeof this.businessId !== 'undefined') {
7703
+ toReturn['businessId'] = this.businessId;
7704
+ }
7705
+ return toReturn;
7706
+ }
7707
+ }
7708
+ class GetMeetingStatsResponse {
7709
+ static fromProto(proto) {
7710
+ let m = new GetMeetingStatsResponse();
7711
+ m = Object.assign(m, proto);
7712
+ if (proto.totalMeetingsScheduled) {
7713
+ m.totalMeetingsScheduled = parseInt(proto.totalMeetingsScheduled, 10);
7714
+ }
7715
+ if (proto.previousTotalMeetingsScheduled) {
7716
+ m.previousTotalMeetingsScheduled = parseInt(proto.previousTotalMeetingsScheduled, 10);
7717
+ }
7718
+ if (proto.dailyMeetingsScheduled) {
7719
+ m.dailyMeetingsScheduled = proto.dailyMeetingsScheduled.map(MeetingStatPoint.fromProto);
7720
+ }
7721
+ if (proto.totalMeetingsCancelled) {
7722
+ m.totalMeetingsCancelled = parseInt(proto.totalMeetingsCancelled, 10);
7723
+ }
7724
+ if (proto.totalMeetingsRescheduled) {
7725
+ m.totalMeetingsRescheduled = parseInt(proto.totalMeetingsRescheduled, 10);
7726
+ }
7727
+ if (proto.totalAbandonedCarts) {
7728
+ m.totalAbandonedCarts = parseInt(proto.totalAbandonedCarts, 10);
7729
+ }
7730
+ if (proto.totalCalendarDisconnected) {
7731
+ m.totalCalendarDisconnected = parseInt(proto.totalCalendarDisconnected, 10);
7732
+ }
7733
+ if (proto.totalBookedByAiChat) {
7734
+ m.totalBookedByAiChat = parseInt(proto.totalBookedByAiChat, 10);
7735
+ }
7736
+ if (proto.totalBookedByAiVoice) {
7737
+ m.totalBookedByAiVoice = parseInt(proto.totalBookedByAiVoice, 10);
7738
+ }
7739
+ return m;
7740
+ }
7741
+ constructor(kwargs) {
7742
+ if (!kwargs) {
7743
+ return;
7744
+ }
7745
+ Object.assign(this, kwargs);
7746
+ }
7747
+ toApiJson() {
7748
+ const toReturn = {};
7749
+ if (typeof this.totalMeetingsScheduled !== 'undefined') {
7750
+ toReturn['totalMeetingsScheduled'] = this.totalMeetingsScheduled;
7751
+ }
7752
+ if (typeof this.previousTotalMeetingsScheduled !== 'undefined') {
7753
+ toReturn['previousTotalMeetingsScheduled'] = this.previousTotalMeetingsScheduled;
7754
+ }
7755
+ if (typeof this.dailyMeetingsScheduled !== 'undefined' && this.dailyMeetingsScheduled !== null) {
7756
+ toReturn['dailyMeetingsScheduled'] = 'toApiJson' in this.dailyMeetingsScheduled ? this.dailyMeetingsScheduled.toApiJson() : this.dailyMeetingsScheduled;
7757
+ }
7758
+ if (typeof this.totalMeetingsCancelled !== 'undefined') {
7759
+ toReturn['totalMeetingsCancelled'] = this.totalMeetingsCancelled;
7760
+ }
7761
+ if (typeof this.totalMeetingsRescheduled !== 'undefined') {
7762
+ toReturn['totalMeetingsRescheduled'] = this.totalMeetingsRescheduled;
7763
+ }
7764
+ if (typeof this.totalAbandonedCarts !== 'undefined') {
7765
+ toReturn['totalAbandonedCarts'] = this.totalAbandonedCarts;
7766
+ }
7767
+ if (typeof this.totalCalendarDisconnected !== 'undefined') {
7768
+ toReturn['totalCalendarDisconnected'] = this.totalCalendarDisconnected;
7769
+ }
7770
+ if (typeof this.totalBookedByAiChat !== 'undefined') {
7771
+ toReturn['totalBookedByAiChat'] = this.totalBookedByAiChat;
7772
+ }
7773
+ if (typeof this.totalBookedByAiVoice !== 'undefined') {
7774
+ toReturn['totalBookedByAiVoice'] = this.totalBookedByAiVoice;
7775
+ }
7776
+ return toReturn;
7777
+ }
7778
+ }
7676
7779
  class GetMeetingTypesForCalendarsRequest {
7677
7780
  static fromProto(proto) {
7678
7781
  let m = new GetMeetingTypesForCalendarsRequest();
@@ -9088,6 +9191,35 @@ class Meeting {
9088
9191
  return toReturn;
9089
9192
  }
9090
9193
  }
9194
+ class MeetingStatPoint {
9195
+ static fromProto(proto) {
9196
+ let m = new MeetingStatPoint();
9197
+ m = Object.assign(m, proto);
9198
+ if (proto.date) {
9199
+ m.date = new Date(proto.date);
9200
+ }
9201
+ if (proto.count) {
9202
+ m.count = parseInt(proto.count, 10);
9203
+ }
9204
+ return m;
9205
+ }
9206
+ constructor(kwargs) {
9207
+ if (!kwargs) {
9208
+ return;
9209
+ }
9210
+ Object.assign(this, kwargs);
9211
+ }
9212
+ toApiJson() {
9213
+ const toReturn = {};
9214
+ if (typeof this.date !== 'undefined' && this.date !== null) {
9215
+ toReturn['date'] = 'toApiJson' in this.date ? this.date.toApiJson() : this.date;
9216
+ }
9217
+ if (typeof this.count !== 'undefined') {
9218
+ toReturn['count'] = this.count;
9219
+ }
9220
+ return toReturn;
9221
+ }
9222
+ }
9091
9223
  class MeetingTypeList {
9092
9224
  static fromProto(proto) {
9093
9225
  let m = new MeetingTypeList();
@@ -9111,9 +9243,9 @@ class MeetingTypeList {
9111
9243
  return toReturn;
9112
9244
  }
9113
9245
  }
9114
- class UpdateMeetingMetadataRequestMetadataEntry {
9246
+ class HostBookBatchMeetingRequestMetadataEntry {
9115
9247
  static fromProto(proto) {
9116
- let m = new UpdateMeetingMetadataRequestMetadataEntry();
9248
+ let m = new HostBookBatchMeetingRequestMetadataEntry();
9117
9249
  m = Object.assign(m, proto);
9118
9250
  return m;
9119
9251
  }
@@ -9134,9 +9266,9 @@ class UpdateMeetingMetadataRequestMetadataEntry {
9134
9266
  return toReturn;
9135
9267
  }
9136
9268
  }
9137
- class HostBookBatchMeetingRequestMetadataEntry {
9269
+ class MeetingMetadataEntry {
9138
9270
  static fromProto(proto) {
9139
- let m = new HostBookBatchMeetingRequestMetadataEntry();
9271
+ let m = new MeetingMetadataEntry();
9140
9272
  m = Object.assign(m, proto);
9141
9273
  return m;
9142
9274
  }
@@ -9157,9 +9289,9 @@ class HostBookBatchMeetingRequestMetadataEntry {
9157
9289
  return toReturn;
9158
9290
  }
9159
9291
  }
9160
- class MeetingMetadataEntry {
9292
+ class UpdateMeetingMetadataRequestMetadataEntry {
9161
9293
  static fromProto(proto) {
9162
- let m = new MeetingMetadataEntry();
9294
+ let m = new UpdateMeetingMetadataRequestMetadataEntry();
9163
9295
  m = Object.assign(m, proto);
9164
9296
  return m;
9165
9297
  }
@@ -10726,6 +10858,11 @@ class MeetingHostApiService {
10726
10858
  return this.http.post(this._host + "/meetings.v1.MeetingHost/ListBookedMeetingsV2", request.toApiJson(), this.apiOptions())
10727
10859
  .pipe(map(resp => ListBookedMeetingsV2Response.fromProto(resp)));
10728
10860
  }
10861
+ getMeetingStats(r) {
10862
+ const request = (r.toApiJson) ? r : new GetMeetingStatsRequest(r);
10863
+ return this.http.post(this._host + "/meetings.v1.MeetingHost/GetMeetingStats", request.toApiJson(), this.apiOptions())
10864
+ .pipe(map(resp => GetMeetingStatsResponse.fromProto(resp)));
10865
+ }
10729
10866
  cancelMeeting(r) {
10730
10867
  const request = (r.toApiJson) ? r : new CancelMeetingRequest(r);
10731
10868
  return this.http.post(this._host + "/meetings.v1.MeetingHost/CancelMeeting", request.toApiJson(), Object.assign(Object.assign({}, this.apiOptions()), { observe: 'response' }));
@@ -11182,6 +11319,23 @@ var MeetingSourceOrigin;
11182
11319
  MeetingSourceOrigin["SalesCenter"] = "sales-center";
11183
11320
  })(MeetingSourceOrigin || (MeetingSourceOrigin = {}));
11184
11321
 
11322
+ function meetingStatsFromApi(resp) {
11323
+ return {
11324
+ totalMeetingsScheduled: resp.totalMeetingsScheduled || 0,
11325
+ previousTotalMeetingsScheduled: resp.previousTotalMeetingsScheduled || 0,
11326
+ dailyMeetingsScheduled: (resp.dailyMeetingsScheduled || []).map((point) => ({
11327
+ date: point.date,
11328
+ count: point.count || 0,
11329
+ })),
11330
+ totalMeetingsCancelled: resp.totalMeetingsCancelled || 0,
11331
+ totalMeetingsRescheduled: resp.totalMeetingsRescheduled || 0,
11332
+ totalAbandonedCarts: resp.totalAbandonedCarts || 0,
11333
+ totalCalendarDisconnected: resp.totalCalendarDisconnected || 0,
11334
+ totalBookedByAiChat: resp.totalBookedByAiChat || 0,
11335
+ totalBookedByAiVoice: resp.totalBookedByAiVoice || 0,
11336
+ };
11337
+ }
11338
+
11185
11339
  class GuestService {
11186
11340
  constructor(guestAPIService) {
11187
11341
  this.guestAPIService = guestAPIService;
@@ -11681,6 +11835,18 @@ class HostService {
11681
11835
  hostCancelBatchMeeting(req) {
11682
11836
  return this.hostAPIService.hostCancelBatchMeeting(req).pipe(mapTo(null));
11683
11837
  }
11838
+ // getMeetingStats returns aggregated meeting statistics for the host, backing the
11839
+ // "My Meetings" dashboard card. timeSpan must be expressed in the caller's time zone;
11840
+ // timeZone is used to bucket meetings into days and to align the comparison period.
11841
+ getMeetingStats(req) {
11842
+ return this.hostAPIService
11843
+ .getMeetingStats({
11844
+ timeSpan: req.timeSpan,
11845
+ timeZone: req.timeZone,
11846
+ businessId: req.businessId,
11847
+ })
11848
+ .pipe(map((resp) => meetingStatsFromApi(resp)));
11849
+ }
11684
11850
  // hostListBatchAvailableTimeSlots returns valid chain start times for a
11685
11851
  // multi-service host booking. Each slot is the start of the first meeting
11686
11852
  // in the chain.