@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/README.md +45 -0
- package/dist/index.d.ts +81 -0
- package/dist/index.js +302 -145
- package/dist/index.mjs +298 -145
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -171,6 +171,11 @@ var DayOfWeek = {
|
|
|
171
171
|
Friday: 5,
|
|
172
172
|
Saturday: 6
|
|
173
173
|
};
|
|
174
|
+
var EmailProvider = {
|
|
175
|
+
Google: 1,
|
|
176
|
+
Microsoft: 2,
|
|
177
|
+
Default: 3
|
|
178
|
+
};
|
|
174
179
|
var LocationType = {
|
|
175
180
|
Physical: 0,
|
|
176
181
|
Video: 1,
|
|
@@ -430,34 +435,34 @@ var EventModel = types4.model("Event", {
|
|
|
430
435
|
});
|
|
431
436
|
function mapEventFromApi(d) {
|
|
432
437
|
if (!d) return d;
|
|
433
|
-
const
|
|
438
|
+
const pick2 = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
|
|
434
439
|
const n = (v) => v != null && v !== "" ? Number(v) : void 0;
|
|
435
440
|
return {
|
|
436
|
-
eventId: String(
|
|
437
|
-
calendarId: String(
|
|
438
|
-
participantId:
|
|
439
|
-
title:
|
|
440
|
-
description:
|
|
441
|
-
startDate:
|
|
442
|
-
endDate:
|
|
443
|
-
startHour: n(
|
|
444
|
-
startMinute: n(
|
|
445
|
-
endHour: n(
|
|
446
|
-
endMinute: n(
|
|
447
|
-
visitorName:
|
|
448
|
-
visitorEmail:
|
|
449
|
-
visitorPhone:
|
|
450
|
-
externalEventId:
|
|
451
|
-
calendarLocationId:
|
|
452
|
-
customLocation:
|
|
453
|
-
flowId:
|
|
454
|
-
flowPath:
|
|
455
|
-
attendeeStatus: n(
|
|
456
|
-
rescheduleLink:
|
|
457
|
-
cancelLink:
|
|
458
|
-
timeZone:
|
|
459
|
-
createdOn:
|
|
460
|
-
modifiedOn:
|
|
441
|
+
eventId: String(pick2("eventId", "EventId", "event_id") ?? ""),
|
|
442
|
+
calendarId: String(pick2("calendarId", "CalendarId", "calendar_id") ?? ""),
|
|
443
|
+
participantId: pick2("participantId", "ParticipantId", "participant_id") ?? null,
|
|
444
|
+
title: pick2("title", "Title"),
|
|
445
|
+
description: pick2("description", "Description"),
|
|
446
|
+
startDate: pick2("startDate", "StartDate", "start_date"),
|
|
447
|
+
endDate: pick2("endDate", "EndDate", "end_date"),
|
|
448
|
+
startHour: n(pick2("startHour", "StartHour", "start_hour")),
|
|
449
|
+
startMinute: n(pick2("startMinute", "StartMinute", "start_minute")),
|
|
450
|
+
endHour: n(pick2("endHour", "EndHour", "end_hour")),
|
|
451
|
+
endMinute: n(pick2("endMinute", "EndMinute", "end_minute")),
|
|
452
|
+
visitorName: pick2("visitorName", "VisitorName", "visitor_name"),
|
|
453
|
+
visitorEmail: pick2("visitorEmail", "VisitorEmail", "visitor_email"),
|
|
454
|
+
visitorPhone: pick2("visitorPhone", "VisitorPhone", "visitor_phone"),
|
|
455
|
+
externalEventId: pick2("externalEventId", "ExternalEventId", "external_event_id"),
|
|
456
|
+
calendarLocationId: pick2("calendarLocationId", "CalendarLocationId", "calendar_location_id"),
|
|
457
|
+
customLocation: pick2("customLocation", "CustomLocation", "custom_location"),
|
|
458
|
+
flowId: pick2("flowId", "FlowId", "flow_id"),
|
|
459
|
+
flowPath: pick2("flowPath", "FlowPath", "flow_path"),
|
|
460
|
+
attendeeStatus: n(pick2("attendeeStatus", "AttendeeStatus", "attendee_status")),
|
|
461
|
+
rescheduleLink: pick2("rescheduleLink", "RescheduleLink", "reschedule_link"),
|
|
462
|
+
cancelLink: pick2("cancelLink", "CancelLink", "cancel_link"),
|
|
463
|
+
timeZone: pick2("timeZone", "TimeZone", "time_zone"),
|
|
464
|
+
createdOn: pick2("createdOn", "CreatedOn", "created_on"),
|
|
465
|
+
modifiedOn: pick2("modifiedOn", "ModifiedOn", "modified_on")
|
|
461
466
|
};
|
|
462
467
|
}
|
|
463
468
|
EventModel.get = async (eventId) => {
|
|
@@ -711,14 +716,14 @@ var CalendarParticipantModel = types6.model("CalendarParticipant", {
|
|
|
711
716
|
});
|
|
712
717
|
function mapFromApi(d) {
|
|
713
718
|
if (!d) return d;
|
|
714
|
-
const
|
|
719
|
+
const pick2 = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
|
|
715
720
|
return {
|
|
716
|
-
id:
|
|
717
|
-
calendarParticipantId: String(
|
|
718
|
-
participantId: String(
|
|
719
|
-
calendarId: String(
|
|
720
|
-
createdOn:
|
|
721
|
-
modifiedOn:
|
|
721
|
+
id: pick2("id", "Id"),
|
|
722
|
+
calendarParticipantId: String(pick2("calendarParticipantId", "CalendarParticipantId", "calendarparticipant_id") ?? ""),
|
|
723
|
+
participantId: String(pick2("participantId", "ParticipantId", "participant_id") ?? ""),
|
|
724
|
+
calendarId: String(pick2("calendarId", "CalendarId", "calendar_id") ?? ""),
|
|
725
|
+
createdOn: pick2("createdOn", "CreatedOn", "created_on") ?? null,
|
|
726
|
+
modifiedOn: pick2("modifiedOn", "ModifiedOn", "modified_on") ?? null
|
|
722
727
|
};
|
|
723
728
|
}
|
|
724
729
|
CalendarParticipantModel.getByCalendar = async (calendarId) => {
|
|
@@ -986,30 +991,30 @@ var CalendarModel = types8.model("Calendar", {
|
|
|
986
991
|
});
|
|
987
992
|
function mapCalendarFromApi(d) {
|
|
988
993
|
if (!d) return d;
|
|
989
|
-
const
|
|
994
|
+
const pick2 = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
|
|
990
995
|
const n = (v) => v != null && v !== "" ? Number(v) : void 0;
|
|
991
996
|
return {
|
|
992
|
-
id:
|
|
993
|
-
companyKey:
|
|
994
|
-
calendarId:
|
|
995
|
-
name:
|
|
996
|
-
timeZoneId:
|
|
997
|
-
purpose:
|
|
998
|
-
description:
|
|
999
|
-
assignmentMethod: n(
|
|
1000
|
-
duration: n(
|
|
1001
|
-
durationUnit: n(
|
|
1002
|
-
minimumBookingNotice: n(
|
|
1003
|
-
minimumBookingNoticeUnit: n(
|
|
1004
|
-
minimumCancelationNotice: n(
|
|
1005
|
-
minimumCancelationNoticeUnit: n(
|
|
1006
|
-
futureLimit: n(
|
|
1007
|
-
futureLimitUnit: n(
|
|
1008
|
-
bufferTime: n(
|
|
1009
|
-
bufferTimeUnit: n(
|
|
1010
|
-
bookingLimit: n(
|
|
1011
|
-
createdOn:
|
|
1012
|
-
modifiedOn:
|
|
997
|
+
id: pick2("id", "Id"),
|
|
998
|
+
companyKey: pick2("companyKey", "CompanyKey", "company_key"),
|
|
999
|
+
calendarId: pick2("calendarId", "CalendarId", "calendar_id") ?? "",
|
|
1000
|
+
name: pick2("name", "Name"),
|
|
1001
|
+
timeZoneId: pick2("timeZoneId", "TimeZoneId", "time_zone_id"),
|
|
1002
|
+
purpose: pick2("purpose", "Purpose") ?? "",
|
|
1003
|
+
description: pick2("description", "Description"),
|
|
1004
|
+
assignmentMethod: n(pick2("assignmentMethod", "AssignmentMethod", "assignment_method")),
|
|
1005
|
+
duration: n(pick2("duration", "Duration")),
|
|
1006
|
+
durationUnit: n(pick2("durationUnit", "DurationUnit", "duration_unit")),
|
|
1007
|
+
minimumBookingNotice: n(pick2("minimumBookingNotice", "MinimumBookingNotice", "minimum_booking_notice")),
|
|
1008
|
+
minimumBookingNoticeUnit: n(pick2("minimumBookingNoticeUnit", "MinimumBookingNoticeUnit", "minimum_booking_notice_unit")),
|
|
1009
|
+
minimumCancelationNotice: n(pick2("minimumCancelationNotice", "MinimumCancelationNotice", "minimum_cancelation_notice")),
|
|
1010
|
+
minimumCancelationNoticeUnit: n(pick2("minimumCancelationNoticeUnit", "MinimumCancelationNoticeUnit", "minimum_cancelation_notice_unit")),
|
|
1011
|
+
futureLimit: n(pick2("futureLimit", "FutureLimit", "future_limit")),
|
|
1012
|
+
futureLimitUnit: n(pick2("futureLimitUnit", "FutureLimitUnit", "future_limit_unit")),
|
|
1013
|
+
bufferTime: n(pick2("bufferTime", "BufferTime", "buffer_time")),
|
|
1014
|
+
bufferTimeUnit: n(pick2("bufferTimeUnit", "BufferTimeUnit", "buffer_time_unit")),
|
|
1015
|
+
bookingLimit: n(pick2("bookingLimit", "BookingLimit", "booking_limit")),
|
|
1016
|
+
createdOn: pick2("createdOn", "CreatedOn", "created_on"),
|
|
1017
|
+
modifiedOn: pick2("modifiedOn", "ModifiedOn", "modified_on")
|
|
1013
1018
|
};
|
|
1014
1019
|
}
|
|
1015
1020
|
CalendarModel.getRaw = async (calendarId) => {
|
|
@@ -1295,19 +1300,19 @@ var ParticipantModel = types11.model("Participant", {
|
|
|
1295
1300
|
});
|
|
1296
1301
|
function mapFromApi2(d) {
|
|
1297
1302
|
if (!d) return d;
|
|
1298
|
-
const
|
|
1303
|
+
const pick2 = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
|
|
1299
1304
|
const n = (v) => v != null && v !== "" ? Number(v) : void 0;
|
|
1300
1305
|
return {
|
|
1301
|
-
participantId: String(
|
|
1302
|
-
companyKey:
|
|
1303
|
-
alias:
|
|
1304
|
-
email:
|
|
1305
|
-
isApproved: Boolean(
|
|
1306
|
-
isAvailable: Boolean(
|
|
1307
|
-
provider: n(
|
|
1308
|
-
createdOn:
|
|
1309
|
-
modifiedOn:
|
|
1310
|
-
isDeleted: Boolean(
|
|
1306
|
+
participantId: String(pick2("participantId", "ParticipantId", "participant_id") ?? ""),
|
|
1307
|
+
companyKey: pick2("companyKey", "CompanyKey", "company_key") ?? null,
|
|
1308
|
+
alias: pick2("alias", "Alias") ?? "",
|
|
1309
|
+
email: pick2("email", "Email") ?? "",
|
|
1310
|
+
isApproved: Boolean(pick2("isApproved", "IsApproved", "is_approved")),
|
|
1311
|
+
isAvailable: Boolean(pick2("isAvailable", "IsAvailable", "is_available")),
|
|
1312
|
+
provider: n(pick2("provider", "Provider")) ?? 0,
|
|
1313
|
+
createdOn: pick2("createdOn", "CreatedOn", "created_on") ?? null,
|
|
1314
|
+
modifiedOn: pick2("modifiedOn", "ModifiedOn", "modified_on") ?? null,
|
|
1315
|
+
isDeleted: Boolean(pick2("isDeleted", "IsDeleted", "is_deleted"))
|
|
1311
1316
|
};
|
|
1312
1317
|
}
|
|
1313
1318
|
function toPayload(self) {
|
|
@@ -1323,30 +1328,30 @@ function toPayload(self) {
|
|
|
1323
1328
|
}
|
|
1324
1329
|
function mapCalendarFromApi2(d) {
|
|
1325
1330
|
if (!d) return d;
|
|
1326
|
-
const
|
|
1331
|
+
const pick2 = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
|
|
1327
1332
|
const n = (v) => v != null && v !== "" ? Number(v) : void 0;
|
|
1328
1333
|
return {
|
|
1329
|
-
id:
|
|
1330
|
-
companyKey:
|
|
1331
|
-
calendarId: String(
|
|
1332
|
-
name:
|
|
1333
|
-
timeZoneId:
|
|
1334
|
-
purpose:
|
|
1335
|
-
description:
|
|
1336
|
-
assignmentMethod: n(
|
|
1337
|
-
duration: n(
|
|
1338
|
-
durationUnit: n(
|
|
1339
|
-
minimumBookingNotice: n(
|
|
1340
|
-
minimumBookingNoticeUnit: n(
|
|
1341
|
-
minimumCancelationNotice: n(
|
|
1342
|
-
minimumCancelationNoticeUnit: n(
|
|
1343
|
-
futureLimit: n(
|
|
1344
|
-
futureLimitUnit: n(
|
|
1345
|
-
bufferTime: n(
|
|
1346
|
-
bufferTimeUnit: n(
|
|
1347
|
-
bookingLimit: n(
|
|
1348
|
-
createdOn:
|
|
1349
|
-
modifiedOn:
|
|
1334
|
+
id: pick2("id", "Id"),
|
|
1335
|
+
companyKey: pick2("companyKey", "CompanyKey", "company_key") ?? null,
|
|
1336
|
+
calendarId: String(pick2("calendarId", "CalendarId", "calendar_id") ?? ""),
|
|
1337
|
+
name: pick2("name", "Name") ?? null,
|
|
1338
|
+
timeZoneId: pick2("timeZoneId", "TimeZoneId", "time_zone_id") ?? null,
|
|
1339
|
+
purpose: pick2("purpose", "Purpose") ?? "",
|
|
1340
|
+
description: pick2("description", "Description") ?? null,
|
|
1341
|
+
assignmentMethod: n(pick2("assignmentMethod", "AssignmentMethod", "assignment_method")) ?? void 0,
|
|
1342
|
+
duration: n(pick2("duration", "Duration")) ?? void 0,
|
|
1343
|
+
durationUnit: n(pick2("durationUnit", "DurationUnit", "duration_unit")) ?? void 0,
|
|
1344
|
+
minimumBookingNotice: n(pick2("minimumBookingNotice", "MinimumBookingNotice", "minimum_booking_notice")) ?? void 0,
|
|
1345
|
+
minimumBookingNoticeUnit: n(pick2("minimumBookingNoticeUnit", "MinimumBookingNoticeUnit", "minimum_booking_notice_unit")) ?? void 0,
|
|
1346
|
+
minimumCancelationNotice: n(pick2("minimumCancelationNotice", "MinimumCancelationNotice", "minimum_cancelation_notice")) ?? void 0,
|
|
1347
|
+
minimumCancelationNoticeUnit: n(pick2("minimumCancelationNoticeUnit", "MinimumCancelationNoticeUnit", "minimum_cancelation_notice_unit")) ?? void 0,
|
|
1348
|
+
futureLimit: n(pick2("futureLimit", "FutureLimit", "future_limit")) ?? void 0,
|
|
1349
|
+
futureLimitUnit: n(pick2("futureLimitUnit", "FutureLimitUnit", "future_limit_unit")) ?? void 0,
|
|
1350
|
+
bufferTime: n(pick2("bufferTime", "BufferTime", "buffer_time")) ?? void 0,
|
|
1351
|
+
bufferTimeUnit: n(pick2("bufferTimeUnit", "BufferTimeUnit", "buffer_time_unit")) ?? void 0,
|
|
1352
|
+
bookingLimit: n(pick2("bookingLimit", "BookingLimit", "booking_limit")) ?? void 0,
|
|
1353
|
+
createdOn: pick2("createdOn", "CreatedOn", "created_on") ?? null,
|
|
1354
|
+
modifiedOn: pick2("modifiedOn", "ModifiedOn", "modified_on") ?? null
|
|
1350
1355
|
};
|
|
1351
1356
|
}
|
|
1352
1357
|
ParticipantModel.get = async (participantId) => {
|
|
@@ -1492,14 +1497,14 @@ var SettingModel = types13.model("Setting", {
|
|
|
1492
1497
|
});
|
|
1493
1498
|
function mapFromApi3(d) {
|
|
1494
1499
|
if (!d) return d;
|
|
1495
|
-
const
|
|
1500
|
+
const pick2 = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
|
|
1496
1501
|
return {
|
|
1497
|
-
settingsId: String(
|
|
1498
|
-
calendarId: String(
|
|
1499
|
-
logo:
|
|
1500
|
-
theme:
|
|
1501
|
-
schedulingButtonText:
|
|
1502
|
-
scheduledMessage:
|
|
1502
|
+
settingsId: String(pick2("settingsId", "SettingsId", "settings_id") ?? ""),
|
|
1503
|
+
calendarId: String(pick2("calendarId", "CalendarId", "calendar_id") ?? ""),
|
|
1504
|
+
logo: pick2("logo", "Logo") ?? null,
|
|
1505
|
+
theme: pick2("theme", "Theme") ?? null,
|
|
1506
|
+
schedulingButtonText: pick2("schedulingButtonText", "SchedulingButtonText", "scheduling_button_text") ?? null,
|
|
1507
|
+
scheduledMessage: pick2("scheduledMessage", "ScheduledMessage", "scheduled_message") ?? null
|
|
1503
1508
|
};
|
|
1504
1509
|
}
|
|
1505
1510
|
function toPayload2(self) {
|
|
@@ -1581,12 +1586,12 @@ var CompanyModel = types14.model("Company", {
|
|
|
1581
1586
|
});
|
|
1582
1587
|
function mapFromApi4(d) {
|
|
1583
1588
|
if (!d) return d;
|
|
1584
|
-
const
|
|
1589
|
+
const pick2 = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
|
|
1585
1590
|
return {
|
|
1586
|
-
companyKey: String(
|
|
1587
|
-
companyName:
|
|
1588
|
-
createdOn:
|
|
1589
|
-
modifiedOn:
|
|
1591
|
+
companyKey: String(pick2("companyKey", "CompanyKey", "company_key") ?? ""),
|
|
1592
|
+
companyName: pick2("companyName", "CompanyName", "company_name") ?? "",
|
|
1593
|
+
createdOn: pick2("createdOn", "CreatedOn", "created_on") ?? null,
|
|
1594
|
+
modifiedOn: pick2("modifiedOn", "ModifiedOn", "modified_on") ?? null
|
|
1590
1595
|
};
|
|
1591
1596
|
}
|
|
1592
1597
|
function toPayload3(self) {
|
|
@@ -1705,20 +1710,20 @@ var Asset_default = AssetModel;
|
|
|
1705
1710
|
import { types as types16, getEnv as getEnv7, applySnapshot as applySnapshot6 } from "mobx-state-tree";
|
|
1706
1711
|
function mapCalendarLocationFromApi(d) {
|
|
1707
1712
|
if (!d) return d;
|
|
1708
|
-
const
|
|
1713
|
+
const pick2 = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
|
|
1709
1714
|
const n = (v) => v != null && v !== "" ? Number(v) : void 0;
|
|
1710
1715
|
const b = (v) => v === true || v === "true" || v === 1 || v === "1";
|
|
1711
1716
|
return {
|
|
1712
|
-
id: n(
|
|
1713
|
-
calendarLocationId:
|
|
1714
|
-
calendarId:
|
|
1715
|
-
locationType: n(
|
|
1716
|
-
name:
|
|
1717
|
-
value:
|
|
1718
|
-
isDefault: b(
|
|
1719
|
-
sortOrder: n(
|
|
1720
|
-
createdOn:
|
|
1721
|
-
modifiedOn:
|
|
1717
|
+
id: n(pick2("id", "Id")),
|
|
1718
|
+
calendarLocationId: pick2("calendarLocationId", "CalendarLocationId", "calendar_location_id") ?? null,
|
|
1719
|
+
calendarId: pick2("calendarId", "CalendarId", "calendar_id") ?? null,
|
|
1720
|
+
locationType: n(pick2("locationType", "LocationType", "location_type")),
|
|
1721
|
+
name: pick2("name", "Name") ?? "",
|
|
1722
|
+
value: pick2("value", "Value") ?? "",
|
|
1723
|
+
isDefault: b(pick2("isDefault", "IsDefault", "is_default")),
|
|
1724
|
+
sortOrder: n(pick2("sortOrder", "SortOrder", "sort_order")) ?? 0,
|
|
1725
|
+
createdOn: pick2("createdOn", "CreatedOn", "created_on") ?? null,
|
|
1726
|
+
modifiedOn: pick2("modifiedOn", "ModifiedOn", "modified_on") ?? null
|
|
1722
1727
|
};
|
|
1723
1728
|
}
|
|
1724
1729
|
function toPayload4(self) {
|
|
@@ -1876,20 +1881,20 @@ var Preference_default = PreferenceModel;
|
|
|
1876
1881
|
import { types as types18, getEnv as getEnv8, applySnapshot as applySnapshot7 } from "mobx-state-tree";
|
|
1877
1882
|
function mapFlowFromApi(d) {
|
|
1878
1883
|
if (!d) return d;
|
|
1879
|
-
const
|
|
1884
|
+
const pick2 = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
|
|
1880
1885
|
const b = (v) => v === true || v === "true" || v === 1;
|
|
1881
1886
|
return {
|
|
1882
|
-
id:
|
|
1883
|
-
flowId:
|
|
1884
|
-
companyKey:
|
|
1885
|
-
calendarId:
|
|
1886
|
-
name:
|
|
1887
|
-
description:
|
|
1888
|
-
flowJson:
|
|
1889
|
-
isActive: b(
|
|
1890
|
-
isDeleted: b(
|
|
1891
|
-
createdOn:
|
|
1892
|
-
modifiedOn:
|
|
1887
|
+
id: pick2("id", "Id") ?? null,
|
|
1888
|
+
flowId: pick2("flowId", "FlowId", "flow_id") ?? "",
|
|
1889
|
+
companyKey: pick2("companyKey", "CompanyKey", "company_key") ?? "",
|
|
1890
|
+
calendarId: pick2("calendarId", "CalendarId", "calendar_id") ?? null,
|
|
1891
|
+
name: pick2("name", "Name") ?? "",
|
|
1892
|
+
description: pick2("description", "Description") ?? null,
|
|
1893
|
+
flowJson: pick2("flowJson", "FlowJson", "flow_json") ?? "",
|
|
1894
|
+
isActive: b(pick2("isActive", "IsActive", "is_active")) ?? true,
|
|
1895
|
+
isDeleted: b(pick2("isDeleted", "IsDeleted", "is_deleted")) ?? false,
|
|
1896
|
+
createdOn: pick2("createdOn", "CreatedOn", "created_on") ?? null,
|
|
1897
|
+
modifiedOn: pick2("modifiedOn", "ModifiedOn", "modified_on") ?? null
|
|
1893
1898
|
};
|
|
1894
1899
|
}
|
|
1895
1900
|
var FlowModel = types18.model("Flow", {
|
|
@@ -2139,8 +2144,8 @@ var Flow_default = FlowModel;
|
|
|
2139
2144
|
import { types as types19, getEnv as getEnv9, applySnapshot as applySnapshot8, getSnapshot } from "mobx-state-tree";
|
|
2140
2145
|
function mapLeadFromApi(d) {
|
|
2141
2146
|
if (!d) return d;
|
|
2142
|
-
const
|
|
2143
|
-
const leadTypeRaw =
|
|
2147
|
+
const pick2 = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
|
|
2148
|
+
const leadTypeRaw = pick2("leadType", "LeadType", "lead_type");
|
|
2144
2149
|
let leadType = 2;
|
|
2145
2150
|
if (typeof leadTypeRaw === "number" && Number.isFinite(leadTypeRaw)) {
|
|
2146
2151
|
leadType = leadTypeRaw;
|
|
@@ -2152,17 +2157,17 @@ function mapLeadFromApi(d) {
|
|
|
2152
2157
|
else if (!Number.isNaN(Number(leadTypeRaw))) leadType = Number(leadTypeRaw);
|
|
2153
2158
|
}
|
|
2154
2159
|
return {
|
|
2155
|
-
id:
|
|
2156
|
-
leadId:
|
|
2157
|
-
email:
|
|
2158
|
-
name:
|
|
2159
|
-
phone:
|
|
2160
|
-
companyKey:
|
|
2161
|
-
source:
|
|
2160
|
+
id: pick2("id", "Id") ?? null,
|
|
2161
|
+
leadId: pick2("leadId", "LeadId", "lead_id") ?? "",
|
|
2162
|
+
email: pick2("email", "Email") ?? "",
|
|
2163
|
+
name: pick2("name", "Name") ?? "",
|
|
2164
|
+
phone: pick2("phone", "Phone") ?? "",
|
|
2165
|
+
companyKey: pick2("companyKey", "CompanyKey", "company_key") ?? "",
|
|
2166
|
+
source: pick2("source", "Source") ?? "",
|
|
2162
2167
|
leadType,
|
|
2163
|
-
referrerLink:
|
|
2164
|
-
createdOn:
|
|
2165
|
-
modifiedOn:
|
|
2168
|
+
referrerLink: pick2("referrerLink", "ReferrerLink", "referrer_link") ?? "",
|
|
2169
|
+
createdOn: pick2("createdOn", "CreatedOn", "created_on") ?? null,
|
|
2170
|
+
modifiedOn: pick2("modifiedOn", "ModifiedOn", "modified_on") ?? null
|
|
2166
2171
|
};
|
|
2167
2172
|
}
|
|
2168
2173
|
var LeadModel = types19.model("Lead", {
|
|
@@ -2449,17 +2454,17 @@ var CustomFieldModel = types20.model("CustomField", {
|
|
|
2449
2454
|
});
|
|
2450
2455
|
function mapCustomFieldFromApi(d) {
|
|
2451
2456
|
if (!d) return d;
|
|
2452
|
-
const
|
|
2457
|
+
const pick2 = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
|
|
2453
2458
|
return {
|
|
2454
|
-
id:
|
|
2455
|
-
customFieldId:
|
|
2456
|
-
calendarId:
|
|
2457
|
-
label:
|
|
2458
|
-
type:
|
|
2459
|
-
isRequired: Boolean(
|
|
2460
|
-
createdOn:
|
|
2461
|
-
modifiedOn:
|
|
2462
|
-
isDeleted: Boolean(
|
|
2459
|
+
id: pick2("id", "Id") ?? null,
|
|
2460
|
+
customFieldId: pick2("customFieldId", "CustomFieldId", "custom_field_id") ?? null,
|
|
2461
|
+
calendarId: pick2("calendarId", "CalendarId", "calendar_id") ?? null,
|
|
2462
|
+
label: pick2("label", "Label") ?? null,
|
|
2463
|
+
type: pick2("type", "Type") ?? "",
|
|
2464
|
+
isRequired: Boolean(pick2("isRequired", "IsRequired", "is_required")),
|
|
2465
|
+
createdOn: pick2("createdOn", "CreatedOn", "created_on") ?? null,
|
|
2466
|
+
modifiedOn: pick2("modifiedOn", "ModifiedOn", "modified_on") ?? null,
|
|
2467
|
+
isDeleted: Boolean(pick2("isDeleted", "IsDeleted", "is_deleted"))
|
|
2463
2468
|
};
|
|
2464
2469
|
}
|
|
2465
2470
|
function toPayload5(self) {
|
|
@@ -2533,6 +2538,150 @@ CustomFieldModel.saveFormFieldData = async (fieldPayload) => {
|
|
|
2533
2538
|
};
|
|
2534
2539
|
var CustomField_default = CustomFieldModel;
|
|
2535
2540
|
|
|
2541
|
+
// src/models/appointment/Auth.js
|
|
2542
|
+
var CALENDAR_AUTH_MESSAGE_TYPE = "calendar-authorization";
|
|
2543
|
+
var EmailProvider2 = {
|
|
2544
|
+
Google: 1,
|
|
2545
|
+
Microsoft: 2,
|
|
2546
|
+
Default: 3
|
|
2547
|
+
};
|
|
2548
|
+
function pick(d, ...keys) {
|
|
2549
|
+
return keys.reduce((v, k) => v ?? d[k], void 0);
|
|
2550
|
+
}
|
|
2551
|
+
function mapCalendarProviderFromApi(d) {
|
|
2552
|
+
if (!d) return d;
|
|
2553
|
+
return {
|
|
2554
|
+
emailProvider: pick(d, "emailProvider", "EmailProvider", "email_provider") ?? 0,
|
|
2555
|
+
key: pick(d, "key", "Key") ?? "",
|
|
2556
|
+
name: pick(d, "name", "Name") ?? "",
|
|
2557
|
+
displayName: pick(d, "displayName", "DisplayName", "display_name") ?? "",
|
|
2558
|
+
description: pick(d, "description", "Description") ?? "",
|
|
2559
|
+
scope: pick(d, "scope", "Scope") ?? "",
|
|
2560
|
+
redirectUrl: pick(d, "redirectUrl", "RedirectUrl", "redirect_url") ?? ""
|
|
2561
|
+
};
|
|
2562
|
+
}
|
|
2563
|
+
function mapAuthorizationUrlFromApi(d) {
|
|
2564
|
+
if (!d) return d;
|
|
2565
|
+
return {
|
|
2566
|
+
participantId: String(pick(d, "participantId", "ParticipantId", "participant_id") ?? ""),
|
|
2567
|
+
emailProvider: pick(d, "emailProvider", "EmailProvider", "email_provider") ?? 0,
|
|
2568
|
+
providerKey: pick(d, "providerKey", "ProviderKey", "provider_key") ?? "",
|
|
2569
|
+
authorizationUrl: pick(d, "authorizationUrl", "AuthorizationUrl", "authorization_url") ?? "",
|
|
2570
|
+
redirectUrl: pick(d, "redirectUrl", "RedirectUrl", "redirect_url") ?? ""
|
|
2571
|
+
};
|
|
2572
|
+
}
|
|
2573
|
+
function mapProviderStateFromApi(d) {
|
|
2574
|
+
if (!d) return d;
|
|
2575
|
+
return {
|
|
2576
|
+
emailProvider: pick(d, "emailProvider", "EmailProvider", "email_provider") ?? 0,
|
|
2577
|
+
key: pick(d, "key", "Key") ?? "",
|
|
2578
|
+
name: pick(d, "name", "Name") ?? "",
|
|
2579
|
+
hasCredentials: Boolean(pick(d, "hasCredentials", "HasCredentials", "has_credentials")),
|
|
2580
|
+
isAuthorized: Boolean(pick(d, "isAuthorized", "IsAuthorized", "is_authorized")),
|
|
2581
|
+
isSelected: Boolean(pick(d, "isSelected", "IsSelected", "is_selected"))
|
|
2582
|
+
};
|
|
2583
|
+
}
|
|
2584
|
+
function mapAuthorizationStatusFromApi(d) {
|
|
2585
|
+
if (!d) return d;
|
|
2586
|
+
const providersRaw = pick(d, "providers", "Providers");
|
|
2587
|
+
return {
|
|
2588
|
+
participantId: String(pick(d, "participantId", "ParticipantId", "participant_id") ?? ""),
|
|
2589
|
+
email: pick(d, "email", "Email") ?? "",
|
|
2590
|
+
emailProvider: pick(d, "emailProvider", "EmailProvider", "email_provider") ?? 0,
|
|
2591
|
+
providerKey: pick(d, "providerKey", "ProviderKey", "provider_key") ?? "",
|
|
2592
|
+
hasCredentials: Boolean(pick(d, "hasCredentials", "HasCredentials", "has_credentials")),
|
|
2593
|
+
isAuthorized: Boolean(pick(d, "isAuthorized", "IsAuthorized", "is_authorized")),
|
|
2594
|
+
providers: Array.isArray(providersRaw) ? providersRaw.map(mapProviderStateFromApi) : []
|
|
2595
|
+
};
|
|
2596
|
+
}
|
|
2597
|
+
var AuthModel = {
|
|
2598
|
+
CALENDAR_AUTH_MESSAGE_TYPE,
|
|
2599
|
+
EmailProvider: EmailProvider2,
|
|
2600
|
+
/**
|
|
2601
|
+
* GET Auth/CalendarProviders — supported providers (Google / Outlook) for the Scheduling modal.
|
|
2602
|
+
* @param {{ host?: string }} [opts]
|
|
2603
|
+
* @returns {Promise<{ status: string, data?: object[], message?: string }>}
|
|
2604
|
+
*/
|
|
2605
|
+
async getCalendarProviders(opts = {}) {
|
|
2606
|
+
const { reqGet } = createRequestHelpersFromEnv(getConfig());
|
|
2607
|
+
const q = {};
|
|
2608
|
+
if (opts.host) q.host = opts.host;
|
|
2609
|
+
const res = await reqGet("/Auth/CalendarProviders", q);
|
|
2610
|
+
if (res.status === "success" && Array.isArray(res.data)) {
|
|
2611
|
+
res.data = res.data.map(mapCalendarProviderFromApi);
|
|
2612
|
+
}
|
|
2613
|
+
return res;
|
|
2614
|
+
},
|
|
2615
|
+
/**
|
|
2616
|
+
* GET Auth/AuthorizationUrl — OAuth URL to open in a popup when user picks a provider.
|
|
2617
|
+
* @param {string} participantId
|
|
2618
|
+
* @param {string|number} emailProvider — google, gmail, 1, outlook, microsoft, 2
|
|
2619
|
+
* @param {{ host?: string }} [opts]
|
|
2620
|
+
* @returns {Promise<{ status: string, data?: object, message?: string }>}
|
|
2621
|
+
*/
|
|
2622
|
+
async getAuthorizationUrl(participantId, emailProvider, opts = {}) {
|
|
2623
|
+
const { reqGet } = createRequestHelpersFromEnv(getConfig());
|
|
2624
|
+
const q = {
|
|
2625
|
+
participant_id: participantId,
|
|
2626
|
+
email_provider: String(emailProvider)
|
|
2627
|
+
};
|
|
2628
|
+
if (opts.host) q.host = opts.host;
|
|
2629
|
+
const res = await reqGet("/Auth/AuthorizationUrl", q);
|
|
2630
|
+
if (res.status === "success" && res.data) {
|
|
2631
|
+
res.data = mapAuthorizationUrlFromApi(res.data);
|
|
2632
|
+
}
|
|
2633
|
+
return res;
|
|
2634
|
+
},
|
|
2635
|
+
/**
|
|
2636
|
+
* GET Auth/Status — whether participant calendar is connected (call after OAuth popup).
|
|
2637
|
+
* @param {string} participantId
|
|
2638
|
+
* @returns {Promise<{ status: string, data?: object, message?: string }>}
|
|
2639
|
+
*/
|
|
2640
|
+
async getAuthorizationStatus(participantId) {
|
|
2641
|
+
const { reqGet } = createRequestHelpersFromEnv(getConfig());
|
|
2642
|
+
const res = await reqGet("/Auth/Status", { participant_id: participantId });
|
|
2643
|
+
if (res.status === "success" && res.data) {
|
|
2644
|
+
res.data = mapAuthorizationStatusFromApi(res.data);
|
|
2645
|
+
}
|
|
2646
|
+
return res;
|
|
2647
|
+
},
|
|
2648
|
+
/**
|
|
2649
|
+
* Open Google/Microsoft OAuth in a centered popup.
|
|
2650
|
+
* @param {string} authorizationUrl — from getAuthorizationUrl().data.authorizationUrl
|
|
2651
|
+
* @param {{ width?: number, height?: number }} [opts]
|
|
2652
|
+
* @returns {Window | null}
|
|
2653
|
+
*/
|
|
2654
|
+
openOAuthPopup(authorizationUrl, opts = {}) {
|
|
2655
|
+
if (typeof window === "undefined" || !authorizationUrl) return null;
|
|
2656
|
+
const width = opts.width ?? 500;
|
|
2657
|
+
const height = opts.height ?? 650;
|
|
2658
|
+
const left = window.screenX + (window.outerWidth - width) / 2;
|
|
2659
|
+
const top = window.screenY + (window.outerHeight - height) / 2;
|
|
2660
|
+
return window.open(
|
|
2661
|
+
authorizationUrl,
|
|
2662
|
+
"calendar-oauth",
|
|
2663
|
+
`width=${width},height=${height},left=${left},top=${top},scrollbars=yes`
|
|
2664
|
+
);
|
|
2665
|
+
},
|
|
2666
|
+
/**
|
|
2667
|
+
* Subscribe to calendar-authorization postMessage from OAuth popup (Authorized.html / Error.html).
|
|
2668
|
+
* @param {(payload: { type: string, status: 'success' | 'error', message?: string }) => void} handler
|
|
2669
|
+
* @returns {() => void} unsubscribe
|
|
2670
|
+
*/
|
|
2671
|
+
onCalendarAuthMessage(handler) {
|
|
2672
|
+
if (typeof window === "undefined") return () => {
|
|
2673
|
+
};
|
|
2674
|
+
const listener = (event) => {
|
|
2675
|
+
const payload = event == null ? void 0 : event.data;
|
|
2676
|
+
if (!payload || payload.type !== CALENDAR_AUTH_MESSAGE_TYPE) return;
|
|
2677
|
+
handler(payload);
|
|
2678
|
+
};
|
|
2679
|
+
window.addEventListener("message", listener);
|
|
2680
|
+
return () => window.removeEventListener("message", listener);
|
|
2681
|
+
}
|
|
2682
|
+
};
|
|
2683
|
+
var Auth_default = AuthModel;
|
|
2684
|
+
|
|
2536
2685
|
// src/models/appointment/index.js
|
|
2537
2686
|
import { types as types21, getEnv as getEnv11 } from "mobx-state-tree";
|
|
2538
2687
|
var RootStore = types21.model("RootStore", {
|
|
@@ -2559,9 +2708,12 @@ export {
|
|
|
2559
2708
|
Asset_default as AssetModel,
|
|
2560
2709
|
AssignmentMethod,
|
|
2561
2710
|
AttendeeStatus,
|
|
2711
|
+
Auth_default as AuthModel,
|
|
2562
2712
|
AvailabilityDetail_default as AvailabilityDetailModel,
|
|
2563
2713
|
Availability_default as AvailabilityModel,
|
|
2714
|
+
CALENDAR_AUTH_MESSAGE_TYPE,
|
|
2564
2715
|
CalendarDay_default as CalendarDayModel,
|
|
2716
|
+
EmailProvider2 as CalendarEmailProvider,
|
|
2565
2717
|
CalendarLocation_default as CalendarLocationModel,
|
|
2566
2718
|
Calendar_default as CalendarModel,
|
|
2567
2719
|
CalendarParticipant_default as CalendarParticipantModel,
|
|
@@ -2569,6 +2721,7 @@ export {
|
|
|
2569
2721
|
ConfigModel_default as ConfigModel,
|
|
2570
2722
|
CustomField_default as CustomFieldModel,
|
|
2571
2723
|
DayOfWeek,
|
|
2724
|
+
EmailProvider,
|
|
2572
2725
|
Event_default as EventModel,
|
|
2573
2726
|
Flow_default as FlowModel,
|
|
2574
2727
|
Lead_default as LeadModel,
|