@blazeo.com/calendar-client 1.0.34 → 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/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 };
package/dist/index.js CHANGED
@@ -482,6 +482,8 @@ var EventModel = import_mobx_state_tree4.types.model("Event", {
482
482
  modifiedOn: import_mobx_state_tree4.types.optional(import_mobx_state_tree4.types.maybeNull(import_mobx_state_tree4.types.string), null),
483
483
  externalEventId: import_mobx_state_tree4.types.optional(import_mobx_state_tree4.types.maybeNull(import_mobx_state_tree4.types.string), null),
484
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),
485
487
  customLocation: import_mobx_state_tree4.types.optional(import_mobx_state_tree4.types.maybeNull(import_mobx_state_tree4.types.string), null),
486
488
  flowId: import_mobx_state_tree4.types.optional(import_mobx_state_tree4.types.maybeNull(import_mobx_state_tree4.types.string), null),
487
489
  flowPath: import_mobx_state_tree4.types.optional(import_mobx_state_tree4.types.maybeNull(import_mobx_state_tree4.types.string), null),
@@ -491,7 +493,12 @@ var EventModel = import_mobx_state_tree4.types.model("Event", {
491
493
  timeZone: import_mobx_state_tree4.types.optional(import_mobx_state_tree4.types.maybeNull(import_mobx_state_tree4.types.string), null),
492
494
  offset: import_mobx_state_tree4.types.optional(import_mobx_state_tree4.types.number, 0),
493
495
  eventSource: import_mobx_state_tree4.types.optional(import_mobx_state_tree4.types.number, EventSource.AppointmentType)
494
- }).actions((self) => {
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) => {
495
502
  const { req, reqGet, reqPost } = createRequestHelpers(self, import_mobx_state_tree4.getEnv);
496
503
  const getOffset = () => {
497
504
  var _a, _b;
@@ -646,6 +653,7 @@ function mapEventFromApi(d) {
646
653
  visitorPhone: pick2("visitorPhone", "VisitorPhone", "visitor_phone"),
647
654
  externalEventId: pick2("externalEventId", "ExternalEventId", "externalEventId", "external_event_id"),
648
655
  calendarLocationId: pick2("calendarLocationId", "CalendarLocationId", "calendar_location_id"),
656
+ calendarLocationValue: pick2("calendarLocationValue", "CalendarLocationValue", "calendar_location_value"),
649
657
  customLocation: pick2("customLocation", "CustomLocation", "custom_location"),
650
658
  flowId: pick2("flowId", "FlowId", "flow_id"),
651
659
  flowPath: pick2("flowPath", "FlowPath", "flow_path"),
package/dist/index.mjs CHANGED
@@ -410,6 +410,8 @@ var EventModel = types4.model("Event", {
410
410
  modifiedOn: types4.optional(types4.maybeNull(types4.string), null),
411
411
  externalEventId: types4.optional(types4.maybeNull(types4.string), null),
412
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),
413
415
  customLocation: types4.optional(types4.maybeNull(types4.string), null),
414
416
  flowId: types4.optional(types4.maybeNull(types4.string), null),
415
417
  flowPath: types4.optional(types4.maybeNull(types4.string), null),
@@ -419,7 +421,12 @@ var EventModel = types4.model("Event", {
419
421
  timeZone: types4.optional(types4.maybeNull(types4.string), null),
420
422
  offset: types4.optional(types4.number, 0),
421
423
  eventSource: types4.optional(types4.number, EventSource.AppointmentType)
422
- }).actions((self) => {
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) => {
423
430
  const { req, reqGet, reqPost } = createRequestHelpers(self, getEnv);
424
431
  const getOffset = () => {
425
432
  var _a, _b;
@@ -574,6 +581,7 @@ function mapEventFromApi(d) {
574
581
  visitorPhone: pick2("visitorPhone", "VisitorPhone", "visitor_phone"),
575
582
  externalEventId: pick2("externalEventId", "ExternalEventId", "externalEventId", "external_event_id"),
576
583
  calendarLocationId: pick2("calendarLocationId", "CalendarLocationId", "calendar_location_id"),
584
+ calendarLocationValue: pick2("calendarLocationValue", "CalendarLocationValue", "calendar_location_value"),
577
585
  customLocation: pick2("customLocation", "CustomLocation", "custom_location"),
578
586
  flowId: pick2("flowId", "FlowId", "flow_id"),
579
587
  flowPath: pick2("flowPath", "FlowPath", "flow_path"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blazeo.com/calendar-client",
3
- "version": "1.0.34",
3
+ "version": "1.0.35",
4
4
  "description": "Blazeo Calendar / Appointment API client with MobX State Tree models",
5
5
  "exports": {
6
6
  ".": {