@blazeo.com/appointment-client 1.0.13 → 1.0.14
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.14.tgz +0 -0
- package/package.json +3 -2
- package/sample/src/EventTab.jsx +435 -395
- package/src/calendar/calendarCreation.ts +62 -15
- package/src/events/getAppointmentsByFilter.ts +98 -0
- package/src/index.ts +15 -4
- package/blazeo.com-appointment-client-1.0.11.tgz +0 -0
- package/blazeo.com-appointment-client-1.0.13.tgz +0 -0
- package/dist/calendar/blazeoCalendarRelationMethods.d.ts +0 -8
- package/dist/calendar/blazeoCalendarRelationMethods.d.ts.map +0 -1
- package/dist/calendar/blazeoCalendarRelationMethods.js +0 -16
- package/dist/calendar/blazeoCalendarRelationMethods.js.map +0 -1
- package/dist/calendar/buildUnifiedCalendarView.d.ts +0 -39
- package/dist/calendar/buildUnifiedCalendarView.js +0 -301
- package/dist/calendar/calendarCreation.d.ts +0 -27
- package/dist/calendar/calendarCreation.js +0 -191
- package/dist/calendar/calendarCreationFacade.d.ts +0 -27
- package/dist/calendar/calendarCreationFacade.d.ts.map +0 -1
- package/dist/calendar/calendarCreationFacade.js +0 -167
- package/dist/calendar/calendarCreationFacade.js.map +0 -1
- package/dist/calendar/createCalendar.d.ts +0 -81
- package/dist/calendar/createCalendar.d.ts.map +0 -1
- package/dist/calendar/createCalendar.js +0 -206
- package/dist/calendar/createCalendar.js.map +0 -1
- package/dist/calendar/fetchCalendarDetails.d.ts +0 -41
- package/dist/calendar/fetchCalendarDetails.js +0 -265
- package/dist/calendar/fetchCalendarWithOpeningHours.d.ts +0 -25
- package/dist/calendar/fetchCalendarWithOpeningHours.js +0 -114
- package/dist/calendar/getAllParticipantOpeningHours.d.ts +0 -22
- package/dist/calendar/getAllParticipantOpeningHours.js +0 -22
- package/dist/calendar/getCalendarsByCompany.d.ts +0 -9
- package/dist/calendar/getCalendarsByCompany.js +0 -62
- package/dist/calendar/getOpeningHours.d.ts +0 -8
- package/dist/calendar/getOpeningHours.js +0 -9
- package/dist/calendar/getParticipantOpeningHours.d.ts +0 -37
- package/dist/calendar/getParticipantOpeningHours.js +0 -48
- package/dist/calendar/getParticipants.d.ts +0 -7
- package/dist/calendar/getParticipants.js +0 -13
- package/dist/calendar/mapCalendarBoToBlazeoSnapshot.d.ts +0 -10
- package/dist/calendar/mapCalendarBoToBlazeoSnapshot.d.ts.map +0 -1
- package/dist/calendar/mapCalendarBoToBlazeoSnapshot.js +0 -44
- package/dist/calendar/mapCalendarBoToBlazeoSnapshot.js.map +0 -1
- package/dist/calendar/mapCalendarToBlazeoSnapshot.d.ts +0 -29
- package/dist/calendar/mapCalendarToBlazeoSnapshot.d.ts.map +0 -1
- package/dist/calendar/mapCalendarToBlazeoSnapshot.js +0 -44
- package/dist/calendar/mapCalendarToBlazeoSnapshot.js.map +0 -1
- package/dist/calendar/mapToDesiredResponse.d.ts +0 -56
- package/dist/calendar/mapToDesiredResponse.js +0 -111
- package/dist/config/applyBlazeoClientConfig.d.ts +0 -3
- package/dist/config/applyBlazeoClientConfig.d.ts.map +0 -1
- package/dist/config/applyBlazeoClientConfig.js +0 -14
- package/dist/config/applyBlazeoClientConfig.js.map +0 -1
- package/dist/config/applyBlazeoDefaults.d.ts +0 -2
- package/dist/config/applyBlazeoDefaults.d.ts.map +0 -1
- package/dist/config/applyBlazeoDefaults.js +0 -14
- package/dist/config/applyBlazeoDefaults.js.map +0 -1
- package/dist/config/blazeo.config.d.ts +0 -11
- package/dist/config/blazeo.config.d.ts.map +0 -1
- package/dist/config/blazeo.config.js +0 -11
- package/dist/config/blazeo.config.js.map +0 -1
- package/dist/config/blazeoClientDefaults.d.ts +0 -11
- package/dist/config/blazeoClientDefaults.d.ts.map +0 -1
- package/dist/config/blazeoClientDefaults.js +0 -11
- package/dist/config/blazeoClientDefaults.js.map +0 -1
- package/dist/config/ensureBlazeoHttpReady.d.ts +0 -17
- package/dist/config/ensureBlazeoHttpReady.js +0 -31
- package/dist/config/initializeAppointmentClient.d.ts +0 -11
- package/dist/config/initializeAppointmentClient.d.ts.map +0 -1
- package/dist/config/initializeAppointmentClient.js +0 -15
- package/dist/config/initializeAppointmentClient.js.map +0 -1
- package/dist/config/syncBlazeoConnection.d.ts +0 -6
- package/dist/config/syncBlazeoConnection.js +0 -18
- package/dist/events/appointmentEventFacade.d.ts +0 -67
- package/dist/events/appointmentEventFacade.d.ts.map +0 -1
- package/dist/events/appointmentEventFacade.js +0 -124
- package/dist/events/appointmentEventFacade.js.map +0 -1
- package/dist/events/mapAppointmentToEventSnapshot.d.ts +0 -5
- package/dist/events/mapAppointmentToEventSnapshot.d.ts.map +0 -1
- package/dist/events/mapAppointmentToEventSnapshot.js +0 -57
- package/dist/events/mapAppointmentToEventSnapshot.js.map +0 -1
- package/dist/exampleData.d.ts +0 -119
- package/dist/exampleData.d.ts.map +0 -1
- package/dist/exampleData.js +0 -71
- package/dist/exampleData.js.map +0 -1
- package/dist/facade/calendarCreationFacade.d.ts +0 -40
- package/dist/facade/calendarCreationFacade.d.ts.map +0 -1
- package/dist/facade/calendarCreationFacade.js +0 -96
- package/dist/facade/calendarCreationFacade.js.map +0 -1
- package/dist/facade/mapCalendarBOToSnapshot.d.ts +0 -10
- package/dist/facade/mapCalendarBOToSnapshot.d.ts.map +0 -1
- package/dist/facade/mapCalendarBOToSnapshot.js +0 -44
- package/dist/facade/mapCalendarBOToSnapshot.js.map +0 -1
- package/dist/facades/index.d.ts +0 -12
- package/dist/facades/index.d.ts.map +0 -1
- package/dist/facades/index.js +0 -12
- package/dist/facades/index.js.map +0 -1
- package/dist/index.d.ts +0 -79
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -39
- package/dist/index.js.map +0 -1
- package/dist/lead/fetchLeadDetails.d.ts +0 -56
- package/dist/lead/fetchLeadDetails.js +0 -61
- package/dist/models/CalendarRootModel.d.ts +0 -56
- package/dist/models/CalendarRootModel.d.ts.map +0 -1
- package/dist/models/CalendarRootModel.js +0 -54
- package/dist/models/CalendarRootModel.js.map +0 -1
- package/dist/models/CalendarSlotModel.d.ts +0 -9
- package/dist/models/CalendarSlotModel.d.ts.map +0 -1
- package/dist/models/CalendarSlotModel.js +0 -8
- package/dist/models/CalendarSlotModel.js.map +0 -1
- package/dist/models/EventModel.d.ts +0 -11
- package/dist/models/EventModel.d.ts.map +0 -1
- package/dist/models/EventModel.js +0 -10
- package/dist/models/EventModel.js.map +0 -1
- package/dist/models/ParticipantModel.d.ts +0 -9
- package/dist/models/ParticipantModel.d.ts.map +0 -1
- package/dist/models/ParticipantModel.js +0 -8
- package/dist/models/ParticipantModel.js.map +0 -1
- package/dist/models/index.d.ts +0 -5
- package/dist/models/index.d.ts.map +0 -1
- package/dist/models/index.js +0 -5
- package/dist/models/index.js.map +0 -1
- package/dist/types/appointment.d.ts +0 -28
- package/dist/types/appointment.d.ts.map +0 -1
- package/dist/types/appointment.js +0 -6
- package/dist/types/appointment.js.map +0 -1
- package/dist/types/calendar.d.ts +0 -52
- package/dist/types/calendar.d.ts.map +0 -1
- package/dist/types/calendar.js +0 -6
- package/dist/types/calendar.js.map +0 -1
- package/dist/types/calendarBo.d.ts +0 -62
- package/dist/types/calendarBo.d.ts.map +0 -1
- package/dist/types/calendarBo.js +0 -6
- package/dist/types/calendarBo.js.map +0 -1
- package/sample/package-lock.json +0 -1778
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Central Blazeo API settings for `appointment-client`.
|
|
3
|
-
* Edit once; `configure()` runs when you import this package (see `index.ts`).
|
|
4
|
-
*
|
|
5
|
-
* @example baseUrl: "https://apptscheduling.azurewebsites.net"
|
|
6
|
-
*/
|
|
7
|
-
export const blazeoClientConfig = {
|
|
8
|
-
baseUrl: "",
|
|
9
|
-
consumer: "",
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=blazeo.config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"blazeo.config.js","sourceRoot":"","sources":["../../src/config/blazeo.config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAG3B;IACF,OAAO,EAAE,EAAE;IACX,QAAQ,EAAE,EAAE;CACb,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Optional file-based defaults for local development or publishing a fork.
|
|
3
|
-
* Host apps should prefer {@link initializeAppointmentClient} with env-driven `baseUrl` / `consumer`.
|
|
4
|
-
* To apply these values, call {@link applyBlazeoClientConfig} during bootstrap (not automatic on import).
|
|
5
|
-
*
|
|
6
|
-
* @example baseUrl: "https://apptscheduling.azurewebsites.net"
|
|
7
|
-
*/
|
|
8
|
-
export declare const blazeoClientConfig: {
|
|
9
|
-
baseUrl: string;
|
|
10
|
-
consumer: string;
|
|
11
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"blazeoClientDefaults.d.ts","sourceRoot":"","sources":["../../src/config/blazeoClientDefaults.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,EAAE;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CAInB,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Optional file-based defaults for local development or publishing a fork.
|
|
3
|
-
* Host apps should prefer {@link initializeAppointmentClient} with env-driven `baseUrl` / `consumer`.
|
|
4
|
-
* To apply these values, call {@link applyBlazeoClientConfig} during bootstrap (not automatic on import).
|
|
5
|
-
*
|
|
6
|
-
* @example baseUrl: "https://apptscheduling.azurewebsites.net"
|
|
7
|
-
*/
|
|
8
|
-
export const blazeoClientConfig = {
|
|
9
|
-
baseUrl: "https://apptscheduling.azurewebsites.net",
|
|
10
|
-
consumer: "smarthub",
|
|
11
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"blazeoClientDefaults.js","sourceRoot":"","sources":["../../src/config/blazeoClientDefaults.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAG3B;IACF,OAAO,EAAE,EAAE;IACX,QAAQ,EAAE,EAAE;CACb,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export type EnsureBlazeoHttpOptions = {
|
|
2
|
-
baseUrl?: string;
|
|
3
|
-
consumer?: string;
|
|
4
|
-
};
|
|
5
|
-
/**
|
|
6
|
-
* Ensures global Blazeo `configure({ baseUrl })` runs before any `CalendarModel` / `EventModel` HTTP.
|
|
7
|
-
* Uses the same resolution as {@link resolveBlazeoConnection}: explicit args, existing `getConfig()`,
|
|
8
|
-
* then `blazeoClientDefaults` — so file defaults apply even if the host never called `configure`.
|
|
9
|
-
*/
|
|
10
|
-
export declare function ensureBlazeoHttpReady(options?: EnsureBlazeoHttpOptions): {
|
|
11
|
-
ok: true;
|
|
12
|
-
baseUrl: string;
|
|
13
|
-
consumer?: string;
|
|
14
|
-
} | {
|
|
15
|
-
ok: false;
|
|
16
|
-
error: string;
|
|
17
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { configure } from "@blazeo.com/calendar-client";
|
|
2
|
-
import { resolveBlazeoConnection } from "../calendar/createCalendar.js";
|
|
3
|
-
/**
|
|
4
|
-
* Ensures global Blazeo `configure({ baseUrl })` runs before any `CalendarModel` / `EventModel` HTTP.
|
|
5
|
-
* Uses the same resolution as {@link resolveBlazeoConnection}: explicit args, existing `getConfig()`,
|
|
6
|
-
* then `blazeoClientDefaults` — so file defaults apply even if the host never called `configure`.
|
|
7
|
-
*/
|
|
8
|
-
export function ensureBlazeoHttpReady(options = {}) {
|
|
9
|
-
// Hard-prefer explicit args (call-site can bypass any module-resolution mismatch).
|
|
10
|
-
const explicitBase = options.baseUrl?.trim().replace(/\/+$/, "");
|
|
11
|
-
const explicitConsumer = options.consumer?.trim() || undefined;
|
|
12
|
-
if (explicitBase) {
|
|
13
|
-
configure({
|
|
14
|
-
baseUrl: explicitBase,
|
|
15
|
-
...(explicitConsumer ? { consumer: explicitConsumer } : {}),
|
|
16
|
-
});
|
|
17
|
-
return { ok: true, baseUrl: explicitBase, ...(explicitConsumer ? { consumer: explicitConsumer } : {}) };
|
|
18
|
-
}
|
|
19
|
-
const { baseUrl, consumer } = resolveBlazeoConnection(options);
|
|
20
|
-
if (!baseUrl) {
|
|
21
|
-
return {
|
|
22
|
-
ok: false,
|
|
23
|
-
error: "Blazeo base URL is not set. Call initializeAppointmentClient({ baseUrl }) or configure({ baseUrl }) at app startup, set blazeoClientConfig.baseUrl, or pass baseUrl when calling fetch APIs.",
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
configure({
|
|
27
|
-
baseUrl,
|
|
28
|
-
...(consumer ? { consumer } : {}),
|
|
29
|
-
});
|
|
30
|
-
return { ok: true, baseUrl, ...(consumer ? { consumer } : {}) };
|
|
31
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export interface AppointmentClientConfig {
|
|
2
|
-
baseUrl: string;
|
|
3
|
-
consumer?: string;
|
|
4
|
-
fetch?: typeof fetch;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Applies Blazeo connection (same as {@link syncBlazeoConnection}) and marks the client as configured
|
|
8
|
-
* when a non-empty `baseUrl` was written to `@blazeo.com/calendar-client`.
|
|
9
|
-
*/
|
|
10
|
-
export declare function initializeAppointmentClient(config: AppointmentClientConfig): void;
|
|
11
|
-
export declare function isAppointmentClientConfigured(): boolean;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"initializeAppointmentClient.d.ts","sourceRoot":"","sources":["../../src/config/initializeAppointmentClient.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,+BAA+B,GAAG;IAC5C,gFAAgF;IAChF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0DAA0D;IAC1D,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB,4DAA4D;IAC5D,gBAAgB,CAAC,EAAE,MAAM,MAAM,CAAC;CACjC,CAAC;AAEF,wBAAgB,2BAA2B,CACzC,OAAO,GAAE,+BAAoC,GAC5C,IAAI,CAqBN;AAED,0FAA0F;AAC1F,wBAAgB,6BAA6B,IAAI,OAAO,CAGvD"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { getConfig } from "@blazeo.com/calendar-client";
|
|
2
|
-
import { syncBlazeoConnection } from "./syncBlazeoConnection.js";
|
|
3
|
-
let isConfigured = false;
|
|
4
|
-
/**
|
|
5
|
-
* Applies Blazeo connection (same as {@link syncBlazeoConnection}) and marks the client as configured
|
|
6
|
-
* when a non-empty `baseUrl` was written to `@blazeo.com/calendar-client`.
|
|
7
|
-
*/
|
|
8
|
-
export function initializeAppointmentClient(config) {
|
|
9
|
-
if (syncBlazeoConnection(config)) {
|
|
10
|
-
isConfigured = true;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
export function isAppointmentClientConfigured() {
|
|
14
|
-
return isConfigured || getConfig() !== null;
|
|
15
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"initializeAppointmentClient.js","sourceRoot":"","sources":["../../src/config/initializeAppointmentClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AA8B/D,MAAM,UAAU,2BAA2B,CACzC,UAA2C,EAAE;IAE7C,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC;IACnE,MAAM,QAAQ,GAAG,kBAAkB,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC;IAC9E,MAAM,OAAO,GAAG,QAAQ,IAAI,QAAQ,CAAC;IACrC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,8MAA8M,CAC/M,CAAC;IACJ,CAAC;IACD,MAAM,QAAQ,GACZ,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE;QACxB,kBAAkB,CAAC,QAAQ,EAAE,IAAI,EAAE;QACnC,SAAS,CAAC;IACZ,SAAS,CAAC;QACR,OAAO;QACP,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACjC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAClD,GAAG,CAAC,OAAO,CAAC,gBAAgB;YAC1B,CAAC,CAAC,EAAE,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,EAAE;YAChD,CAAC,CAAC,EAAE,CAAC;KACR,CAAC,CAAC;AACL,CAAC;AAED,0FAA0F;AAC1F,MAAM,UAAU,6BAA6B;IAC3C,MAAM,GAAG,GAAG,SAAS,EAAE,CAAC;IACxB,OAAO,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { AppointmentClientConfig } from "./initializeAppointmentClient.js";
|
|
2
|
-
/**
|
|
3
|
-
* Writes `baseUrl` / `consumer` into the global `@blazeo.com/calendar-client` `configure()` store.
|
|
4
|
-
* Returns whether anything was applied (skipped when `baseUrl` is empty after trim).
|
|
5
|
-
*/
|
|
6
|
-
export declare function syncBlazeoConnection(config: AppointmentClientConfig): boolean;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { configure } from "@blazeo.com/calendar-client";
|
|
2
|
-
/**
|
|
3
|
-
* Writes `baseUrl` / `consumer` into the global `@blazeo.com/calendar-client` `configure()` store.
|
|
4
|
-
* Returns whether anything was applied (skipped when `baseUrl` is empty after trim).
|
|
5
|
-
*/
|
|
6
|
-
export function syncBlazeoConnection(config) {
|
|
7
|
-
const baseUrl = config.baseUrl?.trim().replace(/\/+$/, "");
|
|
8
|
-
if (!baseUrl)
|
|
9
|
-
return false;
|
|
10
|
-
configure({
|
|
11
|
-
baseUrl,
|
|
12
|
-
...(config.consumer != null && String(config.consumer).trim() !== ""
|
|
13
|
-
? { consumer: String(config.consumer).trim() }
|
|
14
|
-
: {}),
|
|
15
|
-
...(config.fetch ? { fetch: config.fetch } : {}),
|
|
16
|
-
});
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Creates an appointment event — `Event.create()` → `POST /event/create`
|
|
3
|
-
* (aligned with `AppointmentAPIAdapter.Create`).
|
|
4
|
-
*/
|
|
5
|
-
export declare function createAppointmentEventAsync(input: any, options?: any): Promise<{
|
|
6
|
-
ok: boolean;
|
|
7
|
-
error: string;
|
|
8
|
-
event?: undefined;
|
|
9
|
-
apiResponse?: undefined;
|
|
10
|
-
} | {
|
|
11
|
-
ok: boolean;
|
|
12
|
-
event: any;
|
|
13
|
-
error?: undefined;
|
|
14
|
-
apiResponse?: undefined;
|
|
15
|
-
} | {
|
|
16
|
-
ok: boolean;
|
|
17
|
-
error: any;
|
|
18
|
-
apiResponse: any;
|
|
19
|
-
event?: undefined;
|
|
20
|
-
} | {
|
|
21
|
-
ok: boolean;
|
|
22
|
-
event: any;
|
|
23
|
-
apiResponse: any;
|
|
24
|
-
error?: undefined;
|
|
25
|
-
}>;
|
|
26
|
-
/**
|
|
27
|
-
* Reschedules an appointment — `Event.reschedule()` → `POST /event/reschedule`
|
|
28
|
-
* (aligned with `AppointmentAPIAdapter.Reschedule`).
|
|
29
|
-
*/
|
|
30
|
-
export declare function rescheduleAppointmentEventAsync(input: any, options?: any): Promise<{
|
|
31
|
-
ok: boolean;
|
|
32
|
-
error: string;
|
|
33
|
-
event?: undefined;
|
|
34
|
-
apiResponse?: undefined;
|
|
35
|
-
} | {
|
|
36
|
-
ok: boolean;
|
|
37
|
-
event: any;
|
|
38
|
-
error?: undefined;
|
|
39
|
-
apiResponse?: undefined;
|
|
40
|
-
} | {
|
|
41
|
-
ok: boolean;
|
|
42
|
-
error: any;
|
|
43
|
-
apiResponse: any;
|
|
44
|
-
event?: undefined;
|
|
45
|
-
} | {
|
|
46
|
-
ok: boolean;
|
|
47
|
-
event: any;
|
|
48
|
-
apiResponse: any;
|
|
49
|
-
error?: undefined;
|
|
50
|
-
}>;
|
|
51
|
-
/**
|
|
52
|
-
* Cancels an appointment — `EventModel.cancel` → `GET /event/cancel`
|
|
53
|
-
* (aligned with `AppointmentAPIAdapter.Cancel`).
|
|
54
|
-
*/
|
|
55
|
-
export declare function cancelAppointmentEventAsync(appointmentEventId: string, options?: any): Promise<{
|
|
56
|
-
ok: boolean;
|
|
57
|
-
error: string;
|
|
58
|
-
apiResponse?: undefined;
|
|
59
|
-
} | {
|
|
60
|
-
ok: boolean;
|
|
61
|
-
error: any;
|
|
62
|
-
apiResponse: any;
|
|
63
|
-
} | {
|
|
64
|
-
ok: boolean;
|
|
65
|
-
apiResponse: any;
|
|
66
|
-
error?: undefined;
|
|
67
|
-
}>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"appointmentEventFacade.d.ts","sourceRoot":"","sources":["../../src/events/appointmentEventFacade.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAGL,KAAK,qBAAqB,EAC3B,MAAM,+BAA+B,CAAC;AAMvC,4FAA4F;AAC5F,MAAM,MAAM,uBAAuB,GAAG,qBAAqB,GAAG;IAC5D;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,EAAE,EAAE,IAAI,CAAC;IACT,oFAAoF;IACpF,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,WAAW,CAAC,EAAE,sBAAsB,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,EAAE,EAAE,KAAK,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,sBAAsB,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,uBAAuB,GAAG,uBAAuB,CAAC;AAkGvF;;;GAGG;AACH,wBAAsB,2BAA2B,CAC/C,KAAK,EAAE,oBAAoB,EAC3B,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,sBAAsB,CAAC,CAOjC;AAED;;;GAGG;AACH,wBAAsB,+BAA+B,CACnD,KAAK,EAAE,oBAAoB,EAC3B,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,sBAAsB,CAAC,CAOjC;AAED;;;GAGG;AACH,wBAAsB,2BAA2B,CAC/C,kBAAkB,EAAE,MAAM,EAC1B,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,sBAAsB,CAAC,CA+CjC"}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { EventModel, configure } from "@blazeo.com/calendar-client";
|
|
2
|
-
import { buildModelEnv, resolveBlazeoConnection } from "../calendar/createCalendar.js";
|
|
3
|
-
import { mapAppointmentToEventSnapshot } from "./mapAppointmentToEventSnapshot.js";
|
|
4
|
-
function isFailureStatus(res) {
|
|
5
|
-
return res.status !== "success" && res.status !== "Success";
|
|
6
|
-
}
|
|
7
|
-
function ensureConfigure(resolvedBase, resolvedConsumer) {
|
|
8
|
-
if (resolvedBase) {
|
|
9
|
-
configure({
|
|
10
|
-
baseUrl: resolvedBase,
|
|
11
|
-
...(resolvedConsumer ? { consumer: resolvedConsumer } : {}),
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
async function runEventMutation(input, mode, options) {
|
|
16
|
-
const { baseUrl: resolvedBase, consumer: resolvedConsumer } = resolveBlazeoConnection(options);
|
|
17
|
-
ensureConfigure(resolvedBase, resolvedConsumer);
|
|
18
|
-
const baseUrl = resolvedBase;
|
|
19
|
-
const consumer = resolvedConsumer;
|
|
20
|
-
if (!options.localOnly && !baseUrl) {
|
|
21
|
-
return {
|
|
22
|
-
ok: false,
|
|
23
|
-
error: "baseUrl is missing. Set `blazeoClientConfig.baseUrl` in `appointment-client/src/config/blazeoClientDefaults.ts` or call `configure({ baseUrl })`.",
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
const snapshot = mapAppointmentToEventSnapshot(input, mode);
|
|
27
|
-
const eventIdForApi = snapshot.eventId;
|
|
28
|
-
if (mode === "reschedule" && (!eventIdForApi || eventIdForApi === "new")) {
|
|
29
|
-
return {
|
|
30
|
-
ok: false,
|
|
31
|
-
error: "thirdPartyAppointmentId is required for reschedule (existing Blazeo event id).",
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
const env = buildModelEnv(baseUrl, consumer, Boolean(options.localOnly));
|
|
35
|
-
if (!options.localOnly && env.baseUrl == null) {
|
|
36
|
-
return {
|
|
37
|
-
ok: false,
|
|
38
|
-
error: "Model env requires baseUrl. Set `blazeoClientConfig` or pass `baseUrl` in options.",
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
const eventNode = EventModel.create(snapshot, env);
|
|
42
|
-
if (options.localOnly) {
|
|
43
|
-
return { ok: true, event: eventNode };
|
|
44
|
-
}
|
|
45
|
-
const offset = options.offsetMinutes;
|
|
46
|
-
const apiRes = mode === "create" ? await eventNode.create(offset) : await eventNode.reschedule(offset);
|
|
47
|
-
if (isFailureStatus(apiRes)) {
|
|
48
|
-
const msg = apiRes.message ??
|
|
49
|
-
(typeof apiRes.data === "string" ? apiRes.data : undefined) ??
|
|
50
|
-
JSON.stringify(apiRes);
|
|
51
|
-
return {
|
|
52
|
-
ok: false,
|
|
53
|
-
error: mode === "create" ? msg || "Event create failed" : msg || "Event reschedule failed",
|
|
54
|
-
apiResponse: apiRes,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
return { ok: true, event: eventNode, apiResponse: apiRes };
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Creates an appointment event — `Event.create()` → `POST /event/create`
|
|
61
|
-
* (aligned with `AppointmentAPIAdapter.Create`).
|
|
62
|
-
*/
|
|
63
|
-
export async function createAppointmentEventAsync(input, options = {}) {
|
|
64
|
-
try {
|
|
65
|
-
return await runEventMutation(input, "create", options);
|
|
66
|
-
}
|
|
67
|
-
catch (err) {
|
|
68
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
69
|
-
return { ok: false, error: message };
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Reschedules an appointment — `Event.reschedule()` → `POST /event/reschedule`
|
|
74
|
-
* (aligned with `AppointmentAPIAdapter.Reschedule`).
|
|
75
|
-
*/
|
|
76
|
-
export async function rescheduleAppointmentEventAsync(input, options = {}) {
|
|
77
|
-
try {
|
|
78
|
-
return await runEventMutation(input, "reschedule", options);
|
|
79
|
-
}
|
|
80
|
-
catch (err) {
|
|
81
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
82
|
-
return { ok: false, error: message };
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Cancels an appointment — `EventModel.cancel` → `GET /event/cancel`
|
|
87
|
-
* (aligned with `AppointmentAPIAdapter.Cancel`).
|
|
88
|
-
*/
|
|
89
|
-
export async function cancelAppointmentEventAsync(appointmentEventId, options = {}) {
|
|
90
|
-
try {
|
|
91
|
-
const id = appointmentEventId.trim();
|
|
92
|
-
if (!id) {
|
|
93
|
-
return { ok: false, error: "appointmentEventId is required for cancel." };
|
|
94
|
-
}
|
|
95
|
-
const { baseUrl: resolvedBase, consumer: resolvedConsumer } = resolveBlazeoConnection(options);
|
|
96
|
-
ensureConfigure(resolvedBase, resolvedConsumer);
|
|
97
|
-
const baseUrl = resolvedBase;
|
|
98
|
-
if (!options.localOnly && !baseUrl) {
|
|
99
|
-
return {
|
|
100
|
-
ok: false,
|
|
101
|
-
error: "baseUrl is missing. Set `blazeoClientConfig.baseUrl` in `appointment-client/src/config/blazeoClientDefaults.ts` or call `configure({ baseUrl })`.",
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
if (options.localOnly) {
|
|
105
|
-
return { ok: true, apiResponse: undefined };
|
|
106
|
-
}
|
|
107
|
-
const apiRes = await EventModel.cancel(id);
|
|
108
|
-
if (isFailureStatus(apiRes)) {
|
|
109
|
-
const msg = apiRes.message ??
|
|
110
|
-
(typeof apiRes.data === "string" ? apiRes.data : undefined) ??
|
|
111
|
-
JSON.stringify(apiRes);
|
|
112
|
-
return {
|
|
113
|
-
ok: false,
|
|
114
|
-
error: msg || "Event cancel failed",
|
|
115
|
-
apiResponse: apiRes,
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
return { ok: true, apiResponse: apiRes };
|
|
119
|
-
}
|
|
120
|
-
catch (err) {
|
|
121
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
122
|
-
return { ok: false, error: message };
|
|
123
|
-
}
|
|
124
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"appointmentEventFacade.js","sourceRoot":"","sources":["../../src/events/appointmentEventFacade.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,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AE,KAAK,EAAE,OAAO,EAAE,CAAC;IACvC,CAAC;AACH,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mapAppointmentToEventSnapshot.d.ts","sourceRoot":"","sources":["../../src/events/mapAppointmentToEventSnapshot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAqBpE,MAAM,MAAM,2BAA2B,GAAG,QAAQ,GAAG,YAAY,CAAC;AAElE;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,oBAAoB,EAC3B,IAAI,EAAE,2BAA2B,GAChC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA4CzB"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
function parseDate(value) {
|
|
2
|
-
const d = value instanceof Date ? value : new Date(value);
|
|
3
|
-
if (Number.isNaN(d.getTime())) {
|
|
4
|
-
throw new Error("Invalid startDate or endDate");
|
|
5
|
-
}
|
|
6
|
-
return d;
|
|
7
|
-
}
|
|
8
|
-
function formatYmd(d) {
|
|
9
|
-
const y = d.getFullYear();
|
|
10
|
-
const m = String(d.getMonth() + 1).padStart(2, "0");
|
|
11
|
-
const day = String(d.getDate()).padStart(2, "0");
|
|
12
|
-
return `${y}-${m}-${day}`;
|
|
13
|
-
}
|
|
14
|
-
function normalizeParticipantId(id) {
|
|
15
|
-
return id.trim().replace(/^\{|\}$/g, "");
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Maps Apex appointment input to a Blazeo `Event` MST snapshot for
|
|
19
|
-
* {@link EventModel.create} from `@blazeo.com/calendar-client`.
|
|
20
|
-
*/
|
|
21
|
-
export function mapAppointmentToEventSnapshot(input, mode) {
|
|
22
|
-
const start = parseDate(input.startDate);
|
|
23
|
-
const end = parseDate(input.endDate);
|
|
24
|
-
const description = mode === "create"
|
|
25
|
-
? (input.description ?? null)
|
|
26
|
-
: (input.description ?? input.notes ?? null);
|
|
27
|
-
const eventIdRaw = input.thirdPartyAppointmentId?.trim();
|
|
28
|
-
const eventId = eventIdRaw && eventIdRaw !== "new" ? eventIdRaw : "new";
|
|
29
|
-
const email = input.email ?? input.visitorEmail ?? null;
|
|
30
|
-
const phone = input.phone ?? input.visitorPhone ?? null;
|
|
31
|
-
const visitorName = input.visitorName?.trim() || null;
|
|
32
|
-
const snap = {
|
|
33
|
-
eventId,
|
|
34
|
-
calendarId: input.thirdPartyCalendarId?.trim() ?? "",
|
|
35
|
-
participantId: normalizeParticipantId(input.participantId),
|
|
36
|
-
title: input.title ?? null,
|
|
37
|
-
description,
|
|
38
|
-
startDate: formatYmd(start),
|
|
39
|
-
endDate: formatYmd(end),
|
|
40
|
-
startHour: start.getHours(),
|
|
41
|
-
startMinute: start.getMinutes(),
|
|
42
|
-
endHour: end.getHours(),
|
|
43
|
-
endMinute: end.getMinutes(),
|
|
44
|
-
visitorName,
|
|
45
|
-
visitorEmail: email,
|
|
46
|
-
visitorPhone: phone,
|
|
47
|
-
rescheduleLink: input.rescheduleUrl ?? null,
|
|
48
|
-
cancelLink: input.cancelUrl ?? null,
|
|
49
|
-
timeZone: input.timeZone ?? null,
|
|
50
|
-
};
|
|
51
|
-
if (mode === "create") {
|
|
52
|
-
const now = new Date().toISOString();
|
|
53
|
-
snap.createdOn = now;
|
|
54
|
-
snap.modifiedOn = now;
|
|
55
|
-
}
|
|
56
|
-
return snap;
|
|
57
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mapAppointmentToEventSnapshot.js","sourceRoot":"","sources":["../../src/events/mapAppointmentToEventSnapshot.ts"],"names":[],"mappings":"AAEA,SAAS,SAAS,CAAC,KAAoB;IACrC,MAAM,CAAC,GAAG,KAAK,YAAY,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1D,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC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0 @@
|
|
|
1
|
-
/** Example slot nodes (MST instances). */
|
|
2
|
-
export declare function getExampleSlots(): (import("mobx-state-tree").ModelInstanceTypeProps<{
|
|
3
|
-
id: import("mobx-state-tree").ISimpleType<string>;
|
|
4
|
-
title: import("mobx-state-tree").IMaybeNull<import("mobx-state-tree").ISimpleType<string>>;
|
|
5
|
-
start: import("mobx-state-tree").ISimpleType<string>;
|
|
6
|
-
end: import("mobx-state-tree").ISimpleType<string>;
|
|
7
|
-
isAvailable: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
|
|
8
|
-
}> & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
9
|
-
id: import("mobx-state-tree").ISimpleType<string>;
|
|
10
|
-
title: import("mobx-state-tree").IMaybeNull<import("mobx-state-tree").ISimpleType<string>>;
|
|
11
|
-
start: import("mobx-state-tree").ISimpleType<string>;
|
|
12
|
-
end: import("mobx-state-tree").ISimpleType<string>;
|
|
13
|
-
isAvailable: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
|
|
14
|
-
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>)[];
|
|
15
|
-
/** Example event nodes. */
|
|
16
|
-
export declare function getExampleEvents(): (import("mobx-state-tree").ModelInstanceTypeProps<{
|
|
17
|
-
id: import("mobx-state-tree").ISimpleType<string>;
|
|
18
|
-
title: import("mobx-state-tree").ISimpleType<string>;
|
|
19
|
-
calendarId: import("mobx-state-tree").IMaybeNull<import("mobx-state-tree").ISimpleType<string>>;
|
|
20
|
-
startsAt: import("mobx-state-tree").IMaybeNull<import("mobx-state-tree").ISimpleType<string>>;
|
|
21
|
-
endsAt: import("mobx-state-tree").IMaybeNull<import("mobx-state-tree").ISimpleType<string>>;
|
|
22
|
-
participantIds: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IArrayType<import("mobx-state-tree").ISimpleType<string>>, [undefined]>;
|
|
23
|
-
}> & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
24
|
-
id: import("mobx-state-tree").ISimpleType<string>;
|
|
25
|
-
title: import("mobx-state-tree").ISimpleType<string>;
|
|
26
|
-
calendarId: import("mobx-state-tree").IMaybeNull<import("mobx-state-tree").ISimpleType<string>>;
|
|
27
|
-
startsAt: import("mobx-state-tree").IMaybeNull<import("mobx-state-tree").ISimpleType<string>>;
|
|
28
|
-
endsAt: import("mobx-state-tree").IMaybeNull<import("mobx-state-tree").ISimpleType<string>>;
|
|
29
|
-
participantIds: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IArrayType<import("mobx-state-tree").ISimpleType<string>>, [undefined]>;
|
|
30
|
-
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>)[];
|
|
31
|
-
/** Example participant nodes. */
|
|
32
|
-
export declare function getExampleParticipants(): (import("mobx-state-tree").ModelInstanceTypeProps<{
|
|
33
|
-
id: import("mobx-state-tree").ISimpleType<string>;
|
|
34
|
-
name: import("mobx-state-tree").ISimpleType<string>;
|
|
35
|
-
email: import("mobx-state-tree").IMaybeNull<import("mobx-state-tree").ISimpleType<string>>;
|
|
36
|
-
role: import("mobx-state-tree").IMaybeNull<import("mobx-state-tree").ISimpleType<string>>;
|
|
37
|
-
}> & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
38
|
-
id: import("mobx-state-tree").ISimpleType<string>;
|
|
39
|
-
name: import("mobx-state-tree").ISimpleType<string>;
|
|
40
|
-
email: import("mobx-state-tree").IMaybeNull<import("mobx-state-tree").ISimpleType<string>>;
|
|
41
|
-
role: import("mobx-state-tree").IMaybeNull<import("mobx-state-tree").ISimpleType<string>>;
|
|
42
|
-
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>)[];
|
|
43
|
-
/** Full root store snapshot suitable for `createCalendarRoot(snapshot)`. */
|
|
44
|
-
export declare function getExampleCalendarRootSnapshot(): {
|
|
45
|
-
slots: {
|
|
46
|
-
id: string;
|
|
47
|
-
title: string;
|
|
48
|
-
start: string;
|
|
49
|
-
end: string;
|
|
50
|
-
}[];
|
|
51
|
-
events: {
|
|
52
|
-
id: string;
|
|
53
|
-
title: string;
|
|
54
|
-
calendarId: string;
|
|
55
|
-
startsAt: string;
|
|
56
|
-
endsAt: string;
|
|
57
|
-
participantIds: string[];
|
|
58
|
-
}[];
|
|
59
|
-
participants: {
|
|
60
|
-
id: string;
|
|
61
|
-
name: string;
|
|
62
|
-
email: string;
|
|
63
|
-
role: string;
|
|
64
|
-
}[];
|
|
65
|
-
};
|
|
66
|
-
/** Root store with example slots, events, and participants. */
|
|
67
|
-
export declare function getExampleCalendarRoot(): import("mobx-state-tree").ModelInstanceTypeProps<{
|
|
68
|
-
slots: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IModelType<{
|
|
69
|
-
id: import("mobx-state-tree").ISimpleType<string>;
|
|
70
|
-
title: import("mobx-state-tree").IMaybeNull<import("mobx-state-tree").ISimpleType<string>>;
|
|
71
|
-
start: import("mobx-state-tree").ISimpleType<string>;
|
|
72
|
-
end: import("mobx-state-tree").ISimpleType<string>;
|
|
73
|
-
isAvailable: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
|
|
74
|
-
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
75
|
-
events: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IModelType<{
|
|
76
|
-
id: import("mobx-state-tree").ISimpleType<string>;
|
|
77
|
-
title: import("mobx-state-tree").ISimpleType<string>;
|
|
78
|
-
calendarId: import("mobx-state-tree").IMaybeNull<import("mobx-state-tree").ISimpleType<string>>;
|
|
79
|
-
startsAt: import("mobx-state-tree").IMaybeNull<import("mobx-state-tree").ISimpleType<string>>;
|
|
80
|
-
endsAt: import("mobx-state-tree").IMaybeNull<import("mobx-state-tree").ISimpleType<string>>;
|
|
81
|
-
participantIds: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IArrayType<import("mobx-state-tree").ISimpleType<string>>, [undefined]>;
|
|
82
|
-
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
83
|
-
participants: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IModelType<{
|
|
84
|
-
id: import("mobx-state-tree").ISimpleType<string>;
|
|
85
|
-
name: import("mobx-state-tree").ISimpleType<string>;
|
|
86
|
-
email: import("mobx-state-tree").IMaybeNull<import("mobx-state-tree").ISimpleType<string>>;
|
|
87
|
-
role: import("mobx-state-tree").IMaybeNull<import("mobx-state-tree").ISimpleType<string>>;
|
|
88
|
-
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
89
|
-
}> & {
|
|
90
|
-
removeSlot(id: string): void;
|
|
91
|
-
removeEvent(id: string): void;
|
|
92
|
-
removeParticipant(id: string): void;
|
|
93
|
-
} & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
94
|
-
slots: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IModelType<{
|
|
95
|
-
id: import("mobx-state-tree").ISimpleType<string>;
|
|
96
|
-
title: import("mobx-state-tree").IMaybeNull<import("mobx-state-tree").ISimpleType<string>>;
|
|
97
|
-
start: import("mobx-state-tree").ISimpleType<string>;
|
|
98
|
-
end: import("mobx-state-tree").ISimpleType<string>;
|
|
99
|
-
isAvailable: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
|
|
100
|
-
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
101
|
-
events: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IModelType<{
|
|
102
|
-
id: import("mobx-state-tree").ISimpleType<string>;
|
|
103
|
-
title: import("mobx-state-tree").ISimpleType<string>;
|
|
104
|
-
calendarId: import("mobx-state-tree").IMaybeNull<import("mobx-state-tree").ISimpleType<string>>;
|
|
105
|
-
startsAt: import("mobx-state-tree").IMaybeNull<import("mobx-state-tree").ISimpleType<string>>;
|
|
106
|
-
endsAt: import("mobx-state-tree").IMaybeNull<import("mobx-state-tree").ISimpleType<string>>;
|
|
107
|
-
participantIds: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IArrayType<import("mobx-state-tree").ISimpleType<string>>, [undefined]>;
|
|
108
|
-
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
109
|
-
participants: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IModelType<{
|
|
110
|
-
id: import("mobx-state-tree").ISimpleType<string>;
|
|
111
|
-
name: import("mobx-state-tree").ISimpleType<string>;
|
|
112
|
-
email: import("mobx-state-tree").IMaybeNull<import("mobx-state-tree").ISimpleType<string>>;
|
|
113
|
-
role: import("mobx-state-tree").IMaybeNull<import("mobx-state-tree").ISimpleType<string>>;
|
|
114
|
-
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
115
|
-
}, {
|
|
116
|
-
removeSlot(id: string): void;
|
|
117
|
-
removeEvent(id: string): void;
|
|
118
|
-
removeParticipant(id: string): void;
|
|
119
|
-
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exampleData.d.ts","sourceRoot":"","sources":["../src/exampleData.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,+BAA+B,CAAC;AACrF,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC5B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAc,KAAK,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAEL,KAAK,WAAW,EACjB,MAAM,8BAA8B,CAAC;AAgDtC,0CAA0C;AAC1C,wBAAgB,eAAe,IAAI,YAAY,EAAE,CAEhD;AAED,2BAA2B;AAC3B,wBAAgB,gBAAgB,IAAI,KAAK,EAAE,CAE1C;AAED,iCAAiC;AACjC,wBAAgB,sBAAsB,IAAI,WAAW,EAAE,CAEtD;AAED,4EAA4E;AAC5E,wBAAgB,8BAA8B,IAAI,sBAAsB,CAMvE;AAED,+DAA+D;AAC/D,wBAAgB,sBAAsB,IAAI,YAAY,CAErD"}
|
package/dist/exampleData.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { CalendarSlotModel } from "./models/CalendarRootModel.js";
|
|
2
|
-
import { CalendarRootModel } from "./models/CalendarRootModel.js";
|
|
3
|
-
import { EventModel } from "./models/CalendarRootModel.js";
|
|
4
|
-
import { ParticipantModel } from "./models/CalendarRootModel.js";
|
|
5
|
-
const EXAMPLE_SLOT_SNAPSHOTS = [
|
|
6
|
-
{
|
|
7
|
-
id: "slot-1",
|
|
8
|
-
title: "Team standup",
|
|
9
|
-
start: "09:00",
|
|
10
|
-
end: "09:15",
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
id: "slot-2",
|
|
14
|
-
title: "Focus block",
|
|
15
|
-
start: "10:00",
|
|
16
|
-
end: "12:00",
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
id: "slot-3",
|
|
20
|
-
title: "1:1 with design",
|
|
21
|
-
start: "14:00",
|
|
22
|
-
end: "14:30",
|
|
23
|
-
},
|
|
24
|
-
];
|
|
25
|
-
const EXAMPLE_EVENT_SNAPSHOTS = [
|
|
26
|
-
{
|
|
27
|
-
id: "ev-1",
|
|
28
|
-
title: "Product roadmap review",
|
|
29
|
-
calendarId: "cal-eng",
|
|
30
|
-
startsAt: "2026-04-02T15:00:00.000Z",
|
|
31
|
-
endsAt: "2026-04-02T16:00:00.000Z",
|
|
32
|
-
participantIds: ["p-1", "p-2"],
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
id: "ev-2",
|
|
36
|
-
title: "Customer onboarding call",
|
|
37
|
-
calendarId: "cal-sales",
|
|
38
|
-
startsAt: "2026-04-03T10:30:00.000Z",
|
|
39
|
-
endsAt: "2026-04-03T11:00:00.000Z",
|
|
40
|
-
participantIds: ["p-3"],
|
|
41
|
-
},
|
|
42
|
-
];
|
|
43
|
-
const EXAMPLE_PARTICIPANT_SNAPSHOTS = [
|
|
44
|
-
{ id: "p-1", name: "Alex Morgan", email: "alex@example.com", role: "Organizer" },
|
|
45
|
-
{ id: "p-2", name: "Jordan Lee", email: "jordan@example.com", role: "Required" },
|
|
46
|
-
{ id: "p-3", name: "Sam Rivera", email: "sam@example.com", role: "Optional" },
|
|
47
|
-
];
|
|
48
|
-
/** Example slot nodes (MST instances). */
|
|
49
|
-
export function getExampleSlots() {
|
|
50
|
-
return EXAMPLE_SLOT_SNAPSHOTS.map((s) => CalendarSlotModel.create(s));
|
|
51
|
-
}
|
|
52
|
-
/** Example event nodes. */
|
|
53
|
-
export function getExampleEvents() {
|
|
54
|
-
return EXAMPLE_EVENT_SNAPSHOTS.map((s) => EventModel.create(s));
|
|
55
|
-
}
|
|
56
|
-
/** Example participant nodes. */
|
|
57
|
-
export function getExampleParticipants() {
|
|
58
|
-
return EXAMPLE_PARTICIPANT_SNAPSHOTS.map((s) => ParticipantModel.create(s));
|
|
59
|
-
}
|
|
60
|
-
/** Full root store snapshot suitable for `createCalendarRoot(snapshot)`. */
|
|
61
|
-
export function getExampleCalendarRootSnapshot() {
|
|
62
|
-
return {
|
|
63
|
-
slots: EXAMPLE_SLOT_SNAPSHOTS,
|
|
64
|
-
events: EXAMPLE_EVENT_SNAPSHOTS,
|
|
65
|
-
participants: EXAMPLE_PARTICIPANT_SNAPSHOTS,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
/** Root store with example slots, events, and participants. */
|
|
69
|
-
export function getExampleCalendarRoot() {
|
|
70
|
-
return CalendarRootModel.create(getExampleCalendarRootSnapshot());
|
|
71
|
-
}
|