@blazeo.com/calendar-client 1.0.32 → 1.0.35
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 +35 -1
- package/dist/index.js +29 -4
- package/dist/index.mjs +28 -4
- 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
|
@@ -76,9 +76,40 @@ export const CalendarModel: {
|
|
|
76
76
|
create(snapshot: object, options?: { env?: object }): unknown;
|
|
77
77
|
};
|
|
78
78
|
|
|
79
|
+
/** Event fields returned by the API (camelCase). */
|
|
80
|
+
export type EventSnapshot = {
|
|
81
|
+
eventId: string;
|
|
82
|
+
calendarId?: string;
|
|
83
|
+
participantId?: string | null;
|
|
84
|
+
title?: string | null;
|
|
85
|
+
description?: string | null;
|
|
86
|
+
calendarLocationId?: string | null;
|
|
87
|
+
/** From CalendarLocation.Value when event search endpoints enrich the row. */
|
|
88
|
+
calendarLocationValue?: string | null;
|
|
89
|
+
customLocation?: string | null;
|
|
90
|
+
visitorName?: string | null;
|
|
91
|
+
visitorEmail?: string | null;
|
|
92
|
+
visitorPhone?: string | null;
|
|
93
|
+
startDate?: string;
|
|
94
|
+
endDate?: string;
|
|
95
|
+
[key: string]: unknown;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export type EventSearchResult = {
|
|
99
|
+
events: unknown[];
|
|
100
|
+
totalCount: number;
|
|
101
|
+
};
|
|
102
|
+
|
|
79
103
|
export const EventModel: {
|
|
80
104
|
get(eventId: string): Promise<unknown>;
|
|
81
105
|
getByExternalId(externalEventId: string): Promise<unknown>;
|
|
106
|
+
getByDateRangeWithFilters(
|
|
107
|
+
companyKey: string,
|
|
108
|
+
startDateFrom: string,
|
|
109
|
+
startDateTo: string,
|
|
110
|
+
opts?: Record<string, unknown>
|
|
111
|
+
): Promise<EventSearchResult>;
|
|
112
|
+
getByFilters(companyKey: string, opts?: Record<string, unknown>): Promise<EventSearchResult>;
|
|
82
113
|
getRoundRobinParticipant(calendarId: string): Promise<unknown>;
|
|
83
114
|
getEarliestAvailableDays(calendarId: string, count: number, opts?: { year?: number; month?: number; day?: number; offset?: number }): Promise<string[] | null>;
|
|
84
115
|
getDaySelectable(calendarId: string, year: number, month: number, day: number, opts?: { participantId?: string; offset?: number }): Promise<boolean>;
|
|
@@ -100,7 +131,7 @@ export const EventModel: {
|
|
|
100
131
|
getCustomData(calendarId: string, eventId?: string): Promise<unknown>;
|
|
101
132
|
setReminder(eventId: string): Promise<unknown>;
|
|
102
133
|
setAttendeeStatus(eventId: string, attendeeStatus: number | string): Promise<unknown>;
|
|
103
|
-
create(snapshot: object, options?: { env?: object }): unknown;
|
|
134
|
+
create(snapshot: EventSnapshot | object, options?: { env?: object }): unknown;
|
|
104
135
|
};
|
|
105
136
|
|
|
106
137
|
export const AvailabilityModel: { create(snapshot: object, options?: { env?: object }): unknown };
|
|
@@ -268,6 +299,9 @@ export const LeadModel: {
|
|
|
268
299
|
notify_path?: string;
|
|
269
300
|
consumer?: string;
|
|
270
301
|
Consumer?: string;
|
|
302
|
+
/** Recipient for lead-export completion notification (or omit to use JWT email claim). */
|
|
303
|
+
userEmail?: string;
|
|
304
|
+
user_email?: string;
|
|
271
305
|
}
|
|
272
306
|
): Promise<{ status: string; data?: unknown; message?: string }>;
|
|
273
307
|
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,
|
|
@@ -476,6 +482,8 @@ var EventModel = import_mobx_state_tree4.types.model("Event", {
|
|
|
476
482
|
modifiedOn: import_mobx_state_tree4.types.optional(import_mobx_state_tree4.types.maybeNull(import_mobx_state_tree4.types.string), null),
|
|
477
483
|
externalEventId: import_mobx_state_tree4.types.optional(import_mobx_state_tree4.types.maybeNull(import_mobx_state_tree4.types.string), null),
|
|
478
484
|
calendarLocationId: import_mobx_state_tree4.types.optional(import_mobx_state_tree4.types.maybeNull(import_mobx_state_tree4.types.string), null),
|
|
485
|
+
/** Resolved location text from CalendarLocation when returned by search APIs. */
|
|
486
|
+
calendarLocationValue: import_mobx_state_tree4.types.optional(import_mobx_state_tree4.types.maybeNull(import_mobx_state_tree4.types.string), null),
|
|
479
487
|
customLocation: import_mobx_state_tree4.types.optional(import_mobx_state_tree4.types.maybeNull(import_mobx_state_tree4.types.string), null),
|
|
480
488
|
flowId: import_mobx_state_tree4.types.optional(import_mobx_state_tree4.types.maybeNull(import_mobx_state_tree4.types.string), null),
|
|
481
489
|
flowPath: import_mobx_state_tree4.types.optional(import_mobx_state_tree4.types.maybeNull(import_mobx_state_tree4.types.string), null),
|
|
@@ -483,8 +491,14 @@ var EventModel = import_mobx_state_tree4.types.model("Event", {
|
|
|
483
491
|
rescheduleLink: import_mobx_state_tree4.types.optional(import_mobx_state_tree4.types.maybeNull(import_mobx_state_tree4.types.string), null),
|
|
484
492
|
cancelLink: import_mobx_state_tree4.types.optional(import_mobx_state_tree4.types.maybeNull(import_mobx_state_tree4.types.string), null),
|
|
485
493
|
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)
|
|
487
|
-
|
|
494
|
+
offset: import_mobx_state_tree4.types.optional(import_mobx_state_tree4.types.number, 0),
|
|
495
|
+
eventSource: import_mobx_state_tree4.types.optional(import_mobx_state_tree4.types.number, EventSource.AppointmentType)
|
|
496
|
+
}).views((self) => ({
|
|
497
|
+
/** calendarLocationValue, else customLocation (one-off / typed location). */
|
|
498
|
+
get displayLocation() {
|
|
499
|
+
return self.calendarLocationValue ?? self.customLocation ?? null;
|
|
500
|
+
}
|
|
501
|
+
})).actions((self) => {
|
|
488
502
|
const { req, reqGet, reqPost } = createRequestHelpers(self, import_mobx_state_tree4.getEnv);
|
|
489
503
|
const getOffset = () => {
|
|
490
504
|
var _a, _b;
|
|
@@ -620,11 +634,14 @@ function mapEventFromApi(d) {
|
|
|
620
634
|
const pick2 = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
|
|
621
635
|
const n = (v) => v != null && v !== "" ? Number(v) : void 0;
|
|
622
636
|
return {
|
|
637
|
+
id: n(pick2("id", "Id")),
|
|
623
638
|
eventId: String(pick2("eventId", "EventId", "event_id") ?? ""),
|
|
624
639
|
calendarId: String(pick2("calendarId", "CalendarId", "calendar_id") ?? ""),
|
|
625
640
|
participantId: pick2("participantId", "ParticipantId", "participant_id") ?? null,
|
|
626
641
|
title: pick2("title", "Title"),
|
|
627
642
|
description: pick2("description", "Description"),
|
|
643
|
+
isRecurring: pick2("isRecurring", "IsRecurring", "is_recurring") ?? false,
|
|
644
|
+
recurringFrequency: n(pick2("recurringFrequency", "RecurringFrequency", "recurring_frequency")),
|
|
628
645
|
startDate: pick2("startDate", "StartDate", "start_date"),
|
|
629
646
|
endDate: pick2("endDate", "EndDate", "end_date"),
|
|
630
647
|
startHour: n(pick2("startHour", "StartHour", "start_hour")),
|
|
@@ -634,15 +651,18 @@ function mapEventFromApi(d) {
|
|
|
634
651
|
visitorName: pick2("visitorName", "VisitorName", "visitor_name"),
|
|
635
652
|
visitorEmail: pick2("visitorEmail", "VisitorEmail", "visitor_email"),
|
|
636
653
|
visitorPhone: pick2("visitorPhone", "VisitorPhone", "visitor_phone"),
|
|
637
|
-
externalEventId: pick2("externalEventId", "ExternalEventId", "external_event_id"),
|
|
654
|
+
externalEventId: pick2("externalEventId", "ExternalEventId", "externalEventId", "external_event_id"),
|
|
638
655
|
calendarLocationId: pick2("calendarLocationId", "CalendarLocationId", "calendar_location_id"),
|
|
656
|
+
calendarLocationValue: pick2("calendarLocationValue", "CalendarLocationValue", "calendar_location_value"),
|
|
639
657
|
customLocation: pick2("customLocation", "CustomLocation", "custom_location"),
|
|
640
658
|
flowId: pick2("flowId", "FlowId", "flow_id"),
|
|
641
659
|
flowPath: pick2("flowPath", "FlowPath", "flow_path"),
|
|
642
660
|
attendeeStatus: n(pick2("attendeeStatus", "AttendeeStatus", "attendee_status")),
|
|
661
|
+
eventSource: n(pick2("eventSource", "EventSource", "event_source")),
|
|
643
662
|
rescheduleLink: pick2("rescheduleLink", "RescheduleLink", "reschedule_link"),
|
|
644
663
|
cancelLink: pick2("cancelLink", "CancelLink", "cancel_link"),
|
|
645
664
|
timeZone: pick2("timeZone", "TimeZone", "time_zone"),
|
|
665
|
+
offset: n(pick2("offset", "Offset")),
|
|
646
666
|
createdOn: pick2("createdOn", "CreatedOn", "created_on"),
|
|
647
667
|
modifiedOn: pick2("modifiedOn", "ModifiedOn", "modified_on")
|
|
648
668
|
};
|
|
@@ -2497,7 +2517,7 @@ var LeadModel = import_mobx_state_tree19.types.model("Lead", {
|
|
|
2497
2517
|
},
|
|
2498
2518
|
/**
|
|
2499
2519
|
* POST /lead/export/request – queue async full CSV export for self.companyKey (no list filters).
|
|
2500
|
-
* @param {object} [opts] – { notifyPath?, consumer? } consumer = Consumer header for completion
|
|
2520
|
+
* @param {object} [opts] – { notifyPath?, consumer?, userEmail? } consumer = Consumer header; userEmail for completion notification
|
|
2501
2521
|
*/
|
|
2502
2522
|
async requestLeadExport(opts = {}) {
|
|
2503
2523
|
if (!self.companyKey || String(self.companyKey).trim() === "") {
|
|
@@ -2629,6 +2649,10 @@ LeadModel.requestExport = async (companyKey, opts = {}) => {
|
|
|
2629
2649
|
if (np != null && String(np).trim() !== "") {
|
|
2630
2650
|
body.notify_path = String(np).trim();
|
|
2631
2651
|
}
|
|
2652
|
+
const userEmail = opts.userEmail ?? opts.user_email;
|
|
2653
|
+
if (userEmail != null && String(userEmail).trim() !== "") {
|
|
2654
|
+
body.user_email = String(userEmail).trim();
|
|
2655
|
+
}
|
|
2632
2656
|
const headers = {};
|
|
2633
2657
|
const consumer = opts.consumer ?? opts.Consumer;
|
|
2634
2658
|
if (consumer != null && String(consumer).trim() !== "") {
|
|
@@ -3034,6 +3058,7 @@ function createRootStore(initialState = {}) {
|
|
|
3034
3058
|
DayOfWeek,
|
|
3035
3059
|
EmailProvider,
|
|
3036
3060
|
EventModel,
|
|
3061
|
+
EventSource,
|
|
3037
3062
|
FlowModel,
|
|
3038
3063
|
LeadModel,
|
|
3039
3064
|
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,
|
|
@@ -405,6 +410,8 @@ var EventModel = types4.model("Event", {
|
|
|
405
410
|
modifiedOn: types4.optional(types4.maybeNull(types4.string), null),
|
|
406
411
|
externalEventId: types4.optional(types4.maybeNull(types4.string), null),
|
|
407
412
|
calendarLocationId: types4.optional(types4.maybeNull(types4.string), null),
|
|
413
|
+
/** Resolved location text from CalendarLocation when returned by search APIs. */
|
|
414
|
+
calendarLocationValue: types4.optional(types4.maybeNull(types4.string), null),
|
|
408
415
|
customLocation: types4.optional(types4.maybeNull(types4.string), null),
|
|
409
416
|
flowId: types4.optional(types4.maybeNull(types4.string), null),
|
|
410
417
|
flowPath: types4.optional(types4.maybeNull(types4.string), null),
|
|
@@ -412,8 +419,14 @@ var EventModel = types4.model("Event", {
|
|
|
412
419
|
rescheduleLink: types4.optional(types4.maybeNull(types4.string), null),
|
|
413
420
|
cancelLink: types4.optional(types4.maybeNull(types4.string), null),
|
|
414
421
|
timeZone: types4.optional(types4.maybeNull(types4.string), null),
|
|
415
|
-
offset: types4.optional(types4.number, 0)
|
|
416
|
-
|
|
422
|
+
offset: types4.optional(types4.number, 0),
|
|
423
|
+
eventSource: types4.optional(types4.number, EventSource.AppointmentType)
|
|
424
|
+
}).views((self) => ({
|
|
425
|
+
/** calendarLocationValue, else customLocation (one-off / typed location). */
|
|
426
|
+
get displayLocation() {
|
|
427
|
+
return self.calendarLocationValue ?? self.customLocation ?? null;
|
|
428
|
+
}
|
|
429
|
+
})).actions((self) => {
|
|
417
430
|
const { req, reqGet, reqPost } = createRequestHelpers(self, getEnv);
|
|
418
431
|
const getOffset = () => {
|
|
419
432
|
var _a, _b;
|
|
@@ -549,11 +562,14 @@ function mapEventFromApi(d) {
|
|
|
549
562
|
const pick2 = (...keys) => keys.reduce((v, k) => v ?? d[k], void 0);
|
|
550
563
|
const n = (v) => v != null && v !== "" ? Number(v) : void 0;
|
|
551
564
|
return {
|
|
565
|
+
id: n(pick2("id", "Id")),
|
|
552
566
|
eventId: String(pick2("eventId", "EventId", "event_id") ?? ""),
|
|
553
567
|
calendarId: String(pick2("calendarId", "CalendarId", "calendar_id") ?? ""),
|
|
554
568
|
participantId: pick2("participantId", "ParticipantId", "participant_id") ?? null,
|
|
555
569
|
title: pick2("title", "Title"),
|
|
556
570
|
description: pick2("description", "Description"),
|
|
571
|
+
isRecurring: pick2("isRecurring", "IsRecurring", "is_recurring") ?? false,
|
|
572
|
+
recurringFrequency: n(pick2("recurringFrequency", "RecurringFrequency", "recurring_frequency")),
|
|
557
573
|
startDate: pick2("startDate", "StartDate", "start_date"),
|
|
558
574
|
endDate: pick2("endDate", "EndDate", "end_date"),
|
|
559
575
|
startHour: n(pick2("startHour", "StartHour", "start_hour")),
|
|
@@ -563,15 +579,18 @@ function mapEventFromApi(d) {
|
|
|
563
579
|
visitorName: pick2("visitorName", "VisitorName", "visitor_name"),
|
|
564
580
|
visitorEmail: pick2("visitorEmail", "VisitorEmail", "visitor_email"),
|
|
565
581
|
visitorPhone: pick2("visitorPhone", "VisitorPhone", "visitor_phone"),
|
|
566
|
-
externalEventId: pick2("externalEventId", "ExternalEventId", "external_event_id"),
|
|
582
|
+
externalEventId: pick2("externalEventId", "ExternalEventId", "externalEventId", "external_event_id"),
|
|
567
583
|
calendarLocationId: pick2("calendarLocationId", "CalendarLocationId", "calendar_location_id"),
|
|
584
|
+
calendarLocationValue: pick2("calendarLocationValue", "CalendarLocationValue", "calendar_location_value"),
|
|
568
585
|
customLocation: pick2("customLocation", "CustomLocation", "custom_location"),
|
|
569
586
|
flowId: pick2("flowId", "FlowId", "flow_id"),
|
|
570
587
|
flowPath: pick2("flowPath", "FlowPath", "flow_path"),
|
|
571
588
|
attendeeStatus: n(pick2("attendeeStatus", "AttendeeStatus", "attendee_status")),
|
|
589
|
+
eventSource: n(pick2("eventSource", "EventSource", "event_source")),
|
|
572
590
|
rescheduleLink: pick2("rescheduleLink", "RescheduleLink", "reschedule_link"),
|
|
573
591
|
cancelLink: pick2("cancelLink", "CancelLink", "cancel_link"),
|
|
574
592
|
timeZone: pick2("timeZone", "TimeZone", "time_zone"),
|
|
593
|
+
offset: n(pick2("offset", "Offset")),
|
|
575
594
|
createdOn: pick2("createdOn", "CreatedOn", "created_on"),
|
|
576
595
|
modifiedOn: pick2("modifiedOn", "ModifiedOn", "modified_on")
|
|
577
596
|
};
|
|
@@ -2426,7 +2445,7 @@ var LeadModel = types19.model("Lead", {
|
|
|
2426
2445
|
},
|
|
2427
2446
|
/**
|
|
2428
2447
|
* POST /lead/export/request – queue async full CSV export for self.companyKey (no list filters).
|
|
2429
|
-
* @param {object} [opts] – { notifyPath?, consumer? } consumer = Consumer header for completion
|
|
2448
|
+
* @param {object} [opts] – { notifyPath?, consumer?, userEmail? } consumer = Consumer header; userEmail for completion notification
|
|
2430
2449
|
*/
|
|
2431
2450
|
async requestLeadExport(opts = {}) {
|
|
2432
2451
|
if (!self.companyKey || String(self.companyKey).trim() === "") {
|
|
@@ -2558,6 +2577,10 @@ LeadModel.requestExport = async (companyKey, opts = {}) => {
|
|
|
2558
2577
|
if (np != null && String(np).trim() !== "") {
|
|
2559
2578
|
body.notify_path = String(np).trim();
|
|
2560
2579
|
}
|
|
2580
|
+
const userEmail = opts.userEmail ?? opts.user_email;
|
|
2581
|
+
if (userEmail != null && String(userEmail).trim() !== "") {
|
|
2582
|
+
body.user_email = String(userEmail).trim();
|
|
2583
|
+
}
|
|
2561
2584
|
const headers = {};
|
|
2562
2585
|
const consumer = opts.consumer ?? opts.Consumer;
|
|
2563
2586
|
if (consumer != null && String(consumer).trim() !== "") {
|
|
@@ -2962,6 +2985,7 @@ export {
|
|
|
2962
2985
|
DayOfWeek,
|
|
2963
2986
|
EmailProvider,
|
|
2964
2987
|
Event_default as EventModel,
|
|
2988
|
+
EventSource,
|
|
2965
2989
|
Flow_default as FlowModel,
|
|
2966
2990
|
Lead_default as LeadModel,
|
|
2967
2991
|
LocationType,
|