@blazeo.com/appointment-client 1.0.5 → 1.0.7
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/blazeo.com-appointment-client-1.0.7.tgz +0 -0
- package/dist/calendar/blazeoCalendarRelationMethods.d.ts +4 -36
- package/dist/calendar/blazeoCalendarRelationMethods.js +0 -1
- package/dist/calendar/buildUnifiedCalendarView.d.ts +39 -0
- package/dist/calendar/buildUnifiedCalendarView.js +280 -0
- package/dist/calendar/calendarCreation.d.ts +27 -0
- package/dist/calendar/calendarCreation.js +167 -0
- package/dist/calendar/calendarCreationFacade.d.ts +4 -13
- package/dist/calendar/calendarCreationFacade.js +3 -5
- package/dist/calendar/createCalendar.d.ts +67 -37
- package/dist/calendar/createCalendar.js +1 -3
- package/dist/calendar/fetchCalendarDetails.d.ts +41 -18
- package/dist/calendar/fetchCalendarDetails.js +261 -51
- package/dist/calendar/fetchCalendarWithOpeningHours.d.ts +25 -21
- package/dist/calendar/fetchCalendarWithOpeningHours.js +114 -75
- package/dist/calendar/getAllParticipantOpeningHours.d.ts +22 -0
- package/dist/calendar/getAllParticipantOpeningHours.js +22 -0
- package/dist/calendar/getOpeningHours.d.ts +8 -0
- package/dist/calendar/getOpeningHours.js +9 -0
- package/dist/calendar/getParticipantOpeningHours.d.ts +37 -0
- package/dist/calendar/getParticipantOpeningHours.js +48 -0
- package/dist/calendar/getParticipants.d.ts +7 -0
- package/dist/calendar/getParticipants.js +13 -0
- package/dist/calendar/mapCalendarBoToBlazeoSnapshot.d.ts +9 -9
- package/dist/calendar/mapCalendarBoToBlazeoSnapshot.js +43 -43
- package/dist/calendar/mapCalendarToBlazeoSnapshot.d.ts +22 -3
- package/dist/calendar/mapCalendarToBlazeoSnapshot.js +0 -1
- package/dist/calendar/mapToDesiredResponse.d.ts +70 -0
- package/dist/calendar/mapToDesiredResponse.js +99 -0
- package/dist/config/applyBlazeoClientConfig.d.ts +2 -2
- package/dist/config/applyBlazeoClientConfig.js +13 -13
- package/dist/config/applyBlazeoDefaults.d.ts +0 -1
- package/dist/config/applyBlazeoDefaults.js +3 -3
- package/dist/config/blazeo.config.d.ts +10 -10
- package/dist/config/blazeo.config.js +10 -10
- package/dist/config/blazeoClientDefaults.d.ts +1 -2
- package/dist/config/blazeoClientDefaults.js +2 -3
- package/dist/config/ensureBlazeoHttpReady.d.ts +17 -0
- package/dist/config/ensureBlazeoHttpReady.js +31 -0
- package/dist/config/initializeAppointmentClient.d.ts +8 -28
- package/dist/config/initializeAppointmentClient.js +11 -24
- package/dist/config/syncBlazeoConnection.d.ts +6 -0
- package/dist/config/syncBlazeoConnection.js +18 -0
- package/dist/events/appointmentEventFacade.d.ts +55 -32
- package/dist/events/appointmentEventFacade.js +5 -10
- package/dist/events/mapAppointmentToEventSnapshot.d.ts +1 -4
- package/dist/events/mapAppointmentToEventSnapshot.js +0 -1
- package/dist/exampleData.d.ts +114 -10
- package/dist/exampleData.js +4 -5
- package/dist/facade/calendarCreationFacade.d.ts +39 -39
- package/dist/facade/calendarCreationFacade.js +95 -95
- package/dist/facade/mapCalendarBOToSnapshot.d.ts +9 -9
- package/dist/facade/mapCalendarBOToSnapshot.js +43 -43
- package/dist/facades/index.d.ts +11 -11
- package/dist/facades/index.js +11 -11
- package/dist/index.d.ts +26 -82
- package/dist/index.js +23 -33
- package/dist/models/CalendarRootModel.d.ts +36 -11
- package/dist/models/CalendarRootModel.js +22 -5
- package/dist/models/CalendarSlotModel.d.ts +8 -8
- package/dist/models/CalendarSlotModel.js +7 -7
- package/dist/models/EventModel.d.ts +10 -10
- package/dist/models/EventModel.js +9 -9
- package/dist/models/ParticipantModel.d.ts +8 -8
- package/dist/models/ParticipantModel.js +7 -7
- package/dist/models/index.d.ts +4 -4
- package/dist/models/index.js +4 -4
- package/dist/types/appointment.d.ts +27 -27
- package/dist/types/appointment.js +5 -5
- package/dist/types/calendar.d.ts +51 -51
- package/dist/types/calendar.js +5 -5
- package/dist/types/calendarBo.d.ts +61 -61
- package/dist/types/calendarBo.js +5 -5
- package/package.json +8 -2
- package/sample/.env.example +5 -0
- package/sample/build_error.txt +0 -0
- package/sample/demo.js +70 -0
- package/sample/package-lock.json +5 -2
- package/sample/package.json +3 -1
- package/sample/scripts/getInfoByCalendar.mjs +36 -0
- package/sample/scripts/getParticipantOpeningHours.mjs +48 -0
- package/sample/src/AllParticipantOpeningHoursTab.jsx +82 -0
- package/sample/src/App2.jsx +60 -3
- package/sample/src/AvailabilityTab.jsx +8 -3
- package/sample/src/BlazeoConnectionSettings.jsx +17 -16
- package/sample/src/CreateCalendarTab.jsx +23 -6
- package/sample/src/EventTab.jsx +31 -8
- package/sample/src/FetchCalendarTab.jsx +114 -38
- package/sample/src/OpeningHoursTab.jsx +87 -0
- package/sample/src/ParticipantInfoTab.jsx +77 -0
- package/sample/src/ParticipantOpeningHoursTab.jsx +98 -0
- package/sample/src/ParticipantTab.jsx +13 -4
- package/sample/src/blazeoBootstrap.js +30 -0
- package/sample/src/blazeoDemoError.js +14 -0
- package/sample/src/blazeoPushConnection.js +23 -0
- package/sample/src/main.jsx +3 -3
- package/sample/vite.config.js +19 -5
- package/src/calendar/blazeoCalendarRelationMethods.ts +19 -0
- package/src/calendar/buildUnifiedCalendarView.ts +345 -0
- package/src/calendar/calendarCreation.ts +179 -0
- package/src/calendar/createCalendar.ts +243 -0
- package/src/calendar/fetchCalendarDetails.ts +316 -0
- package/src/calendar/fetchCalendarWithOpeningHours.ts +130 -0
- package/src/calendar/getAllParticipantOpeningHours.ts +30 -0
- package/src/calendar/getOpeningHours.ts +10 -0
- package/src/calendar/getParticipantOpeningHours.ts +55 -0
- package/src/calendar/getParticipants.ts +17 -0
- package/src/calendar/mapCalendarToBlazeoSnapshot.ts +46 -0
- package/src/calendar/mapToDesiredResponse.ts +104 -0
- package/src/config/applyBlazeoDefaults.ts +14 -0
- package/src/config/blazeoClientDefaults.ts +11 -0
- package/src/config/ensureBlazeoHttpReady.ts +41 -0
- package/src/config/initializeAppointmentClient.ts +24 -0
- package/src/config/syncBlazeoConnection.ts +19 -0
- package/src/events/appointmentEventFacade.ts +148 -0
- package/src/events/mapAppointmentToEventSnapshot.ts +65 -0
- package/src/exampleData.ts +79 -0
- package/src/index.ts +51 -0
- package/src/models/CalendarRootModel.ts +60 -0
- package/tsconfig.json +16 -0
- package/blazeo.com-appointment-client-1.0.5.tgz +0 -0
package/src/index.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { getExampleSlots } from "./exampleData.js";
|
|
2
|
+
|
|
3
|
+
export {
|
|
4
|
+
initializeAppointmentClient,
|
|
5
|
+
isAppointmentClientConfigured,
|
|
6
|
+
} from "./config/initializeAppointmentClient.js";
|
|
7
|
+
export { syncBlazeoConnection } from "./config/syncBlazeoConnection.js";
|
|
8
|
+
export { ensureBlazeoHttpReady } from "./config/ensureBlazeoHttpReady.js";
|
|
9
|
+
export type { EnsureBlazeoHttpOptions } from "./config/ensureBlazeoHttpReady.js";
|
|
10
|
+
export { blazeoClientConfig } from "./config/blazeoClientDefaults.js";
|
|
11
|
+
export { applyBlazeoClientConfig } from "./config/applyBlazeoDefaults.js";
|
|
12
|
+
export { createCalendarRoot, CalendarRootModel, CalendarSlotModel, EventModel, ParticipantModel } from "./models/CalendarRootModel.js";
|
|
13
|
+
export { fetchCalendarDetails, fetchCalendarBundle, normalizeOpeningHours } from "./calendar/fetchCalendarDetails.js";
|
|
14
|
+
export {
|
|
15
|
+
buildUnifiedCalendarView,
|
|
16
|
+
type UnifiedCalendarMember,
|
|
17
|
+
type UnifiedCalendarView,
|
|
18
|
+
type UnifiedOpeningHourRow,
|
|
19
|
+
type UnifiedParticipantWithHours,
|
|
20
|
+
} from "./calendar/buildUnifiedCalendarView.js";
|
|
21
|
+
export { fetchCalendarWithOpeningHours, unwrapCalendarGetData, pickOpeningHoursArrayFromCalendarPayload, normalizeParticipantOpeningHoursResponse } from "./calendar/fetchCalendarWithOpeningHours.js";
|
|
22
|
+
export { getOpeningHours } from "./calendar/getOpeningHours.js";
|
|
23
|
+
export { getParticipantOpeningHours } from "./calendar/getParticipantOpeningHours.js";
|
|
24
|
+
export { getAllParticipantOpeningHours } from "./calendar/getAllParticipantOpeningHours.js";
|
|
25
|
+
export { getParticipants } from "./calendar/getParticipants.js";
|
|
26
|
+
export { getExampleSlots, getExampleEvents, getExampleParticipants, getExampleCalendarRoot, getExampleCalendarRootSnapshot } from "./exampleData.js";
|
|
27
|
+
|
|
28
|
+
// Re-export core models from calendar-client for convenience
|
|
29
|
+
export { createCalendarAsync, updateCalendarAsync, deleteCalendarAsync, resolveBlazeoConnection } from "./calendar/createCalendar.js";
|
|
30
|
+
export { CalendarCreation, createCalendarWithRelationsAsync, updateCalendarWithRelationsAsync, resolveParticipantIdForOpeningHour } from "./calendar/calendarCreation.js";
|
|
31
|
+
export { addParticipantToCalendar, removeParticipantFromCalendar, saveCalendarOpeningHour, saveCalendarOpeningHoursBatch } from "./calendar/blazeoCalendarRelationMethods.js";
|
|
32
|
+
export { createAppointmentEventAsync, rescheduleAppointmentEventAsync, cancelAppointmentEventAsync } from "./events/appointmentEventFacade.js";
|
|
33
|
+
export { mapAppointmentToEventSnapshot } from "./events/mapAppointmentToEventSnapshot.js";
|
|
34
|
+
|
|
35
|
+
export {
|
|
36
|
+
CalendarModel,
|
|
37
|
+
EventModel as CoreEventModel,
|
|
38
|
+
ParticipantModel as CoreParticipantModel,
|
|
39
|
+
CalendarParticipantModel,
|
|
40
|
+
configure,
|
|
41
|
+
getConfig
|
|
42
|
+
} from "@blazeo.com/calendar-client";
|
|
43
|
+
|
|
44
|
+
export const packageName = "@blazeo.com/appointment-client";
|
|
45
|
+
|
|
46
|
+
export class CalendarClient {
|
|
47
|
+
name = "CalendarClient";
|
|
48
|
+
getExampleSlots() {
|
|
49
|
+
return getExampleSlots();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { types, Instance, SnapshotIn, SnapshotOut } from "mobx-state-tree";
|
|
2
|
+
|
|
3
|
+
export const CalendarSlotModel = types.model("CalendarSlot", {
|
|
4
|
+
id: types.identifier,
|
|
5
|
+
title: types.maybeNull(types.string),
|
|
6
|
+
start: types.string,
|
|
7
|
+
end: types.string,
|
|
8
|
+
isAvailable: types.optional(types.boolean, true),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export const EventModel = types.model("Event", {
|
|
12
|
+
id: types.identifier,
|
|
13
|
+
title: types.string,
|
|
14
|
+
calendarId: types.maybeNull(types.string),
|
|
15
|
+
startsAt: types.maybeNull(types.string),
|
|
16
|
+
endsAt: types.maybeNull(types.string),
|
|
17
|
+
participantIds: types.optional(types.array(types.string), []),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export const ParticipantModel = types.model("Participant", {
|
|
21
|
+
id: types.identifier,
|
|
22
|
+
name: types.string,
|
|
23
|
+
email: types.maybeNull(types.string),
|
|
24
|
+
role: types.maybeNull(types.string),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export const CalendarRootModel = types
|
|
28
|
+
.model("CalendarRoot", {
|
|
29
|
+
slots: types.array(CalendarSlotModel),
|
|
30
|
+
events: types.array(EventModel),
|
|
31
|
+
participants: types.array(ParticipantModel),
|
|
32
|
+
})
|
|
33
|
+
.actions((self) => ({
|
|
34
|
+
removeSlot(id: string) {
|
|
35
|
+
const i = self.slots.findIndex((s) => s.id === id);
|
|
36
|
+
if (i >= 0) self.slots.splice(i, 1);
|
|
37
|
+
},
|
|
38
|
+
removeEvent(id: string) {
|
|
39
|
+
const i = self.events.findIndex((e) => e.id === id);
|
|
40
|
+
if (i >= 0) self.events.splice(i, 1);
|
|
41
|
+
},
|
|
42
|
+
removeParticipant(id: string) {
|
|
43
|
+
const i = self.participants.findIndex((p) => p.id === id);
|
|
44
|
+
if (i >= 0) self.participants.splice(i, 1);
|
|
45
|
+
},
|
|
46
|
+
}));
|
|
47
|
+
|
|
48
|
+
export interface ICalendarRoot extends Instance<typeof CalendarRootModel> {}
|
|
49
|
+
export interface ICalendarRootSnapshotIn extends SnapshotIn<typeof CalendarRootModel> {}
|
|
50
|
+
export interface ICalendarRootSnapshotOut extends SnapshotOut<typeof CalendarRootModel> {}
|
|
51
|
+
|
|
52
|
+
export function createCalendarRoot(snapshot?: ICalendarRootSnapshotIn): ICalendarRoot {
|
|
53
|
+
return snapshot
|
|
54
|
+
? CalendarRootModel.create(snapshot)
|
|
55
|
+
: CalendarRootModel.create({
|
|
56
|
+
slots: [],
|
|
57
|
+
events: [],
|
|
58
|
+
participants: [],
|
|
59
|
+
});
|
|
60
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
6
|
+
"declaration": true,
|
|
7
|
+
"outDir": "./dist",
|
|
8
|
+
"rootDir": "./src",
|
|
9
|
+
"strict": true,
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"forceConsistentCasingInFileNames": true
|
|
13
|
+
},
|
|
14
|
+
"include": ["src/**/*"],
|
|
15
|
+
"exclude": ["node_modules", "dist", "sample"]
|
|
16
|
+
}
|
|
Binary file
|