@blazeo.com/calendar-client 1.0.23 → 1.0.24

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.js CHANGED
@@ -22,9 +22,12 @@ __export(index_exports, {
22
22
  AssetModel: () => Asset_default,
23
23
  AssignmentMethod: () => AssignmentMethod,
24
24
  AttendeeStatus: () => AttendeeStatus,
25
+ AuthModel: () => Auth_default,
25
26
  AvailabilityDetailModel: () => AvailabilityDetail_default,
26
27
  AvailabilityModel: () => Availability_default,
28
+ CALENDAR_AUTH_MESSAGE_TYPE: () => CALENDAR_AUTH_MESSAGE_TYPE,
27
29
  CalendarDayModel: () => CalendarDay_default,
30
+ CalendarEmailProvider: () => EmailProvider2,
28
31
  CalendarLocationModel: () => CalendarLocation_default,
29
32
  CalendarModel: () => Calendar_default,
30
33
  CalendarParticipantModel: () => CalendarParticipant_default,
@@ -32,6 +35,7 @@ __export(index_exports, {
32
35
  ConfigModel: () => ConfigModel_default,
33
36
  CustomFieldModel: () => CustomField_default,
34
37
  DayOfWeek: () => DayOfWeek,
38
+ EmailProvider: () => EmailProvider,
35
39
  EventModel: () => Event_default,
36
40
  FlowModel: () => Flow_default,
37
41
  LeadModel: () => Lead_default,
@@ -228,6 +232,11 @@ var DayOfWeek = {
228
232
  Friday: 5,
229
233
  Saturday: 6
230
234
  };
235
+ var EmailProvider = {
236
+ Google: 1,
237
+ Microsoft: 2,
238
+ Default: 3
239
+ };
231
240
  var LocationType = {
232
241
  Physical: 0,
233
242
  Video: 1,
@@ -487,34 +496,34 @@ var EventModel = import_mobx_state_tree4.types.model("Event", {
487
496
  });
488
497
  function mapEventFromApi(d) {
489
498
  if (!d) return d;
490
- const pick = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
499
+ const pick2 = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
491
500
  const n = (v) => v != null && v !== "" ? Number(v) : void 0;
492
501
  return {
493
- eventId: String(pick("eventId", "EventId", "event_id") ?? ""),
494
- calendarId: String(pick("calendarId", "CalendarId", "calendar_id") ?? ""),
495
- participantId: pick("participantId", "ParticipantId", "participant_id") ?? null,
496
- title: pick("title", "Title"),
497
- description: pick("description", "Description"),
498
- startDate: pick("startDate", "StartDate", "start_date"),
499
- endDate: pick("endDate", "EndDate", "end_date"),
500
- startHour: n(pick("startHour", "StartHour", "start_hour")),
501
- startMinute: n(pick("startMinute", "StartMinute", "start_minute")),
502
- endHour: n(pick("endHour", "EndHour", "end_hour")),
503
- endMinute: n(pick("endMinute", "EndMinute", "end_minute")),
504
- visitorName: pick("visitorName", "VisitorName", "visitor_name"),
505
- visitorEmail: pick("visitorEmail", "VisitorEmail", "visitor_email"),
506
- visitorPhone: pick("visitorPhone", "VisitorPhone", "visitor_phone"),
507
- externalEventId: pick("externalEventId", "ExternalEventId", "external_event_id"),
508
- calendarLocationId: pick("calendarLocationId", "CalendarLocationId", "calendar_location_id"),
509
- customLocation: pick("customLocation", "CustomLocation", "custom_location"),
510
- flowId: pick("flowId", "FlowId", "flow_id"),
511
- flowPath: pick("flowPath", "FlowPath", "flow_path"),
512
- attendeeStatus: n(pick("attendeeStatus", "AttendeeStatus", "attendee_status")),
513
- rescheduleLink: pick("rescheduleLink", "RescheduleLink", "reschedule_link"),
514
- cancelLink: pick("cancelLink", "CancelLink", "cancel_link"),
515
- timeZone: pick("timeZone", "TimeZone", "time_zone"),
516
- createdOn: pick("createdOn", "CreatedOn", "created_on"),
517
- modifiedOn: pick("modifiedOn", "ModifiedOn", "modified_on")
502
+ eventId: String(pick2("eventId", "EventId", "event_id") ?? ""),
503
+ calendarId: String(pick2("calendarId", "CalendarId", "calendar_id") ?? ""),
504
+ participantId: pick2("participantId", "ParticipantId", "participant_id") ?? null,
505
+ title: pick2("title", "Title"),
506
+ description: pick2("description", "Description"),
507
+ startDate: pick2("startDate", "StartDate", "start_date"),
508
+ endDate: pick2("endDate", "EndDate", "end_date"),
509
+ startHour: n(pick2("startHour", "StartHour", "start_hour")),
510
+ startMinute: n(pick2("startMinute", "StartMinute", "start_minute")),
511
+ endHour: n(pick2("endHour", "EndHour", "end_hour")),
512
+ endMinute: n(pick2("endMinute", "EndMinute", "end_minute")),
513
+ visitorName: pick2("visitorName", "VisitorName", "visitor_name"),
514
+ visitorEmail: pick2("visitorEmail", "VisitorEmail", "visitor_email"),
515
+ visitorPhone: pick2("visitorPhone", "VisitorPhone", "visitor_phone"),
516
+ externalEventId: pick2("externalEventId", "ExternalEventId", "external_event_id"),
517
+ calendarLocationId: pick2("calendarLocationId", "CalendarLocationId", "calendar_location_id"),
518
+ customLocation: pick2("customLocation", "CustomLocation", "custom_location"),
519
+ flowId: pick2("flowId", "FlowId", "flow_id"),
520
+ flowPath: pick2("flowPath", "FlowPath", "flow_path"),
521
+ attendeeStatus: n(pick2("attendeeStatus", "AttendeeStatus", "attendee_status")),
522
+ rescheduleLink: pick2("rescheduleLink", "RescheduleLink", "reschedule_link"),
523
+ cancelLink: pick2("cancelLink", "CancelLink", "cancel_link"),
524
+ timeZone: pick2("timeZone", "TimeZone", "time_zone"),
525
+ createdOn: pick2("createdOn", "CreatedOn", "created_on"),
526
+ modifiedOn: pick2("modifiedOn", "ModifiedOn", "modified_on")
518
527
  };
519
528
  }
520
529
  EventModel.get = async (eventId) => {
@@ -768,14 +777,14 @@ var CalendarParticipantModel = import_mobx_state_tree6.types.model("CalendarPart
768
777
  });
769
778
  function mapFromApi(d) {
770
779
  if (!d) return d;
771
- const pick = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
780
+ const pick2 = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
772
781
  return {
773
- id: pick("id", "Id"),
774
- calendarParticipantId: String(pick("calendarParticipantId", "CalendarParticipantId", "calendarparticipant_id") ?? ""),
775
- participantId: String(pick("participantId", "ParticipantId", "participant_id") ?? ""),
776
- calendarId: String(pick("calendarId", "CalendarId", "calendar_id") ?? ""),
777
- createdOn: pick("createdOn", "CreatedOn", "created_on") ?? null,
778
- modifiedOn: pick("modifiedOn", "ModifiedOn", "modified_on") ?? null
782
+ id: pick2("id", "Id"),
783
+ calendarParticipantId: String(pick2("calendarParticipantId", "CalendarParticipantId", "calendarparticipant_id") ?? ""),
784
+ participantId: String(pick2("participantId", "ParticipantId", "participant_id") ?? ""),
785
+ calendarId: String(pick2("calendarId", "CalendarId", "calendar_id") ?? ""),
786
+ createdOn: pick2("createdOn", "CreatedOn", "created_on") ?? null,
787
+ modifiedOn: pick2("modifiedOn", "ModifiedOn", "modified_on") ?? null
779
788
  };
780
789
  }
781
790
  CalendarParticipantModel.getByCalendar = async (calendarId) => {
@@ -1043,30 +1052,30 @@ var CalendarModel = import_mobx_state_tree8.types.model("Calendar", {
1043
1052
  });
1044
1053
  function mapCalendarFromApi(d) {
1045
1054
  if (!d) return d;
1046
- const pick = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
1055
+ const pick2 = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
1047
1056
  const n = (v) => v != null && v !== "" ? Number(v) : void 0;
1048
1057
  return {
1049
- id: pick("id", "Id"),
1050
- companyKey: pick("companyKey", "CompanyKey", "company_key"),
1051
- calendarId: pick("calendarId", "CalendarId", "calendar_id") ?? "",
1052
- name: pick("name", "Name"),
1053
- timeZoneId: pick("timeZoneId", "TimeZoneId", "time_zone_id"),
1054
- purpose: pick("purpose", "Purpose") ?? "",
1055
- description: pick("description", "Description"),
1056
- assignmentMethod: n(pick("assignmentMethod", "AssignmentMethod", "assignment_method")),
1057
- duration: n(pick("duration", "Duration")),
1058
- durationUnit: n(pick("durationUnit", "DurationUnit", "duration_unit")),
1059
- minimumBookingNotice: n(pick("minimumBookingNotice", "MinimumBookingNotice", "minimum_booking_notice")),
1060
- minimumBookingNoticeUnit: n(pick("minimumBookingNoticeUnit", "MinimumBookingNoticeUnit", "minimum_booking_notice_unit")),
1061
- minimumCancelationNotice: n(pick("minimumCancelationNotice", "MinimumCancelationNotice", "minimum_cancelation_notice")),
1062
- minimumCancelationNoticeUnit: n(pick("minimumCancelationNoticeUnit", "MinimumCancelationNoticeUnit", "minimum_cancelation_notice_unit")),
1063
- futureLimit: n(pick("futureLimit", "FutureLimit", "future_limit")),
1064
- futureLimitUnit: n(pick("futureLimitUnit", "FutureLimitUnit", "future_limit_unit")),
1065
- bufferTime: n(pick("bufferTime", "BufferTime", "buffer_time")),
1066
- bufferTimeUnit: n(pick("bufferTimeUnit", "BufferTimeUnit", "buffer_time_unit")),
1067
- bookingLimit: n(pick("bookingLimit", "BookingLimit", "booking_limit")),
1068
- createdOn: pick("createdOn", "CreatedOn", "created_on"),
1069
- modifiedOn: pick("modifiedOn", "ModifiedOn", "modified_on")
1058
+ id: pick2("id", "Id"),
1059
+ companyKey: pick2("companyKey", "CompanyKey", "company_key"),
1060
+ calendarId: pick2("calendarId", "CalendarId", "calendar_id") ?? "",
1061
+ name: pick2("name", "Name"),
1062
+ timeZoneId: pick2("timeZoneId", "TimeZoneId", "time_zone_id"),
1063
+ purpose: pick2("purpose", "Purpose") ?? "",
1064
+ description: pick2("description", "Description"),
1065
+ assignmentMethod: n(pick2("assignmentMethod", "AssignmentMethod", "assignment_method")),
1066
+ duration: n(pick2("duration", "Duration")),
1067
+ durationUnit: n(pick2("durationUnit", "DurationUnit", "duration_unit")),
1068
+ minimumBookingNotice: n(pick2("minimumBookingNotice", "MinimumBookingNotice", "minimum_booking_notice")),
1069
+ minimumBookingNoticeUnit: n(pick2("minimumBookingNoticeUnit", "MinimumBookingNoticeUnit", "minimum_booking_notice_unit")),
1070
+ minimumCancelationNotice: n(pick2("minimumCancelationNotice", "MinimumCancelationNotice", "minimum_cancelation_notice")),
1071
+ minimumCancelationNoticeUnit: n(pick2("minimumCancelationNoticeUnit", "MinimumCancelationNoticeUnit", "minimum_cancelation_notice_unit")),
1072
+ futureLimit: n(pick2("futureLimit", "FutureLimit", "future_limit")),
1073
+ futureLimitUnit: n(pick2("futureLimitUnit", "FutureLimitUnit", "future_limit_unit")),
1074
+ bufferTime: n(pick2("bufferTime", "BufferTime", "buffer_time")),
1075
+ bufferTimeUnit: n(pick2("bufferTimeUnit", "BufferTimeUnit", "buffer_time_unit")),
1076
+ bookingLimit: n(pick2("bookingLimit", "BookingLimit", "booking_limit")),
1077
+ createdOn: pick2("createdOn", "CreatedOn", "created_on"),
1078
+ modifiedOn: pick2("modifiedOn", "ModifiedOn", "modified_on")
1070
1079
  };
1071
1080
  }
1072
1081
  CalendarModel.getRaw = async (calendarId) => {
@@ -1352,19 +1361,19 @@ var ParticipantModel = import_mobx_state_tree11.types.model("Participant", {
1352
1361
  });
1353
1362
  function mapFromApi2(d) {
1354
1363
  if (!d) return d;
1355
- const pick = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
1364
+ const pick2 = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
1356
1365
  const n = (v) => v != null && v !== "" ? Number(v) : void 0;
1357
1366
  return {
1358
- participantId: String(pick("participantId", "ParticipantId", "participant_id") ?? ""),
1359
- companyKey: pick("companyKey", "CompanyKey", "company_key") ?? null,
1360
- alias: pick("alias", "Alias") ?? "",
1361
- email: pick("email", "Email") ?? "",
1362
- isApproved: Boolean(pick("isApproved", "IsApproved", "is_approved")),
1363
- isAvailable: Boolean(pick("isAvailable", "IsAvailable", "is_available")),
1364
- provider: n(pick("provider", "Provider")) ?? 0,
1365
- createdOn: pick("createdOn", "CreatedOn", "created_on") ?? null,
1366
- modifiedOn: pick("modifiedOn", "ModifiedOn", "modified_on") ?? null,
1367
- isDeleted: Boolean(pick("isDeleted", "IsDeleted", "is_deleted"))
1367
+ participantId: String(pick2("participantId", "ParticipantId", "participant_id") ?? ""),
1368
+ companyKey: pick2("companyKey", "CompanyKey", "company_key") ?? null,
1369
+ alias: pick2("alias", "Alias") ?? "",
1370
+ email: pick2("email", "Email") ?? "",
1371
+ isApproved: Boolean(pick2("isApproved", "IsApproved", "is_approved")),
1372
+ isAvailable: Boolean(pick2("isAvailable", "IsAvailable", "is_available")),
1373
+ provider: n(pick2("provider", "Provider")) ?? 0,
1374
+ createdOn: pick2("createdOn", "CreatedOn", "created_on") ?? null,
1375
+ modifiedOn: pick2("modifiedOn", "ModifiedOn", "modified_on") ?? null,
1376
+ isDeleted: Boolean(pick2("isDeleted", "IsDeleted", "is_deleted"))
1368
1377
  };
1369
1378
  }
1370
1379
  function toPayload(self) {
@@ -1380,30 +1389,30 @@ function toPayload(self) {
1380
1389
  }
1381
1390
  function mapCalendarFromApi2(d) {
1382
1391
  if (!d) return d;
1383
- const pick = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
1392
+ const pick2 = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
1384
1393
  const n = (v) => v != null && v !== "" ? Number(v) : void 0;
1385
1394
  return {
1386
- id: pick("id", "Id"),
1387
- companyKey: pick("companyKey", "CompanyKey", "company_key") ?? null,
1388
- calendarId: String(pick("calendarId", "CalendarId", "calendar_id") ?? ""),
1389
- name: pick("name", "Name") ?? null,
1390
- timeZoneId: pick("timeZoneId", "TimeZoneId", "time_zone_id") ?? null,
1391
- purpose: pick("purpose", "Purpose") ?? "",
1392
- description: pick("description", "Description") ?? null,
1393
- assignmentMethod: n(pick("assignmentMethod", "AssignmentMethod", "assignment_method")) ?? void 0,
1394
- duration: n(pick("duration", "Duration")) ?? void 0,
1395
- durationUnit: n(pick("durationUnit", "DurationUnit", "duration_unit")) ?? void 0,
1396
- minimumBookingNotice: n(pick("minimumBookingNotice", "MinimumBookingNotice", "minimum_booking_notice")) ?? void 0,
1397
- minimumBookingNoticeUnit: n(pick("minimumBookingNoticeUnit", "MinimumBookingNoticeUnit", "minimum_booking_notice_unit")) ?? void 0,
1398
- minimumCancelationNotice: n(pick("minimumCancelationNotice", "MinimumCancelationNotice", "minimum_cancelation_notice")) ?? void 0,
1399
- minimumCancelationNoticeUnit: n(pick("minimumCancelationNoticeUnit", "MinimumCancelationNoticeUnit", "minimum_cancelation_notice_unit")) ?? void 0,
1400
- futureLimit: n(pick("futureLimit", "FutureLimit", "future_limit")) ?? void 0,
1401
- futureLimitUnit: n(pick("futureLimitUnit", "FutureLimitUnit", "future_limit_unit")) ?? void 0,
1402
- bufferTime: n(pick("bufferTime", "BufferTime", "buffer_time")) ?? void 0,
1403
- bufferTimeUnit: n(pick("bufferTimeUnit", "BufferTimeUnit", "buffer_time_unit")) ?? void 0,
1404
- bookingLimit: n(pick("bookingLimit", "BookingLimit", "booking_limit")) ?? void 0,
1405
- createdOn: pick("createdOn", "CreatedOn", "created_on") ?? null,
1406
- modifiedOn: pick("modifiedOn", "ModifiedOn", "modified_on") ?? null
1395
+ id: pick2("id", "Id"),
1396
+ companyKey: pick2("companyKey", "CompanyKey", "company_key") ?? null,
1397
+ calendarId: String(pick2("calendarId", "CalendarId", "calendar_id") ?? ""),
1398
+ name: pick2("name", "Name") ?? null,
1399
+ timeZoneId: pick2("timeZoneId", "TimeZoneId", "time_zone_id") ?? null,
1400
+ purpose: pick2("purpose", "Purpose") ?? "",
1401
+ description: pick2("description", "Description") ?? null,
1402
+ assignmentMethod: n(pick2("assignmentMethod", "AssignmentMethod", "assignment_method")) ?? void 0,
1403
+ duration: n(pick2("duration", "Duration")) ?? void 0,
1404
+ durationUnit: n(pick2("durationUnit", "DurationUnit", "duration_unit")) ?? void 0,
1405
+ minimumBookingNotice: n(pick2("minimumBookingNotice", "MinimumBookingNotice", "minimum_booking_notice")) ?? void 0,
1406
+ minimumBookingNoticeUnit: n(pick2("minimumBookingNoticeUnit", "MinimumBookingNoticeUnit", "minimum_booking_notice_unit")) ?? void 0,
1407
+ minimumCancelationNotice: n(pick2("minimumCancelationNotice", "MinimumCancelationNotice", "minimum_cancelation_notice")) ?? void 0,
1408
+ minimumCancelationNoticeUnit: n(pick2("minimumCancelationNoticeUnit", "MinimumCancelationNoticeUnit", "minimum_cancelation_notice_unit")) ?? void 0,
1409
+ futureLimit: n(pick2("futureLimit", "FutureLimit", "future_limit")) ?? void 0,
1410
+ futureLimitUnit: n(pick2("futureLimitUnit", "FutureLimitUnit", "future_limit_unit")) ?? void 0,
1411
+ bufferTime: n(pick2("bufferTime", "BufferTime", "buffer_time")) ?? void 0,
1412
+ bufferTimeUnit: n(pick2("bufferTimeUnit", "BufferTimeUnit", "buffer_time_unit")) ?? void 0,
1413
+ bookingLimit: n(pick2("bookingLimit", "BookingLimit", "booking_limit")) ?? void 0,
1414
+ createdOn: pick2("createdOn", "CreatedOn", "created_on") ?? null,
1415
+ modifiedOn: pick2("modifiedOn", "ModifiedOn", "modified_on") ?? null
1407
1416
  };
1408
1417
  }
1409
1418
  ParticipantModel.get = async (participantId) => {
@@ -1549,14 +1558,14 @@ var SettingModel = import_mobx_state_tree13.types.model("Setting", {
1549
1558
  });
1550
1559
  function mapFromApi3(d) {
1551
1560
  if (!d) return d;
1552
- const pick = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
1561
+ const pick2 = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
1553
1562
  return {
1554
- settingsId: String(pick("settingsId", "SettingsId", "settings_id") ?? ""),
1555
- calendarId: String(pick("calendarId", "CalendarId", "calendar_id") ?? ""),
1556
- logo: pick("logo", "Logo") ?? null,
1557
- theme: pick("theme", "Theme") ?? null,
1558
- schedulingButtonText: pick("schedulingButtonText", "SchedulingButtonText", "scheduling_button_text") ?? null,
1559
- scheduledMessage: pick("scheduledMessage", "ScheduledMessage", "scheduled_message") ?? null
1563
+ settingsId: String(pick2("settingsId", "SettingsId", "settings_id") ?? ""),
1564
+ calendarId: String(pick2("calendarId", "CalendarId", "calendar_id") ?? ""),
1565
+ logo: pick2("logo", "Logo") ?? null,
1566
+ theme: pick2("theme", "Theme") ?? null,
1567
+ schedulingButtonText: pick2("schedulingButtonText", "SchedulingButtonText", "scheduling_button_text") ?? null,
1568
+ scheduledMessage: pick2("scheduledMessage", "ScheduledMessage", "scheduled_message") ?? null
1560
1569
  };
1561
1570
  }
1562
1571
  function toPayload2(self) {
@@ -1638,12 +1647,12 @@ var CompanyModel = import_mobx_state_tree14.types.model("Company", {
1638
1647
  });
1639
1648
  function mapFromApi4(d) {
1640
1649
  if (!d) return d;
1641
- const pick = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
1650
+ const pick2 = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
1642
1651
  return {
1643
- companyKey: String(pick("companyKey", "CompanyKey", "company_key") ?? ""),
1644
- companyName: pick("companyName", "CompanyName", "company_name") ?? "",
1645
- createdOn: pick("createdOn", "CreatedOn", "created_on") ?? null,
1646
- modifiedOn: pick("modifiedOn", "ModifiedOn", "modified_on") ?? null
1652
+ companyKey: String(pick2("companyKey", "CompanyKey", "company_key") ?? ""),
1653
+ companyName: pick2("companyName", "CompanyName", "company_name") ?? "",
1654
+ createdOn: pick2("createdOn", "CreatedOn", "created_on") ?? null,
1655
+ modifiedOn: pick2("modifiedOn", "ModifiedOn", "modified_on") ?? null
1647
1656
  };
1648
1657
  }
1649
1658
  function toPayload3(self) {
@@ -1762,20 +1771,20 @@ var Asset_default = AssetModel;
1762
1771
  var import_mobx_state_tree16 = require("mobx-state-tree");
1763
1772
  function mapCalendarLocationFromApi(d) {
1764
1773
  if (!d) return d;
1765
- const pick = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
1774
+ const pick2 = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
1766
1775
  const n = (v) => v != null && v !== "" ? Number(v) : void 0;
1767
1776
  const b = (v) => v === true || v === "true" || v === 1 || v === "1";
1768
1777
  return {
1769
- id: n(pick("id", "Id")),
1770
- calendarLocationId: pick("calendarLocationId", "CalendarLocationId", "calendar_location_id") ?? null,
1771
- calendarId: pick("calendarId", "CalendarId", "calendar_id") ?? null,
1772
- locationType: n(pick("locationType", "LocationType", "location_type")),
1773
- name: pick("name", "Name") ?? "",
1774
- value: pick("value", "Value") ?? "",
1775
- isDefault: b(pick("isDefault", "IsDefault", "is_default")),
1776
- sortOrder: n(pick("sortOrder", "SortOrder", "sort_order")) ?? 0,
1777
- createdOn: pick("createdOn", "CreatedOn", "created_on") ?? null,
1778
- modifiedOn: pick("modifiedOn", "ModifiedOn", "modified_on") ?? null
1778
+ id: n(pick2("id", "Id")),
1779
+ calendarLocationId: pick2("calendarLocationId", "CalendarLocationId", "calendar_location_id") ?? null,
1780
+ calendarId: pick2("calendarId", "CalendarId", "calendar_id") ?? null,
1781
+ locationType: n(pick2("locationType", "LocationType", "location_type")),
1782
+ name: pick2("name", "Name") ?? "",
1783
+ value: pick2("value", "Value") ?? "",
1784
+ isDefault: b(pick2("isDefault", "IsDefault", "is_default")),
1785
+ sortOrder: n(pick2("sortOrder", "SortOrder", "sort_order")) ?? 0,
1786
+ createdOn: pick2("createdOn", "CreatedOn", "created_on") ?? null,
1787
+ modifiedOn: pick2("modifiedOn", "ModifiedOn", "modified_on") ?? null
1779
1788
  };
1780
1789
  }
1781
1790
  function toPayload4(self) {
@@ -1933,20 +1942,20 @@ var Preference_default = PreferenceModel;
1933
1942
  var import_mobx_state_tree18 = require("mobx-state-tree");
1934
1943
  function mapFlowFromApi(d) {
1935
1944
  if (!d) return d;
1936
- const pick = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
1945
+ const pick2 = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
1937
1946
  const b = (v) => v === true || v === "true" || v === 1;
1938
1947
  return {
1939
- id: pick("id", "Id") ?? null,
1940
- flowId: pick("flowId", "FlowId", "flow_id") ?? "",
1941
- companyKey: pick("companyKey", "CompanyKey", "company_key") ?? "",
1942
- calendarId: pick("calendarId", "CalendarId", "calendar_id") ?? null,
1943
- name: pick("name", "Name") ?? "",
1944
- description: pick("description", "Description") ?? null,
1945
- flowJson: pick("flowJson", "FlowJson", "flow_json") ?? "",
1946
- isActive: b(pick("isActive", "IsActive", "is_active")) ?? true,
1947
- isDeleted: b(pick("isDeleted", "IsDeleted", "is_deleted")) ?? false,
1948
- createdOn: pick("createdOn", "CreatedOn", "created_on") ?? null,
1949
- modifiedOn: pick("modifiedOn", "ModifiedOn", "modified_on") ?? null
1948
+ id: pick2("id", "Id") ?? null,
1949
+ flowId: pick2("flowId", "FlowId", "flow_id") ?? "",
1950
+ companyKey: pick2("companyKey", "CompanyKey", "company_key") ?? "",
1951
+ calendarId: pick2("calendarId", "CalendarId", "calendar_id") ?? null,
1952
+ name: pick2("name", "Name") ?? "",
1953
+ description: pick2("description", "Description") ?? null,
1954
+ flowJson: pick2("flowJson", "FlowJson", "flow_json") ?? "",
1955
+ isActive: b(pick2("isActive", "IsActive", "is_active")) ?? true,
1956
+ isDeleted: b(pick2("isDeleted", "IsDeleted", "is_deleted")) ?? false,
1957
+ createdOn: pick2("createdOn", "CreatedOn", "created_on") ?? null,
1958
+ modifiedOn: pick2("modifiedOn", "ModifiedOn", "modified_on") ?? null
1950
1959
  };
1951
1960
  }
1952
1961
  var FlowModel = import_mobx_state_tree18.types.model("Flow", {
@@ -2196,8 +2205,8 @@ var Flow_default = FlowModel;
2196
2205
  var import_mobx_state_tree19 = require("mobx-state-tree");
2197
2206
  function mapLeadFromApi(d) {
2198
2207
  if (!d) return d;
2199
- const pick = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
2200
- const leadTypeRaw = pick("leadType", "LeadType", "lead_type");
2208
+ const pick2 = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
2209
+ const leadTypeRaw = pick2("leadType", "LeadType", "lead_type");
2201
2210
  let leadType = 2;
2202
2211
  if (typeof leadTypeRaw === "number" && Number.isFinite(leadTypeRaw)) {
2203
2212
  leadType = leadTypeRaw;
@@ -2209,17 +2218,17 @@ function mapLeadFromApi(d) {
2209
2218
  else if (!Number.isNaN(Number(leadTypeRaw))) leadType = Number(leadTypeRaw);
2210
2219
  }
2211
2220
  return {
2212
- id: pick("id", "Id") ?? null,
2213
- leadId: pick("leadId", "LeadId", "lead_id") ?? "",
2214
- email: pick("email", "Email") ?? "",
2215
- name: pick("name", "Name") ?? "",
2216
- phone: pick("phone", "Phone") ?? "",
2217
- companyKey: pick("companyKey", "CompanyKey", "company_key") ?? "",
2218
- source: pick("source", "Source") ?? "",
2221
+ id: pick2("id", "Id") ?? null,
2222
+ leadId: pick2("leadId", "LeadId", "lead_id") ?? "",
2223
+ email: pick2("email", "Email") ?? "",
2224
+ name: pick2("name", "Name") ?? "",
2225
+ phone: pick2("phone", "Phone") ?? "",
2226
+ companyKey: pick2("companyKey", "CompanyKey", "company_key") ?? "",
2227
+ source: pick2("source", "Source") ?? "",
2219
2228
  leadType,
2220
- referrerLink: pick("referrerLink", "ReferrerLink", "referrer_link") ?? "",
2221
- createdOn: pick("createdOn", "CreatedOn", "created_on") ?? null,
2222
- modifiedOn: pick("modifiedOn", "ModifiedOn", "modified_on") ?? null
2229
+ referrerLink: pick2("referrerLink", "ReferrerLink", "referrer_link") ?? "",
2230
+ createdOn: pick2("createdOn", "CreatedOn", "created_on") ?? null,
2231
+ modifiedOn: pick2("modifiedOn", "ModifiedOn", "modified_on") ?? null
2223
2232
  };
2224
2233
  }
2225
2234
  var LeadModel = import_mobx_state_tree19.types.model("Lead", {
@@ -2506,17 +2515,17 @@ var CustomFieldModel = import_mobx_state_tree20.types.model("CustomField", {
2506
2515
  });
2507
2516
  function mapCustomFieldFromApi(d) {
2508
2517
  if (!d) return d;
2509
- const pick = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
2518
+ const pick2 = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
2510
2519
  return {
2511
- id: pick("id", "Id") ?? null,
2512
- customFieldId: pick("customFieldId", "CustomFieldId", "custom_field_id") ?? null,
2513
- calendarId: pick("calendarId", "CalendarId", "calendar_id") ?? null,
2514
- label: pick("label", "Label") ?? null,
2515
- type: pick("type", "Type") ?? "",
2516
- isRequired: Boolean(pick("isRequired", "IsRequired", "is_required")),
2517
- createdOn: pick("createdOn", "CreatedOn", "created_on") ?? null,
2518
- modifiedOn: pick("modifiedOn", "ModifiedOn", "modified_on") ?? null,
2519
- isDeleted: Boolean(pick("isDeleted", "IsDeleted", "is_deleted"))
2520
+ id: pick2("id", "Id") ?? null,
2521
+ customFieldId: pick2("customFieldId", "CustomFieldId", "custom_field_id") ?? null,
2522
+ calendarId: pick2("calendarId", "CalendarId", "calendar_id") ?? null,
2523
+ label: pick2("label", "Label") ?? null,
2524
+ type: pick2("type", "Type") ?? "",
2525
+ isRequired: Boolean(pick2("isRequired", "IsRequired", "is_required")),
2526
+ createdOn: pick2("createdOn", "CreatedOn", "created_on") ?? null,
2527
+ modifiedOn: pick2("modifiedOn", "ModifiedOn", "modified_on") ?? null,
2528
+ isDeleted: Boolean(pick2("isDeleted", "IsDeleted", "is_deleted"))
2520
2529
  };
2521
2530
  }
2522
2531
  function toPayload5(self) {
@@ -2590,6 +2599,150 @@ CustomFieldModel.saveFormFieldData = async (fieldPayload) => {
2590
2599
  };
2591
2600
  var CustomField_default = CustomFieldModel;
2592
2601
 
2602
+ // src/models/appointment/Auth.js
2603
+ var CALENDAR_AUTH_MESSAGE_TYPE = "calendar-authorization";
2604
+ var EmailProvider2 = {
2605
+ Google: 1,
2606
+ Microsoft: 2,
2607
+ Default: 3
2608
+ };
2609
+ function pick(d, ...keys) {
2610
+ return keys.reduce((v, k) => v ?? d[k], void 0);
2611
+ }
2612
+ function mapCalendarProviderFromApi(d) {
2613
+ if (!d) return d;
2614
+ return {
2615
+ emailProvider: pick(d, "emailProvider", "EmailProvider", "email_provider") ?? 0,
2616
+ key: pick(d, "key", "Key") ?? "",
2617
+ name: pick(d, "name", "Name") ?? "",
2618
+ displayName: pick(d, "displayName", "DisplayName", "display_name") ?? "",
2619
+ description: pick(d, "description", "Description") ?? "",
2620
+ scope: pick(d, "scope", "Scope") ?? "",
2621
+ redirectUrl: pick(d, "redirectUrl", "RedirectUrl", "redirect_url") ?? ""
2622
+ };
2623
+ }
2624
+ function mapAuthorizationUrlFromApi(d) {
2625
+ if (!d) return d;
2626
+ return {
2627
+ participantId: String(pick(d, "participantId", "ParticipantId", "participant_id") ?? ""),
2628
+ emailProvider: pick(d, "emailProvider", "EmailProvider", "email_provider") ?? 0,
2629
+ providerKey: pick(d, "providerKey", "ProviderKey", "provider_key") ?? "",
2630
+ authorizationUrl: pick(d, "authorizationUrl", "AuthorizationUrl", "authorization_url") ?? "",
2631
+ redirectUrl: pick(d, "redirectUrl", "RedirectUrl", "redirect_url") ?? ""
2632
+ };
2633
+ }
2634
+ function mapProviderStateFromApi(d) {
2635
+ if (!d) return d;
2636
+ return {
2637
+ emailProvider: pick(d, "emailProvider", "EmailProvider", "email_provider") ?? 0,
2638
+ key: pick(d, "key", "Key") ?? "",
2639
+ name: pick(d, "name", "Name") ?? "",
2640
+ hasCredentials: Boolean(pick(d, "hasCredentials", "HasCredentials", "has_credentials")),
2641
+ isAuthorized: Boolean(pick(d, "isAuthorized", "IsAuthorized", "is_authorized")),
2642
+ isSelected: Boolean(pick(d, "isSelected", "IsSelected", "is_selected"))
2643
+ };
2644
+ }
2645
+ function mapAuthorizationStatusFromApi(d) {
2646
+ if (!d) return d;
2647
+ const providersRaw = pick(d, "providers", "Providers");
2648
+ return {
2649
+ participantId: String(pick(d, "participantId", "ParticipantId", "participant_id") ?? ""),
2650
+ email: pick(d, "email", "Email") ?? "",
2651
+ emailProvider: pick(d, "emailProvider", "EmailProvider", "email_provider") ?? 0,
2652
+ providerKey: pick(d, "providerKey", "ProviderKey", "provider_key") ?? "",
2653
+ hasCredentials: Boolean(pick(d, "hasCredentials", "HasCredentials", "has_credentials")),
2654
+ isAuthorized: Boolean(pick(d, "isAuthorized", "IsAuthorized", "is_authorized")),
2655
+ providers: Array.isArray(providersRaw) ? providersRaw.map(mapProviderStateFromApi) : []
2656
+ };
2657
+ }
2658
+ var AuthModel = {
2659
+ CALENDAR_AUTH_MESSAGE_TYPE,
2660
+ EmailProvider: EmailProvider2,
2661
+ /**
2662
+ * GET Auth/CalendarProviders — supported providers (Google / Outlook) for the Scheduling modal.
2663
+ * @param {{ host?: string }} [opts]
2664
+ * @returns {Promise<{ status: string, data?: object[], message?: string }>}
2665
+ */
2666
+ async getCalendarProviders(opts = {}) {
2667
+ const { reqGet } = createRequestHelpersFromEnv(getConfig());
2668
+ const q = {};
2669
+ if (opts.host) q.host = opts.host;
2670
+ const res = await reqGet("/Auth/CalendarProviders", q);
2671
+ if (res.status === "success" && Array.isArray(res.data)) {
2672
+ res.data = res.data.map(mapCalendarProviderFromApi);
2673
+ }
2674
+ return res;
2675
+ },
2676
+ /**
2677
+ * GET Auth/AuthorizationUrl — OAuth URL to open in a popup when user picks a provider.
2678
+ * @param {string} participantId
2679
+ * @param {string|number} emailProvider — google, gmail, 1, outlook, microsoft, 2
2680
+ * @param {{ host?: string }} [opts]
2681
+ * @returns {Promise<{ status: string, data?: object, message?: string }>}
2682
+ */
2683
+ async getAuthorizationUrl(participantId, emailProvider, opts = {}) {
2684
+ const { reqGet } = createRequestHelpersFromEnv(getConfig());
2685
+ const q = {
2686
+ participant_id: participantId,
2687
+ email_provider: String(emailProvider)
2688
+ };
2689
+ if (opts.host) q.host = opts.host;
2690
+ const res = await reqGet("/Auth/AuthorizationUrl", q);
2691
+ if (res.status === "success" && res.data) {
2692
+ res.data = mapAuthorizationUrlFromApi(res.data);
2693
+ }
2694
+ return res;
2695
+ },
2696
+ /**
2697
+ * GET Auth/Status — whether participant calendar is connected (call after OAuth popup).
2698
+ * @param {string} participantId
2699
+ * @returns {Promise<{ status: string, data?: object, message?: string }>}
2700
+ */
2701
+ async getAuthorizationStatus(participantId) {
2702
+ const { reqGet } = createRequestHelpersFromEnv(getConfig());
2703
+ const res = await reqGet("/Auth/Status", { participant_id: participantId });
2704
+ if (res.status === "success" && res.data) {
2705
+ res.data = mapAuthorizationStatusFromApi(res.data);
2706
+ }
2707
+ return res;
2708
+ },
2709
+ /**
2710
+ * Open Google/Microsoft OAuth in a centered popup.
2711
+ * @param {string} authorizationUrl — from getAuthorizationUrl().data.authorizationUrl
2712
+ * @param {{ width?: number, height?: number }} [opts]
2713
+ * @returns {Window | null}
2714
+ */
2715
+ openOAuthPopup(authorizationUrl, opts = {}) {
2716
+ if (typeof window === "undefined" || !authorizationUrl) return null;
2717
+ const width = opts.width ?? 500;
2718
+ const height = opts.height ?? 650;
2719
+ const left = window.screenX + (window.outerWidth - width) / 2;
2720
+ const top = window.screenY + (window.outerHeight - height) / 2;
2721
+ return window.open(
2722
+ authorizationUrl,
2723
+ "calendar-oauth",
2724
+ `width=${width},height=${height},left=${left},top=${top},scrollbars=yes`
2725
+ );
2726
+ },
2727
+ /**
2728
+ * Subscribe to calendar-authorization postMessage from OAuth popup (Authorized.html / Error.html).
2729
+ * @param {(payload: { type: string, status: 'success' | 'error', message?: string }) => void} handler
2730
+ * @returns {() => void} unsubscribe
2731
+ */
2732
+ onCalendarAuthMessage(handler) {
2733
+ if (typeof window === "undefined") return () => {
2734
+ };
2735
+ const listener = (event) => {
2736
+ const payload = event == null ? void 0 : event.data;
2737
+ if (!payload || payload.type !== CALENDAR_AUTH_MESSAGE_TYPE) return;
2738
+ handler(payload);
2739
+ };
2740
+ window.addEventListener("message", listener);
2741
+ return () => window.removeEventListener("message", listener);
2742
+ }
2743
+ };
2744
+ var Auth_default = AuthModel;
2745
+
2593
2746
  // src/models/appointment/index.js
2594
2747
  var import_mobx_state_tree21 = require("mobx-state-tree");
2595
2748
  var RootStore = import_mobx_state_tree21.types.model("RootStore", {
@@ -2617,9 +2770,12 @@ function createRootStore(initialState = {}) {
2617
2770
  AssetModel,
2618
2771
  AssignmentMethod,
2619
2772
  AttendeeStatus,
2773
+ AuthModel,
2620
2774
  AvailabilityDetailModel,
2621
2775
  AvailabilityModel,
2776
+ CALENDAR_AUTH_MESSAGE_TYPE,
2622
2777
  CalendarDayModel,
2778
+ CalendarEmailProvider,
2623
2779
  CalendarLocationModel,
2624
2780
  CalendarModel,
2625
2781
  CalendarParticipantModel,
@@ -2627,6 +2783,7 @@ function createRootStore(initialState = {}) {
2627
2783
  ConfigModel,
2628
2784
  CustomFieldModel,
2629
2785
  DayOfWeek,
2786
+ EmailProvider,
2630
2787
  EventModel,
2631
2788
  FlowModel,
2632
2789
  LeadModel,