@blazeo.com/calendar-client 1.0.31 → 1.0.34
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 +2 -2
- package/dist/index.d.ts +3 -0
- package/dist/index.js +34 -3
- package/dist/index.mjs +33 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -64,7 +64,7 @@ All `reqGet` / `reqPost` calls attach `Authorization: Bearer …` when a token i
|
|
|
64
64
|
```js
|
|
65
65
|
setAccessToken(session.accessToken, session.expiresAt);
|
|
66
66
|
setGetAccessToken(() => authService.acquireTokenSilent());
|
|
67
|
-
await LeadModel.requestExport('company-key');
|
|
67
|
+
await LeadModel.requestExport('company-key', { userEmail: 'user@example.com' });
|
|
68
68
|
```
|
|
69
69
|
|
|
70
70
|
## API overview
|
|
@@ -72,7 +72,7 @@ await LeadModel.requestExport('company-key');
|
|
|
72
72
|
- **CalendarModel (static):** `get`, `getByCompany`, `getTimeZones`, `getTimeZone`, `getParticipants`, `getMonth`, `getEvents`, etc.
|
|
73
73
|
- **EventModel (instance):** `get`, `create`, `cancel`, `getCancellable`, `getAvailability`, `setReminder`
|
|
74
74
|
- **FlowModel:** Same pattern as Calendar — `FlowModel.create({}, { env })` with no fields; static `get`, `getRaw`, `list`, `createFlow`, `updateFlow`, `delete`, `duplicate`, appearance/embed/public/preview helpers; instance methods mirror those using `flowId` on the snapshot
|
|
75
|
-
- **LeadModel:** `LeadModel.create({}, { env })`; static `get`, `getRaw`, `getByEmail`, `getByPhone`, `getByCompany`, `saveColumnSelection`, `getColumnSelection`, `allowedColumns`; instance `get`, `getByEmail`, `getByPhone`, `getByCompany`, `saveColumnSelection`, `getColumnSelection`. Pass `userId` in `getByCompany(companyKey, { userId })` to return only columns saved for that user.
|
|
75
|
+
- **LeadModel:** `LeadModel.create({}, { env })`; static `get`, `getRaw`, `getByEmail`, `getByPhone`, `getByCompany`, `saveColumnSelection`, `getColumnSelection`, `allowedColumns`, `requestExport`; instance `get`, `getByEmail`, `getByPhone`, `getByCompany`, `saveColumnSelection`, `getColumnSelection`, `requestLeadExport`. Pass `userId` in `getByCompany(companyKey, { userId })` to return only columns saved for that user. For `requestExport`, pass `userEmail` (or rely on JWT email claim) so the server can publish a `NotificationGenerated` message when export completes.
|
|
76
76
|
- **ParticipantModel:** static `get`, `getByEmail`, `getByIds`, `getAll`, …; instance `getByEmail` uses `email` + `companyKey` on the snapshot (see `GET /participant/getbyemail`)
|
|
77
77
|
- **AuthModel (calendar OAuth / Connect Calendar):** `getCalendarProviders`, `getAuthorizationUrl`, `getAuthorizationStatus`, `openOAuthPopup`, `onCalendarAuthMessage` — see [Calendar authorization flow](#calendar-authorization-direct-ui)
|
|
78
78
|
- **RootStore:** `addCalendar`, `addEvent`
|
package/dist/index.d.ts
CHANGED
|
@@ -268,6 +268,9 @@ export const LeadModel: {
|
|
|
268
268
|
notify_path?: string;
|
|
269
269
|
consumer?: string;
|
|
270
270
|
Consumer?: string;
|
|
271
|
+
/** Recipient for lead-export completion notification (or omit to use JWT email claim). */
|
|
272
|
+
userEmail?: string;
|
|
273
|
+
user_email?: string;
|
|
271
274
|
}
|
|
272
275
|
): Promise<{ status: string; data?: unknown; message?: string }>;
|
|
273
276
|
getByCompany(
|
package/dist/index.js
CHANGED
|
@@ -38,6 +38,7 @@ __export(index_exports, {
|
|
|
38
38
|
DayOfWeek: () => DayOfWeek,
|
|
39
39
|
EmailProvider: () => EmailProvider,
|
|
40
40
|
EventModel: () => Event_default,
|
|
41
|
+
EventSource: () => EventSource,
|
|
41
42
|
FlowModel: () => Flow_default,
|
|
42
43
|
LeadModel: () => Lead_default,
|
|
43
44
|
LocationType: () => LocationType,
|
|
@@ -344,6 +345,11 @@ var RecurringFrequency = {
|
|
|
344
345
|
Monthly: 3,
|
|
345
346
|
Yearly: 4
|
|
346
347
|
};
|
|
348
|
+
var EventSource = {
|
|
349
|
+
AppointmentType: 0,
|
|
350
|
+
OneOffMeeting: 1,
|
|
351
|
+
MeetingLink: 2
|
|
352
|
+
};
|
|
347
353
|
var DayOfWeek = {
|
|
348
354
|
Sunday: 0,
|
|
349
355
|
Monday: 1,
|
|
@@ -483,7 +489,8 @@ var EventModel = import_mobx_state_tree4.types.model("Event", {
|
|
|
483
489
|
rescheduleLink: import_mobx_state_tree4.types.optional(import_mobx_state_tree4.types.maybeNull(import_mobx_state_tree4.types.string), null),
|
|
484
490
|
cancelLink: import_mobx_state_tree4.types.optional(import_mobx_state_tree4.types.maybeNull(import_mobx_state_tree4.types.string), null),
|
|
485
491
|
timeZone: import_mobx_state_tree4.types.optional(import_mobx_state_tree4.types.maybeNull(import_mobx_state_tree4.types.string), null),
|
|
486
|
-
offset: import_mobx_state_tree4.types.optional(import_mobx_state_tree4.types.number, 0)
|
|
492
|
+
offset: import_mobx_state_tree4.types.optional(import_mobx_state_tree4.types.number, 0),
|
|
493
|
+
eventSource: import_mobx_state_tree4.types.optional(import_mobx_state_tree4.types.number, EventSource.AppointmentType)
|
|
487
494
|
}).actions((self) => {
|
|
488
495
|
const { req, reqGet, reqPost } = createRequestHelpers(self, import_mobx_state_tree4.getEnv);
|
|
489
496
|
const getOffset = () => {
|
|
@@ -620,11 +627,14 @@ function mapEventFromApi(d) {
|
|
|
620
627
|
const pick2 = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
|
|
621
628
|
const n = (v) => v != null && v !== "" ? Number(v) : void 0;
|
|
622
629
|
return {
|
|
630
|
+
id: n(pick2("id", "Id")),
|
|
623
631
|
eventId: String(pick2("eventId", "EventId", "event_id") ?? ""),
|
|
624
632
|
calendarId: String(pick2("calendarId", "CalendarId", "calendar_id") ?? ""),
|
|
625
633
|
participantId: pick2("participantId", "ParticipantId", "participant_id") ?? null,
|
|
626
634
|
title: pick2("title", "Title"),
|
|
627
635
|
description: pick2("description", "Description"),
|
|
636
|
+
isRecurring: pick2("isRecurring", "IsRecurring", "is_recurring") ?? false,
|
|
637
|
+
recurringFrequency: n(pick2("recurringFrequency", "RecurringFrequency", "recurring_frequency")),
|
|
628
638
|
startDate: pick2("startDate", "StartDate", "start_date"),
|
|
629
639
|
endDate: pick2("endDate", "EndDate", "end_date"),
|
|
630
640
|
startHour: n(pick2("startHour", "StartHour", "start_hour")),
|
|
@@ -634,15 +644,17 @@ function mapEventFromApi(d) {
|
|
|
634
644
|
visitorName: pick2("visitorName", "VisitorName", "visitor_name"),
|
|
635
645
|
visitorEmail: pick2("visitorEmail", "VisitorEmail", "visitor_email"),
|
|
636
646
|
visitorPhone: pick2("visitorPhone", "VisitorPhone", "visitor_phone"),
|
|
637
|
-
externalEventId: pick2("externalEventId", "ExternalEventId", "external_event_id"),
|
|
647
|
+
externalEventId: pick2("externalEventId", "ExternalEventId", "externalEventId", "external_event_id"),
|
|
638
648
|
calendarLocationId: pick2("calendarLocationId", "CalendarLocationId", "calendar_location_id"),
|
|
639
649
|
customLocation: pick2("customLocation", "CustomLocation", "custom_location"),
|
|
640
650
|
flowId: pick2("flowId", "FlowId", "flow_id"),
|
|
641
651
|
flowPath: pick2("flowPath", "FlowPath", "flow_path"),
|
|
642
652
|
attendeeStatus: n(pick2("attendeeStatus", "AttendeeStatus", "attendee_status")),
|
|
653
|
+
eventSource: n(pick2("eventSource", "EventSource", "event_source")),
|
|
643
654
|
rescheduleLink: pick2("rescheduleLink", "RescheduleLink", "reschedule_link"),
|
|
644
655
|
cancelLink: pick2("cancelLink", "CancelLink", "cancel_link"),
|
|
645
656
|
timeZone: pick2("timeZone", "TimeZone", "time_zone"),
|
|
657
|
+
offset: n(pick2("offset", "Offset")),
|
|
646
658
|
createdOn: pick2("createdOn", "CreatedOn", "created_on"),
|
|
647
659
|
modifiedOn: pick2("modifiedOn", "ModifiedOn", "modified_on")
|
|
648
660
|
};
|
|
@@ -1962,6 +1974,12 @@ var CalendarLocationModel = import_mobx_state_tree16.types.model("CalendarLocati
|
|
|
1962
1974
|
if (!resolvedCalendarId) return { status: "failure", message: "calendarId required" };
|
|
1963
1975
|
return reqGet("/Calendar/Location/Get", { calendar_id: resolvedCalendarId });
|
|
1964
1976
|
},
|
|
1977
|
+
/** GET Calendar/Location/GetById – fetch a single location by calendar_location_id */
|
|
1978
|
+
async getById(calendarLocationId) {
|
|
1979
|
+
const resolvedCalendarLocationId = calendarLocationId ?? self.calendarLocationId;
|
|
1980
|
+
if (!resolvedCalendarLocationId) return { status: "failure", message: "calendarLocationId required" };
|
|
1981
|
+
return reqGet("/Calendar/Location/GetById", { calendar_location_id: resolvedCalendarLocationId });
|
|
1982
|
+
},
|
|
1965
1983
|
/** POST Calendar/Location/Save – create or update location */
|
|
1966
1984
|
async save() {
|
|
1967
1985
|
const res = await reqPost("/Calendar/Location/Save", toPayload4(self));
|
|
@@ -1998,6 +2016,14 @@ CalendarLocationModel.getByCalendar = async (calendarId) => {
|
|
|
1998
2016
|
}
|
|
1999
2017
|
return null;
|
|
2000
2018
|
};
|
|
2019
|
+
CalendarLocationModel.getById = async (calendarLocationId) => {
|
|
2020
|
+
const { reqGet } = createRequestHelpersFromEnv(getConfig());
|
|
2021
|
+
const res = await reqGet("/Calendar/Location/GetById", { calendar_location_id: calendarLocationId });
|
|
2022
|
+
if (res.status === "success" && res.data) {
|
|
2023
|
+
return CalendarLocationModel.create(mapCalendarLocationFromApi(res.data), { env: getConfig() });
|
|
2024
|
+
}
|
|
2025
|
+
return null;
|
|
2026
|
+
};
|
|
2001
2027
|
CalendarLocationModel.save = async (payload) => {
|
|
2002
2028
|
const { reqPost } = createRequestHelpersFromEnv(getConfig());
|
|
2003
2029
|
const res = await reqPost("/Calendar/Location/Save", payload);
|
|
@@ -2483,7 +2509,7 @@ var LeadModel = import_mobx_state_tree19.types.model("Lead", {
|
|
|
2483
2509
|
},
|
|
2484
2510
|
/**
|
|
2485
2511
|
* POST /lead/export/request – queue async full CSV export for self.companyKey (no list filters).
|
|
2486
|
-
* @param {object} [opts] – { notifyPath?, consumer? } consumer = Consumer header for completion
|
|
2512
|
+
* @param {object} [opts] – { notifyPath?, consumer?, userEmail? } consumer = Consumer header; userEmail for completion notification
|
|
2487
2513
|
*/
|
|
2488
2514
|
async requestLeadExport(opts = {}) {
|
|
2489
2515
|
if (!self.companyKey || String(self.companyKey).trim() === "") {
|
|
@@ -2615,6 +2641,10 @@ LeadModel.requestExport = async (companyKey, opts = {}) => {
|
|
|
2615
2641
|
if (np != null && String(np).trim() !== "") {
|
|
2616
2642
|
body.notify_path = String(np).trim();
|
|
2617
2643
|
}
|
|
2644
|
+
const userEmail = opts.userEmail ?? opts.user_email;
|
|
2645
|
+
if (userEmail != null && String(userEmail).trim() !== "") {
|
|
2646
|
+
body.user_email = String(userEmail).trim();
|
|
2647
|
+
}
|
|
2618
2648
|
const headers = {};
|
|
2619
2649
|
const consumer = opts.consumer ?? opts.Consumer;
|
|
2620
2650
|
if (consumer != null && String(consumer).trim() !== "") {
|
|
@@ -3020,6 +3050,7 @@ function createRootStore(initialState = {}) {
|
|
|
3020
3050
|
DayOfWeek,
|
|
3021
3051
|
EmailProvider,
|
|
3022
3052
|
EventModel,
|
|
3053
|
+
EventSource,
|
|
3023
3054
|
FlowModel,
|
|
3024
3055
|
LeadModel,
|
|
3025
3056
|
LocationType,
|
package/dist/index.mjs
CHANGED
|
@@ -273,6 +273,11 @@ var RecurringFrequency = {
|
|
|
273
273
|
Monthly: 3,
|
|
274
274
|
Yearly: 4
|
|
275
275
|
};
|
|
276
|
+
var EventSource = {
|
|
277
|
+
AppointmentType: 0,
|
|
278
|
+
OneOffMeeting: 1,
|
|
279
|
+
MeetingLink: 2
|
|
280
|
+
};
|
|
276
281
|
var DayOfWeek = {
|
|
277
282
|
Sunday: 0,
|
|
278
283
|
Monday: 1,
|
|
@@ -412,7 +417,8 @@ var EventModel = types4.model("Event", {
|
|
|
412
417
|
rescheduleLink: types4.optional(types4.maybeNull(types4.string), null),
|
|
413
418
|
cancelLink: types4.optional(types4.maybeNull(types4.string), null),
|
|
414
419
|
timeZone: types4.optional(types4.maybeNull(types4.string), null),
|
|
415
|
-
offset: types4.optional(types4.number, 0)
|
|
420
|
+
offset: types4.optional(types4.number, 0),
|
|
421
|
+
eventSource: types4.optional(types4.number, EventSource.AppointmentType)
|
|
416
422
|
}).actions((self) => {
|
|
417
423
|
const { req, reqGet, reqPost } = createRequestHelpers(self, getEnv);
|
|
418
424
|
const getOffset = () => {
|
|
@@ -549,11 +555,14 @@ function mapEventFromApi(d) {
|
|
|
549
555
|
const pick2 = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
|
|
550
556
|
const n = (v) => v != null && v !== "" ? Number(v) : void 0;
|
|
551
557
|
return {
|
|
558
|
+
id: n(pick2("id", "Id")),
|
|
552
559
|
eventId: String(pick2("eventId", "EventId", "event_id") ?? ""),
|
|
553
560
|
calendarId: String(pick2("calendarId", "CalendarId", "calendar_id") ?? ""),
|
|
554
561
|
participantId: pick2("participantId", "ParticipantId", "participant_id") ?? null,
|
|
555
562
|
title: pick2("title", "Title"),
|
|
556
563
|
description: pick2("description", "Description"),
|
|
564
|
+
isRecurring: pick2("isRecurring", "IsRecurring", "is_recurring") ?? false,
|
|
565
|
+
recurringFrequency: n(pick2("recurringFrequency", "RecurringFrequency", "recurring_frequency")),
|
|
557
566
|
startDate: pick2("startDate", "StartDate", "start_date"),
|
|
558
567
|
endDate: pick2("endDate", "EndDate", "end_date"),
|
|
559
568
|
startHour: n(pick2("startHour", "StartHour", "start_hour")),
|
|
@@ -563,15 +572,17 @@ function mapEventFromApi(d) {
|
|
|
563
572
|
visitorName: pick2("visitorName", "VisitorName", "visitor_name"),
|
|
564
573
|
visitorEmail: pick2("visitorEmail", "VisitorEmail", "visitor_email"),
|
|
565
574
|
visitorPhone: pick2("visitorPhone", "VisitorPhone", "visitor_phone"),
|
|
566
|
-
externalEventId: pick2("externalEventId", "ExternalEventId", "external_event_id"),
|
|
575
|
+
externalEventId: pick2("externalEventId", "ExternalEventId", "externalEventId", "external_event_id"),
|
|
567
576
|
calendarLocationId: pick2("calendarLocationId", "CalendarLocationId", "calendar_location_id"),
|
|
568
577
|
customLocation: pick2("customLocation", "CustomLocation", "custom_location"),
|
|
569
578
|
flowId: pick2("flowId", "FlowId", "flow_id"),
|
|
570
579
|
flowPath: pick2("flowPath", "FlowPath", "flow_path"),
|
|
571
580
|
attendeeStatus: n(pick2("attendeeStatus", "AttendeeStatus", "attendee_status")),
|
|
581
|
+
eventSource: n(pick2("eventSource", "EventSource", "event_source")),
|
|
572
582
|
rescheduleLink: pick2("rescheduleLink", "RescheduleLink", "reschedule_link"),
|
|
573
583
|
cancelLink: pick2("cancelLink", "CancelLink", "cancel_link"),
|
|
574
584
|
timeZone: pick2("timeZone", "TimeZone", "time_zone"),
|
|
585
|
+
offset: n(pick2("offset", "Offset")),
|
|
575
586
|
createdOn: pick2("createdOn", "CreatedOn", "created_on"),
|
|
576
587
|
modifiedOn: pick2("modifiedOn", "ModifiedOn", "modified_on")
|
|
577
588
|
};
|
|
@@ -1891,6 +1902,12 @@ var CalendarLocationModel = types16.model("CalendarLocation", {
|
|
|
1891
1902
|
if (!resolvedCalendarId) return { status: "failure", message: "calendarId required" };
|
|
1892
1903
|
return reqGet("/Calendar/Location/Get", { calendar_id: resolvedCalendarId });
|
|
1893
1904
|
},
|
|
1905
|
+
/** GET Calendar/Location/GetById – fetch a single location by calendar_location_id */
|
|
1906
|
+
async getById(calendarLocationId) {
|
|
1907
|
+
const resolvedCalendarLocationId = calendarLocationId ?? self.calendarLocationId;
|
|
1908
|
+
if (!resolvedCalendarLocationId) return { status: "failure", message: "calendarLocationId required" };
|
|
1909
|
+
return reqGet("/Calendar/Location/GetById", { calendar_location_id: resolvedCalendarLocationId });
|
|
1910
|
+
},
|
|
1894
1911
|
/** POST Calendar/Location/Save – create or update location */
|
|
1895
1912
|
async save() {
|
|
1896
1913
|
const res = await reqPost("/Calendar/Location/Save", toPayload4(self));
|
|
@@ -1927,6 +1944,14 @@ CalendarLocationModel.getByCalendar = async (calendarId) => {
|
|
|
1927
1944
|
}
|
|
1928
1945
|
return null;
|
|
1929
1946
|
};
|
|
1947
|
+
CalendarLocationModel.getById = async (calendarLocationId) => {
|
|
1948
|
+
const { reqGet } = createRequestHelpersFromEnv(getConfig());
|
|
1949
|
+
const res = await reqGet("/Calendar/Location/GetById", { calendar_location_id: calendarLocationId });
|
|
1950
|
+
if (res.status === "success" && res.data) {
|
|
1951
|
+
return CalendarLocationModel.create(mapCalendarLocationFromApi(res.data), { env: getConfig() });
|
|
1952
|
+
}
|
|
1953
|
+
return null;
|
|
1954
|
+
};
|
|
1930
1955
|
CalendarLocationModel.save = async (payload) => {
|
|
1931
1956
|
const { reqPost } = createRequestHelpersFromEnv(getConfig());
|
|
1932
1957
|
const res = await reqPost("/Calendar/Location/Save", payload);
|
|
@@ -2412,7 +2437,7 @@ var LeadModel = types19.model("Lead", {
|
|
|
2412
2437
|
},
|
|
2413
2438
|
/**
|
|
2414
2439
|
* POST /lead/export/request – queue async full CSV export for self.companyKey (no list filters).
|
|
2415
|
-
* @param {object} [opts] – { notifyPath?, consumer? } consumer = Consumer header for completion
|
|
2440
|
+
* @param {object} [opts] – { notifyPath?, consumer?, userEmail? } consumer = Consumer header; userEmail for completion notification
|
|
2416
2441
|
*/
|
|
2417
2442
|
async requestLeadExport(opts = {}) {
|
|
2418
2443
|
if (!self.companyKey || String(self.companyKey).trim() === "") {
|
|
@@ -2544,6 +2569,10 @@ LeadModel.requestExport = async (companyKey, opts = {}) => {
|
|
|
2544
2569
|
if (np != null && String(np).trim() !== "") {
|
|
2545
2570
|
body.notify_path = String(np).trim();
|
|
2546
2571
|
}
|
|
2572
|
+
const userEmail = opts.userEmail ?? opts.user_email;
|
|
2573
|
+
if (userEmail != null && String(userEmail).trim() !== "") {
|
|
2574
|
+
body.user_email = String(userEmail).trim();
|
|
2575
|
+
}
|
|
2547
2576
|
const headers = {};
|
|
2548
2577
|
const consumer = opts.consumer ?? opts.Consumer;
|
|
2549
2578
|
if (consumer != null && String(consumer).trim() !== "") {
|
|
@@ -2948,6 +2977,7 @@ export {
|
|
|
2948
2977
|
DayOfWeek,
|
|
2949
2978
|
EmailProvider,
|
|
2950
2979
|
Event_default as EventModel,
|
|
2980
|
+
EventSource,
|
|
2951
2981
|
Flow_default as FlowModel,
|
|
2952
2982
|
Lead_default as LeadModel,
|
|
2953
2983
|
LocationType,
|