@blazeo.com/calendar-client 1.0.32 → 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 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
  };
@@ -2497,7 +2509,7 @@ var LeadModel = import_mobx_state_tree19.types.model("Lead", {
2497
2509
  },
2498
2510
  /**
2499
2511
  * 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 webhook
2512
+ * @param {object} [opts] – { notifyPath?, consumer?, userEmail? } consumer = Consumer header; userEmail for completion notification
2501
2513
  */
2502
2514
  async requestLeadExport(opts = {}) {
2503
2515
  if (!self.companyKey || String(self.companyKey).trim() === "") {
@@ -2629,6 +2641,10 @@ LeadModel.requestExport = async (companyKey, opts = {}) => {
2629
2641
  if (np != null && String(np).trim() !== "") {
2630
2642
  body.notify_path = String(np).trim();
2631
2643
  }
2644
+ const userEmail = opts.userEmail ?? opts.user_email;
2645
+ if (userEmail != null && String(userEmail).trim() !== "") {
2646
+ body.user_email = String(userEmail).trim();
2647
+ }
2632
2648
  const headers = {};
2633
2649
  const consumer = opts.consumer ?? opts.Consumer;
2634
2650
  if (consumer != null && String(consumer).trim() !== "") {
@@ -3034,6 +3050,7 @@ function createRootStore(initialState = {}) {
3034
3050
  DayOfWeek,
3035
3051
  EmailProvider,
3036
3052
  EventModel,
3053
+ EventSource,
3037
3054
  FlowModel,
3038
3055
  LeadModel,
3039
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
  };
@@ -2426,7 +2437,7 @@ var LeadModel = types19.model("Lead", {
2426
2437
  },
2427
2438
  /**
2428
2439
  * 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 webhook
2440
+ * @param {object} [opts] – { notifyPath?, consumer?, userEmail? } consumer = Consumer header; userEmail for completion notification
2430
2441
  */
2431
2442
  async requestLeadExport(opts = {}) {
2432
2443
  if (!self.companyKey || String(self.companyKey).trim() === "") {
@@ -2558,6 +2569,10 @@ LeadModel.requestExport = async (companyKey, opts = {}) => {
2558
2569
  if (np != null && String(np).trim() !== "") {
2559
2570
  body.notify_path = String(np).trim();
2560
2571
  }
2572
+ const userEmail = opts.userEmail ?? opts.user_email;
2573
+ if (userEmail != null && String(userEmail).trim() !== "") {
2574
+ body.user_email = String(userEmail).trim();
2575
+ }
2561
2576
  const headers = {};
2562
2577
  const consumer = opts.consumer ?? opts.Consumer;
2563
2578
  if (consumer != null && String(consumer).trim() !== "") {
@@ -2962,6 +2977,7 @@ export {
2962
2977
  DayOfWeek,
2963
2978
  EmailProvider,
2964
2979
  Event_default as EventModel,
2980
+ EventSource,
2965
2981
  Flow_default as FlowModel,
2966
2982
  Lead_default as LeadModel,
2967
2983
  LocationType,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blazeo.com/calendar-client",
3
- "version": "1.0.32",
3
+ "version": "1.0.34",
4
4
  "description": "Blazeo Calendar / Appointment API client with MobX State Tree models",
5
5
  "exports": {
6
6
  ".": {