@blazeo.com/appointment-client 1.0.5 → 1.0.6

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.
Files changed (103) hide show
  1. package/blazeo.com-appointment-client-1.0.6.tgz +0 -0
  2. package/dist/calendar/blazeoCalendarRelationMethods.d.ts +4 -36
  3. package/dist/calendar/blazeoCalendarRelationMethods.js +0 -1
  4. package/dist/calendar/buildUnifiedCalendarView.d.ts +31 -0
  5. package/dist/calendar/buildUnifiedCalendarView.js +265 -0
  6. package/dist/calendar/calendarCreation.d.ts +27 -0
  7. package/dist/calendar/calendarCreation.js +167 -0
  8. package/dist/calendar/calendarCreationFacade.d.ts +4 -13
  9. package/dist/calendar/calendarCreationFacade.js +3 -5
  10. package/dist/calendar/createCalendar.d.ts +67 -37
  11. package/dist/calendar/createCalendar.js +1 -3
  12. package/dist/calendar/fetchCalendarDetails.d.ts +73 -18
  13. package/dist/calendar/fetchCalendarDetails.js +192 -51
  14. package/dist/calendar/fetchCalendarWithOpeningHours.d.ts +34 -21
  15. package/dist/calendar/fetchCalendarWithOpeningHours.js +95 -75
  16. package/dist/calendar/getAllParticipantOpeningHours.d.ts +19 -0
  17. package/dist/calendar/getAllParticipantOpeningHours.js +17 -0
  18. package/dist/calendar/getOpeningHours.d.ts +5 -0
  19. package/dist/calendar/getOpeningHours.js +9 -0
  20. package/dist/calendar/getParticipantOpeningHours.d.ts +37 -0
  21. package/dist/calendar/getParticipantOpeningHours.js +43 -0
  22. package/dist/calendar/getParticipants.d.ts +4 -0
  23. package/dist/calendar/getParticipants.js +8 -0
  24. package/dist/calendar/mapCalendarBoToBlazeoSnapshot.d.ts +9 -9
  25. package/dist/calendar/mapCalendarBoToBlazeoSnapshot.js +43 -43
  26. package/dist/calendar/mapCalendarToBlazeoSnapshot.d.ts +22 -3
  27. package/dist/calendar/mapCalendarToBlazeoSnapshot.js +0 -1
  28. package/dist/config/applyBlazeoClientConfig.d.ts +2 -2
  29. package/dist/config/applyBlazeoClientConfig.js +13 -13
  30. package/dist/config/applyBlazeoDefaults.d.ts +0 -1
  31. package/dist/config/applyBlazeoDefaults.js +0 -1
  32. package/dist/config/blazeo.config.d.ts +10 -10
  33. package/dist/config/blazeo.config.js +10 -10
  34. package/dist/config/blazeoClientDefaults.d.ts +1 -2
  35. package/dist/config/blazeoClientDefaults.js +0 -1
  36. package/dist/config/initializeAppointmentClient.d.ts +4 -28
  37. package/dist/config/initializeAppointmentClient.js +5 -24
  38. package/dist/events/appointmentEventFacade.d.ts +55 -32
  39. package/dist/events/appointmentEventFacade.js +5 -10
  40. package/dist/events/mapAppointmentToEventSnapshot.d.ts +1 -4
  41. package/dist/events/mapAppointmentToEventSnapshot.js +0 -1
  42. package/dist/exampleData.d.ts +114 -10
  43. package/dist/exampleData.js +4 -5
  44. package/dist/facade/calendarCreationFacade.d.ts +39 -39
  45. package/dist/facade/calendarCreationFacade.js +95 -95
  46. package/dist/facade/mapCalendarBOToSnapshot.d.ts +9 -9
  47. package/dist/facade/mapCalendarBOToSnapshot.js +43 -43
  48. package/dist/facades/index.d.ts +11 -11
  49. package/dist/facades/index.js +11 -11
  50. package/dist/index.d.ts +23 -82
  51. package/dist/index.js +21 -33
  52. package/dist/models/CalendarRootModel.d.ts +36 -11
  53. package/dist/models/CalendarRootModel.js +22 -5
  54. package/dist/models/CalendarSlotModel.d.ts +8 -8
  55. package/dist/models/CalendarSlotModel.js +7 -7
  56. package/dist/models/EventModel.d.ts +10 -10
  57. package/dist/models/EventModel.js +9 -9
  58. package/dist/models/ParticipantModel.d.ts +8 -8
  59. package/dist/models/ParticipantModel.js +7 -7
  60. package/dist/models/index.d.ts +4 -4
  61. package/dist/models/index.js +4 -4
  62. package/dist/types/appointment.d.ts +27 -27
  63. package/dist/types/appointment.js +5 -5
  64. package/dist/types/calendar.d.ts +51 -51
  65. package/dist/types/calendar.js +5 -5
  66. package/dist/types/calendarBo.d.ts +61 -61
  67. package/dist/types/calendarBo.js +5 -5
  68. package/package.json +8 -2
  69. package/sample/build_error.txt +0 -0
  70. package/sample/demo.js +70 -0
  71. package/sample/package-lock.json +5 -2
  72. package/sample/package.json +3 -1
  73. package/sample/scripts/getInfoByCalendar.mjs +36 -0
  74. package/sample/scripts/getParticipantOpeningHours.mjs +48 -0
  75. package/sample/src/AllParticipantOpeningHoursTab.jsx +73 -0
  76. package/sample/src/App2.jsx +39 -2
  77. package/sample/src/BlazeoConnectionSettings.jsx +1 -1
  78. package/sample/src/FetchCalendarTab.jsx +70 -20
  79. package/sample/src/OpeningHoursTab.jsx +78 -0
  80. package/sample/src/ParticipantInfoTab.jsx +72 -0
  81. package/sample/src/ParticipantOpeningHoursTab.jsx +88 -0
  82. package/sample/src/ParticipantTab.jsx +2 -2
  83. package/src/calendar/blazeoCalendarRelationMethods.ts +19 -0
  84. package/src/calendar/buildUnifiedCalendarView.ts +322 -0
  85. package/src/calendar/calendarCreation.ts +179 -0
  86. package/src/calendar/createCalendar.ts +243 -0
  87. package/src/calendar/fetchCalendarDetails.ts +226 -0
  88. package/src/calendar/fetchCalendarWithOpeningHours.ts +99 -0
  89. package/src/calendar/getAllParticipantOpeningHours.ts +22 -0
  90. package/src/calendar/getOpeningHours.ts +10 -0
  91. package/src/calendar/getParticipantOpeningHours.ts +46 -0
  92. package/src/calendar/getParticipants.ts +9 -0
  93. package/src/calendar/mapCalendarToBlazeoSnapshot.ts +46 -0
  94. package/src/config/applyBlazeoDefaults.ts +13 -0
  95. package/src/config/blazeoClientDefaults.ts +11 -0
  96. package/src/config/initializeAppointmentClient.ts +18 -0
  97. package/src/events/appointmentEventFacade.ts +148 -0
  98. package/src/events/mapAppointmentToEventSnapshot.ts +65 -0
  99. package/src/exampleData.ts +79 -0
  100. package/src/index.ts +45 -0
  101. package/src/models/CalendarRootModel.ts +60 -0
  102. package/tsconfig.json +16 -0
  103. package/blazeo.com-appointment-client-1.0.5.tgz +0 -0
@@ -1,28 +1,28 @@
1
- /**
2
- * ApexFlows `AppointmentBO`-aligned input for Blazeo event APIs
3
- * (same intent as `AppointmentAPIAdapter` Create / Reschedule / Cancel).
4
- */
5
- export type ApexAppointmentInput = {
6
- /** Blazeo `calendarId` — `ThirdPartyCalendarId` in Apex. */
7
- thirdPartyCalendarId: string;
8
- /** Participant GUID string (with or without braces). */
9
- participantId: string;
10
- title?: string;
11
- /** Create: `AppointmentBO.Description`. */
12
- description?: string;
13
- /** Reschedule / update: Apex often uses `Notes` for body (see adapter). */
14
- notes?: string;
15
- startDate: string | Date;
16
- endDate: string | Date;
17
- visitorEmail?: string;
18
- visitorPhone?: string;
19
- visitorName?: string;
20
- email?: string;
21
- phone?: string;
22
- rescheduleUrl?: string;
23
- cancelUrl?: string;
24
- timeZone?: string;
25
- /** Existing Blazeo event id — required for reschedule; omit or `"new"` for create. */
26
- thirdPartyAppointmentId?: string;
27
- };
1
+ /**
2
+ * ApexFlows `AppointmentBO`-aligned input for Blazeo event APIs
3
+ * (same intent as `AppointmentAPIAdapter` Create / Reschedule / Cancel).
4
+ */
5
+ export type ApexAppointmentInput = {
6
+ /** Blazeo `calendarId` — `ThirdPartyCalendarId` in Apex. */
7
+ thirdPartyCalendarId: string;
8
+ /** Participant GUID string (with or without braces). */
9
+ participantId: string;
10
+ title?: string;
11
+ /** Create: `AppointmentBO.Description`. */
12
+ description?: string;
13
+ /** Reschedule / update: Apex often uses `Notes` for body (see adapter). */
14
+ notes?: string;
15
+ startDate: string | Date;
16
+ endDate: string | Date;
17
+ visitorEmail?: string;
18
+ visitorPhone?: string;
19
+ visitorName?: string;
20
+ email?: string;
21
+ phone?: string;
22
+ rescheduleUrl?: string;
23
+ cancelUrl?: string;
24
+ timeZone?: string;
25
+ /** Existing Blazeo event id — required for reschedule; omit or `"new"` for create. */
26
+ thirdPartyAppointmentId?: string;
27
+ };
28
28
  //# sourceMappingURL=appointment.d.ts.map
@@ -1,6 +1,6 @@
1
- /**
2
- * ApexFlows `AppointmentBO`-aligned input for Blazeo event APIs
3
- * (same intent as `AppointmentAPIAdapter` Create / Reschedule / Cancel).
4
- */
5
- export {};
1
+ /**
2
+ * ApexFlows `AppointmentBO`-aligned input for Blazeo event APIs
3
+ * (same intent as `AppointmentAPIAdapter` Create / Reschedule / Cancel).
4
+ */
5
+ export {};
6
6
  //# sourceMappingURL=appointment.js.map
@@ -1,52 +1,52 @@
1
- /**
2
- * Plain shapes aligned with CalendarBO / MemberBO / OpeningHourBO for mapping
3
- * into `@blazeo.com/calendar-client` `CalendarModel.create` (see `mapCalendarBoToBlazeoSnapshot.ts`).
4
- */
5
- export type CalendarInput = {
6
- /** Blazeo / API calendar identifier; falls back to `thirdPartyCalendarId` or `"new"`. */
7
- calendarId?: string;
8
- companyKey?: string | null;
9
- name?: string | null;
10
- timeZoneId?: string | null;
11
- description?: string | null;
12
- /** Apex `AssignmentType` — mapped to Blazeo `assignmentMethod`. */
13
- assignmentType?: number;
14
- assignmentMethod?: number;
15
- duration?: number;
16
- bookingLimit?: number | null;
17
- durationUnit?: number;
18
- minimumBookingNotice?: number;
19
- minimumBookingNoticeUnit?: number;
20
- minimumCancelationNotice?: number;
21
- minimumCancelationNoticeUnit?: number;
22
- futureLimit?: number;
23
- futureLimitUnit?: number;
24
- bufferTime?: number | null;
25
- bufferTimeUnit?: number;
26
- /**
27
- * Apex: used to populate Blazeo `purpose` (fallback).
28
- * If omitted, we fallback to `bookingPageTitle` or "".
29
- */
30
- purpose?: string;
31
- bookingPageTitle?: string | null;
32
- createdOn?: string | null;
33
- modifiedOn?: string | null;
34
- /** Not part of Blazeo Calendar MST — reserved for future participant/hours steps. */
35
- members?: MemberBOInput[];
36
- openingHours?: OpeningHourBOInput[];
37
- };
38
- export type MemberBOInput = {
39
- id: string | null;
40
- };
41
- export type OpeningHourBOInput = {
42
- id: number;
43
- openingHourId?: string;
44
- participantId?: string;
45
- days: number[];
46
- startHour: number;
47
- startMinute: number;
48
- endHour: number;
49
- endMinute: number;
50
- off: boolean;
51
- };
1
+ /**
2
+ * Plain shapes aligned with CalendarBO / MemberBO / OpeningHourBO for mapping
3
+ * into `@blazeo.com/calendar-client` `CalendarModel.create` (see `mapCalendarBoToBlazeoSnapshot.ts`).
4
+ */
5
+ export type CalendarInput = {
6
+ /** Blazeo / API calendar identifier; falls back to `thirdPartyCalendarId` or `"new"`. */
7
+ calendarId?: string;
8
+ companyKey?: string | null;
9
+ name?: string | null;
10
+ timeZoneId?: string | null;
11
+ description?: string | null;
12
+ /** Apex `AssignmentType` — mapped to Blazeo `assignmentMethod`. */
13
+ assignmentType?: number;
14
+ assignmentMethod?: number;
15
+ duration?: number;
16
+ bookingLimit?: number | null;
17
+ durationUnit?: number;
18
+ minimumBookingNotice?: number;
19
+ minimumBookingNoticeUnit?: number;
20
+ minimumCancelationNotice?: number;
21
+ minimumCancelationNoticeUnit?: number;
22
+ futureLimit?: number;
23
+ futureLimitUnit?: number;
24
+ bufferTime?: number | null;
25
+ bufferTimeUnit?: number;
26
+ /**
27
+ * Apex: used to populate Blazeo `purpose` (fallback).
28
+ * If omitted, we fallback to `bookingPageTitle` or "".
29
+ */
30
+ purpose?: string;
31
+ bookingPageTitle?: string | null;
32
+ createdOn?: string | null;
33
+ modifiedOn?: string | null;
34
+ /** Not part of Blazeo Calendar MST — reserved for future participant/hours steps. */
35
+ members?: MemberBOInput[];
36
+ openingHours?: OpeningHourBOInput[];
37
+ };
38
+ export type MemberBOInput = {
39
+ id: string | null;
40
+ };
41
+ export type OpeningHourBOInput = {
42
+ id: number;
43
+ openingHourId?: string;
44
+ participantId?: string;
45
+ days: number[];
46
+ startHour: number;
47
+ startMinute: number;
48
+ endHour: number;
49
+ endMinute: number;
50
+ off: boolean;
51
+ };
52
52
  //# sourceMappingURL=calendar.d.ts.map
@@ -1,6 +1,6 @@
1
- /**
2
- * Plain shapes aligned with CalendarBO / MemberBO / OpeningHourBO for mapping
3
- * into `@blazeo.com/calendar-client` `CalendarModel.create` (see `mapCalendarBoToBlazeoSnapshot.ts`).
4
- */
5
- export {};
1
+ /**
2
+ * Plain shapes aligned with CalendarBO / MemberBO / OpeningHourBO for mapping
3
+ * into `@blazeo.com/calendar-client` `CalendarModel.create` (see `mapCalendarBoToBlazeoSnapshot.ts`).
4
+ */
5
+ export {};
6
6
  //# sourceMappingURL=calendar.js.map
@@ -1,62 +1,62 @@
1
- /**
2
- * Plain shapes aligned with CalendarBO / MemberBO / OpeningHourBO for mapping
3
- * into `@blazeo.com/calendar-client` `CalendarModel.create` (see `mapCalendarBoToBlazeoSnapshot.ts`).
4
- */
5
- export type CalendarBOInput = {
6
- /** Blazeo / API calendar identifier; falls back to `thirdPartyCalendarId` or `"new"`. */
7
- calendarId?: string;
8
- thirdPartyCalendarId?: string;
9
- /** Apex / DB numeric id when known */
10
- serverId?: number;
11
- companyKey?: string | null;
12
- purpose?: string;
13
- name?: string | null;
14
- timeZoneId?: string | null;
15
- description?: string | null;
16
- /** Apex `AssignmentType` — mapped to Blazeo `assignmentMethod`. */
17
- assignmentType?: number;
18
- assignmentMethod?: number;
19
- duration?: number;
20
- bookingLimit?: number | null;
21
- calendarJson?: string | null;
22
- isThirdPartySaved?: boolean;
23
- durationUnit?: number;
24
- minimumBookingNotice?: number;
25
- minimumBookingNoticeUnit?: number;
26
- minimumCancelationNotice?: number;
27
- minimumCancelationNoticeUnit?: number;
28
- futureLimit?: number;
29
- futureLimitUnit?: number;
30
- bufferTime?: number | null;
31
- bufferTimeUnit?: number;
32
- calendarLink?: string | null;
33
- status?: number;
34
- location?: string | null;
35
- bookingPageTitle?: string | null;
36
- themeId?: number | null;
37
- createdOn?: string | null;
38
- modifiedOn?: string | null;
39
- /** Not part of Blazeo Calendar MST — reserved for future participant/hours steps. */
40
- members?: MemberBOInput[];
41
- openingHours?: OpeningHourBOInput[];
42
- };
43
- export type MemberBOInput = {
44
- id: number;
45
- name?: string | null;
46
- email?: string;
47
- thirdPartyMemberId?: string | null;
48
- };
49
- export type OpeningHourBOInput = {
50
- id: number;
51
- openingHourId?: string;
52
- calendarId?: string;
53
- participantId?: string;
54
- days: number[];
55
- startHour: number;
56
- startMinute: number;
57
- endHour: number;
58
- endMinute: number;
59
- off: boolean;
60
- member: number;
61
- };
1
+ /**
2
+ * Plain shapes aligned with CalendarBO / MemberBO / OpeningHourBO for mapping
3
+ * into `@blazeo.com/calendar-client` `CalendarModel.create` (see `mapCalendarBoToBlazeoSnapshot.ts`).
4
+ */
5
+ export type CalendarBOInput = {
6
+ /** Blazeo / API calendar identifier; falls back to `thirdPartyCalendarId` or `"new"`. */
7
+ calendarId?: string;
8
+ thirdPartyCalendarId?: string;
9
+ /** Apex / DB numeric id when known */
10
+ serverId?: number;
11
+ companyKey?: string | null;
12
+ purpose?: string;
13
+ name?: string | null;
14
+ timeZoneId?: string | null;
15
+ description?: string | null;
16
+ /** Apex `AssignmentType` — mapped to Blazeo `assignmentMethod`. */
17
+ assignmentType?: number;
18
+ assignmentMethod?: number;
19
+ duration?: number;
20
+ bookingLimit?: number | null;
21
+ calendarJson?: string | null;
22
+ isThirdPartySaved?: boolean;
23
+ durationUnit?: number;
24
+ minimumBookingNotice?: number;
25
+ minimumBookingNoticeUnit?: number;
26
+ minimumCancelationNotice?: number;
27
+ minimumCancelationNoticeUnit?: number;
28
+ futureLimit?: number;
29
+ futureLimitUnit?: number;
30
+ bufferTime?: number | null;
31
+ bufferTimeUnit?: number;
32
+ calendarLink?: string | null;
33
+ status?: number;
34
+ location?: string | null;
35
+ bookingPageTitle?: string | null;
36
+ themeId?: number | null;
37
+ createdOn?: string | null;
38
+ modifiedOn?: string | null;
39
+ /** Not part of Blazeo Calendar MST — reserved for future participant/hours steps. */
40
+ members?: MemberBOInput[];
41
+ openingHours?: OpeningHourBOInput[];
42
+ };
43
+ export type MemberBOInput = {
44
+ id: number;
45
+ name?: string | null;
46
+ email?: string;
47
+ thirdPartyMemberId?: string | null;
48
+ };
49
+ export type OpeningHourBOInput = {
50
+ id: number;
51
+ openingHourId?: string;
52
+ calendarId?: string;
53
+ participantId?: string;
54
+ days: number[];
55
+ startHour: number;
56
+ startMinute: number;
57
+ endHour: number;
58
+ endMinute: number;
59
+ off: boolean;
60
+ member: number;
61
+ };
62
62
  //# sourceMappingURL=calendarBo.d.ts.map
@@ -1,6 +1,6 @@
1
- /**
2
- * Plain shapes aligned with CalendarBO / MemberBO / OpeningHourBO for mapping
3
- * into `@blazeo.com/calendar-client` `CalendarModel.create` (see `mapCalendarBoToBlazeoSnapshot.ts`).
4
- */
5
- export {};
1
+ /**
2
+ * Plain shapes aligned with CalendarBO / MemberBO / OpeningHourBO for mapping
3
+ * into `@blazeo.com/calendar-client` `CalendarModel.create` (see `mapCalendarBoToBlazeoSnapshot.ts`).
4
+ */
5
+ export {};
6
6
  //# sourceMappingURL=calendarBo.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blazeo.com/appointment-client",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -14,9 +14,15 @@
14
14
  "types": "./dist/index.d.ts"
15
15
  }
16
16
  },
17
+ "scripts": {
18
+ "build": "tsc"
19
+ },
17
20
  "dependencies": {
18
- "@blazeo.com/calendar-client": "^1.0.17",
21
+ "@blazeo.com/calendar-client": "^1.0.18",
19
22
  "mobx": "^6.13.7",
20
23
  "mobx-state-tree": "^7.0.2"
24
+ },
25
+ "devDependencies": {
26
+ "typescript": "^5.0.0"
21
27
  }
22
28
  }
Binary file
package/sample/demo.js ADDED
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Demo usage of appointment-client
3
+ * Run with: node demo.js
4
+ */
5
+ import {
6
+ initializeAppointmentClient,
7
+ fetchCalendarDetails
8
+ } from "../dist/index.js"; // In a real app, use 'appointment-client'
9
+
10
+ async function runDemo() {
11
+ const TEST_CALENDAR_ID = "66f42c26-f48e-4965-b772-88155986898d"; // Example ID
12
+ const BASE_URL = "https://api.blazeo.com"; // Example API URL
13
+
14
+ console.log("--- Appointment Client Demo ---");
15
+
16
+ // 1. Initialize the client
17
+ console.log(`Initializing client with BASE_URL: ${BASE_URL}`);
18
+ initializeAppointmentClient({
19
+ baseUrl: BASE_URL,
20
+ consumer: "demo-app"
21
+ });
22
+
23
+ try {
24
+ // 2. Pass calendarId and fetch details
25
+ console.log(`Fetching details for calendarId: ${TEST_CALENDAR_ID}...`);
26
+ const details = await fetchCalendarDetails(TEST_CALENDAR_ID);
27
+
28
+ if (!details.meta.ok) {
29
+ console.error("Failed to fetch calendar details:", details.meta.reason);
30
+ return;
31
+ }
32
+
33
+ if (details.calendarView) {
34
+ console.log("\n--- calendarView (preview) ---");
35
+ console.log(
36
+ JSON.stringify({
37
+ members: details.calendarView.members?.length ?? 0,
38
+ openingHours: details.calendarView.openingHours?.length ?? 0,
39
+ })
40
+ );
41
+ }
42
+
43
+ // 3. Retrieve and print Opening hours
44
+ console.log("\n--- Opening Hours ---");
45
+ if (details.openingHours.length > 0) {
46
+ details.openingHours.forEach((oh, idx) => {
47
+ console.log(`[${idx + 1}] Day: ${oh.day}, Start: ${oh.startHour}:${oh.startMinute}, End: ${oh.endHour}:${oh.endMinute}`);
48
+ });
49
+ } else {
50
+ console.log("No opening hours found.");
51
+ }
52
+
53
+ // 4. Retrieve and print Participants
54
+ console.log("\n--- Participants ---");
55
+ if (details.participants.length > 0) {
56
+ details.participants.forEach((p, idx) => {
57
+ console.log(`[${idx + 1}] Name: ${p.name}, Email: ${p.email || 'N/A'}`);
58
+ });
59
+ } else {
60
+ console.log("No participants found.");
61
+ }
62
+
63
+ console.log("\nDemo completed successfully.");
64
+
65
+ } catch (error) {
66
+ console.error("An error occurred during the demo:", error.message);
67
+ }
68
+ }
69
+
70
+ runDemo();
@@ -17,11 +17,14 @@
17
17
  },
18
18
  "..": {
19
19
  "name": "@blazeo.com/appointment-client",
20
- "version": "1.0.4",
20
+ "version": "1.0.5",
21
21
  "dependencies": {
22
- "@blazeo.com/calendar-client": "^1.0.17",
22
+ "@blazeo.com/calendar-client": "^1.0.18",
23
23
  "mobx": "^6.13.7",
24
24
  "mobx-state-tree": "^7.0.2"
25
+ },
26
+ "devDependencies": {
27
+ "typescript": "^5.0.0"
25
28
  }
26
29
  },
27
30
  "../node_modules/@blazeo.com/calendar-client": {
@@ -5,7 +5,9 @@
5
5
  "scripts": {
6
6
  "dev": "vite",
7
7
  "build": "vite build",
8
- "preview": "vite preview"
8
+ "preview": "vite preview",
9
+ "openinghours:participant": "node ./scripts/getParticipantOpeningHours.mjs",
10
+ "participants:info": "node ./scripts/getInfoByCalendar.mjs"
9
11
  },
10
12
  "dependencies": {
11
13
  "appointment-client": "file:..",
@@ -0,0 +1,36 @@
1
+ import { initializeAppointmentClient, CalendarParticipantModel } from "appointment-client";
2
+
3
+ function reqEnv(name, fallback = "") {
4
+ const v = (process.env[name] ?? fallback).trim();
5
+ return v;
6
+ }
7
+
8
+ const baseUrl = reqEnv("BLAZEO_BASE_URL");
9
+ const consumer = reqEnv("BLAZEO_CONSUMER");
10
+ const calendarId = reqEnv("CALENDAR_ID");
11
+
12
+ if (!baseUrl) {
13
+ console.error("Missing env BLAZEO_BASE_URL");
14
+ process.exit(1);
15
+ }
16
+ if (!calendarId) {
17
+ console.error("Missing env CALENDAR_ID");
18
+ process.exit(1);
19
+ }
20
+
21
+ initializeAppointmentClient({ baseUrl, ...(consumer ? { consumer } : {}) });
22
+
23
+ const info = await CalendarParticipantModel.getInfoByCalendar(calendarId);
24
+
25
+ console.log(
26
+ JSON.stringify(
27
+ {
28
+ calendarId,
29
+ count: Array.isArray(info) ? info.length : 0,
30
+ info,
31
+ },
32
+ null,
33
+ 2
34
+ )
35
+ );
36
+
@@ -0,0 +1,48 @@
1
+ import {
2
+ initializeAppointmentClient,
3
+ CalendarModel,
4
+ normalizeParticipantOpeningHoursResponse,
5
+ } from "appointment-client";
6
+
7
+ function reqEnv(name, fallback = "") {
8
+ const v = (process.env[name] ?? fallback).trim();
9
+ return v;
10
+ }
11
+
12
+ const baseUrl = reqEnv("BLAZEO_BASE_URL");
13
+ const consumer = reqEnv("BLAZEO_CONSUMER");
14
+ const calendarId = reqEnv("CALENDAR_ID");
15
+
16
+ if (!baseUrl) {
17
+ console.error("Missing env BLAZEO_BASE_URL");
18
+ process.exit(1);
19
+ }
20
+ if (!calendarId) {
21
+ console.error("Missing env CALENDAR_ID");
22
+ process.exit(1);
23
+ }
24
+
25
+ initializeAppointmentClient({ baseUrl, ...(consumer ? { consumer } : {}) });
26
+
27
+ const cal = await CalendarModel.get(calendarId);
28
+ if (!cal) {
29
+ console.error("Calendar not found:", calendarId);
30
+ process.exit(2);
31
+ }
32
+
33
+ const raw = await cal.getParticipantOpeningHours({});
34
+ const { list } = normalizeParticipantOpeningHoursResponse(raw);
35
+
36
+ console.log(
37
+ JSON.stringify(
38
+ {
39
+ calendarId,
40
+ count: Array.isArray(list) ? list.length : 0,
41
+ openingHours: Array.isArray(list) ? list : null,
42
+ raw,
43
+ },
44
+ null,
45
+ 2
46
+ )
47
+ );
48
+
@@ -0,0 +1,73 @@
1
+ import { useState } from "react";
2
+ import { getAllParticipantOpeningHours } from "appointment-client";
3
+ import { configureBlazeoFromEffective, useBlazeoConnection } from "./BlazeoConnectionSettings.jsx";
4
+
5
+ export function AllParticipantOpeningHoursTab() {
6
+ const { effective } = useBlazeoConnection();
7
+ const [calendarId, setCalendarId] = useState("");
8
+ const [busy, setBusy] = useState(false);
9
+ const [error, setError] = useState("");
10
+ const [output, setOutput] = useState("");
11
+
12
+ async function handleFetch(e) {
13
+ e.preventDefault();
14
+ setError("");
15
+ setOutput("");
16
+ const id = calendarId.trim();
17
+ if (!id) return setError("Enter a calendar id.");
18
+ if (!effective.baseUrl) return setError("Set Base URL in the connection card above.");
19
+
20
+ configureBlazeoFromEffective(effective);
21
+ setBusy(true);
22
+ try {
23
+ const res = await getAllParticipantOpeningHours(id);
24
+ setOutput(JSON.stringify(res, null, 2));
25
+ } catch (err) {
26
+ setError(err instanceof Error ? err.message : String(err));
27
+ } finally {
28
+ setBusy(false);
29
+ }
30
+ }
31
+
32
+ return (
33
+ <>
34
+ <div className="card">
35
+ <h2>All Participant Opening Hours</h2>
36
+ <p className="muted small">
37
+ Calls <code>getAllParticipantOpeningHours(calendarId)</code> (API:{" "}
38
+ <code>GET /Calendar/Participant/OpeningHours/All/Get</code>).
39
+ </p>
40
+ <form onSubmit={handleFetch} className="form">
41
+ <label className="form__label">
42
+ <span>Calendar id</span>
43
+ <input
44
+ type="text"
45
+ className="form__input"
46
+ value={calendarId}
47
+ onChange={(e) => setCalendarId(e.target.value)}
48
+ autoComplete="off"
49
+ />
50
+ </label>
51
+ <button type="submit" className="btn btn--secondary" disabled={busy}>
52
+ {busy ? "Loading…" : "Fetch all participant opening hours"}
53
+ </button>
54
+ </form>
55
+ </div>
56
+
57
+ {error ? (
58
+ <div className="card card--error" role="alert">
59
+ <h2>Error</h2>
60
+ <pre className="pre-block">{error}</pre>
61
+ </div>
62
+ ) : null}
63
+
64
+ {output ? (
65
+ <div className="card card--success">
66
+ <h2>Result</h2>
67
+ <pre className="pre-block">{output}</pre>
68
+ </div>
69
+ ) : null}
70
+ </>
71
+ );
72
+ }
73
+