@blazeo.com/appointment-client 1.0.4 → 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.
- package/blazeo.com-appointment-client-1.0.6.tgz +0 -0
- package/dist/calendar/blazeoCalendarRelationMethods.d.ts +4 -36
- package/dist/calendar/blazeoCalendarRelationMethods.js +0 -1
- package/dist/calendar/buildUnifiedCalendarView.d.ts +31 -0
- package/dist/calendar/buildUnifiedCalendarView.js +265 -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 +73 -0
- package/dist/calendar/fetchCalendarDetails.js +192 -0
- package/dist/calendar/fetchCalendarWithOpeningHours.d.ts +34 -21
- package/dist/calendar/fetchCalendarWithOpeningHours.js +95 -75
- package/dist/calendar/getAllParticipantOpeningHours.d.ts +19 -0
- package/dist/calendar/getAllParticipantOpeningHours.js +17 -0
- package/dist/calendar/getOpeningHours.d.ts +5 -0
- package/dist/calendar/getOpeningHours.js +9 -0
- package/dist/calendar/getParticipantOpeningHours.d.ts +37 -0
- package/dist/calendar/getParticipantOpeningHours.js +43 -0
- package/dist/calendar/getParticipants.d.ts +4 -0
- package/dist/calendar/getParticipants.js +8 -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/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 +0 -1
- 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 +0 -1
- package/dist/config/initializeAppointmentClient.d.ts +4 -28
- package/dist/config/initializeAppointmentClient.js +5 -24
- 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 +23 -81
- package/dist/index.js +21 -32
- 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 +9 -4
- package/sample/build_error.txt +0 -0
- package/sample/demo.js +70 -0
- package/sample/package-lock.json +53 -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 +73 -0
- package/sample/src/App2.jsx +39 -2
- package/sample/src/BlazeoConnectionSettings.jsx +1 -1
- package/sample/src/EventTab.jsx +128 -0
- package/sample/src/FetchCalendarTab.jsx +72 -43
- package/sample/src/OpeningHoursTab.jsx +78 -0
- package/sample/src/ParticipantInfoTab.jsx +72 -0
- package/sample/src/ParticipantOpeningHoursTab.jsx +88 -0
- package/sample/src/ParticipantTab.jsx +2 -2
- package/src/calendar/blazeoCalendarRelationMethods.ts +19 -0
- package/src/calendar/buildUnifiedCalendarView.ts +322 -0
- package/src/calendar/calendarCreation.ts +179 -0
- package/src/calendar/createCalendar.ts +243 -0
- package/src/calendar/fetchCalendarDetails.ts +226 -0
- package/src/calendar/fetchCalendarWithOpeningHours.ts +99 -0
- package/src/calendar/getAllParticipantOpeningHours.ts +22 -0
- package/src/calendar/getOpeningHours.ts +10 -0
- package/src/calendar/getParticipantOpeningHours.ts +46 -0
- package/src/calendar/getParticipants.ts +9 -0
- package/src/calendar/mapCalendarToBlazeoSnapshot.ts +46 -0
- package/src/config/applyBlazeoDefaults.ts +13 -0
- package/src/config/blazeoClientDefaults.ts +11 -0
- package/src/config/initializeAppointmentClient.ts +18 -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 +45 -0
- package/src/models/CalendarRootModel.ts +60 -0
- package/tsconfig.json +16 -0
- package/blazeo.com-appointment-client-1.0.4.tgz +0 -0
|
@@ -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
|
package/dist/types/calendarBo.js
CHANGED
|
@@ -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,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blazeo.com/appointment-client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
|
-
},
|
|
6
|
+
},
|
|
7
7
|
"author": "Blazeo",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"main": "./dist/index.js",
|
|
@@ -14,10 +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.
|
|
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
|
}
|
|
23
|
-
|
|
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();
|
package/sample/package-lock.json
CHANGED
|
@@ -17,11 +17,62 @@
|
|
|
17
17
|
},
|
|
18
18
|
"..": {
|
|
19
19
|
"name": "@blazeo.com/appointment-client",
|
|
20
|
-
"version": "1.0.
|
|
20
|
+
"version": "1.0.5",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@blazeo.com/calendar-client": "^1.0.
|
|
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"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"../node_modules/@blazeo.com/calendar-client": {
|
|
31
|
+
"version": "1.0.17",
|
|
32
|
+
"license": "UNLICENSED",
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"mobx": "^6.10.0",
|
|
35
|
+
"mobx-state-tree": "^5.4.0"
|
|
36
|
+
},
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=18"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"../node_modules/@blazeo.com/calendar-client/node_modules/mobx-state-tree": {
|
|
42
|
+
"version": "5.4.2",
|
|
43
|
+
"license": "MIT",
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"mobx": "^6.3.0"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"../node_modules/mobx": {
|
|
49
|
+
"version": "6.15.0",
|
|
50
|
+
"license": "MIT",
|
|
51
|
+
"funding": {
|
|
52
|
+
"type": "opencollective",
|
|
53
|
+
"url": "https://opencollective.com/mobx"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"../node_modules/mobx-state-tree": {
|
|
57
|
+
"version": "7.2.0",
|
|
58
|
+
"license": "MIT",
|
|
59
|
+
"dependencies": {
|
|
60
|
+
"ts-essentials": "^9.4.1"
|
|
61
|
+
},
|
|
62
|
+
"peerDependencies": {
|
|
63
|
+
"mobx": "^6.3.0"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"../node_modules/ts-essentials": {
|
|
67
|
+
"version": "9.4.2",
|
|
68
|
+
"license": "MIT",
|
|
69
|
+
"peerDependencies": {
|
|
70
|
+
"typescript": ">=4.1.0"
|
|
71
|
+
},
|
|
72
|
+
"peerDependenciesMeta": {
|
|
73
|
+
"typescript": {
|
|
74
|
+
"optional": true
|
|
75
|
+
}
|
|
25
76
|
}
|
|
26
77
|
},
|
|
27
78
|
"node_modules/@babel/code-frame": {
|
package/sample/package.json
CHANGED
|
@@ -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
|
+
|
package/sample/src/App2.jsx
CHANGED
|
@@ -6,16 +6,25 @@ import {
|
|
|
6
6
|
import { CalendarTab } from "./CalendarTab.jsx";
|
|
7
7
|
import { EventTab } from "./EventTab.jsx";
|
|
8
8
|
import { ParticipantTab } from "./ParticipantTab.jsx";
|
|
9
|
+
import { ParticipantInfoTab } from "./ParticipantInfoTab.jsx";
|
|
10
|
+
import { ParticipantOpeningHoursTab } from "./ParticipantOpeningHoursTab.jsx";
|
|
11
|
+
import { AllParticipantOpeningHoursTab } from "./AllParticipantOpeningHoursTab.jsx";
|
|
9
12
|
import { AvailabilityTab } from "./AvailabilityTab.jsx";
|
|
10
13
|
import { CreateCalendarTab } from "./CreateCalendarTab.jsx";
|
|
11
14
|
import { FetchCalendarTab } from "./FetchCalendarTab.jsx";
|
|
15
|
+
import { OpeningHoursTab } from "./OpeningHoursTab.jsx";
|
|
12
16
|
|
|
13
17
|
const TABS = [
|
|
14
18
|
{ id: "calendar", label: "Calendar" },
|
|
15
|
-
|
|
19
|
+
/** `FetchCalendarTab` → `fetchCalendarDetails` + `calendarView` (unified object). */
|
|
20
|
+
{ id: "fetch", label: "Fetch · calendarView" },
|
|
16
21
|
{ id: "create", label: "Create calendar" },
|
|
17
22
|
{ id: "event", label: "Event" },
|
|
18
23
|
{ id: "participant", label: "Participant" },
|
|
24
|
+
{ id: "participant-info", label: "Participant info" },
|
|
25
|
+
{ id: "opening-hours", label: "Opening Hours" },
|
|
26
|
+
{ id: "participant-opening-hours", label: "Participant opening hours" },
|
|
27
|
+
{ id: "all-participant-opening-hours", label: "All participant opening hours" },
|
|
19
28
|
{ id: "availability", label: "Availability / booking" },
|
|
20
29
|
];
|
|
21
30
|
|
|
@@ -80,7 +89,7 @@ function AppShell() {
|
|
|
80
89
|
<main className="page">
|
|
81
90
|
<header className="header">
|
|
82
91
|
<h1>appointment-client</h1>
|
|
83
|
-
<p className="muted">Browser sample —
|
|
92
|
+
<p className="muted">Browser sample — use tab <strong>Fetch · calendarView</strong> for the unified <code>calendarView</code> object.</p>
|
|
84
93
|
</header>
|
|
85
94
|
|
|
86
95
|
<ConnectionSettingsCard />
|
|
@@ -128,6 +137,34 @@ function AppShell() {
|
|
|
128
137
|
<ParticipantTab />
|
|
129
138
|
</section>
|
|
130
139
|
)}
|
|
140
|
+
{activeId === "participant-info" && (
|
|
141
|
+
<section role="tabpanel" id="panel-participant-info" aria-labelledby="tab-participant-info">
|
|
142
|
+
<ParticipantInfoTab />
|
|
143
|
+
</section>
|
|
144
|
+
)}
|
|
145
|
+
{activeId === "opening-hours" && (
|
|
146
|
+
<section role="tabpanel" id="panel-opening-hours" aria-labelledby="tab-opening-hours">
|
|
147
|
+
<OpeningHoursTab />
|
|
148
|
+
</section>
|
|
149
|
+
)}
|
|
150
|
+
{activeId === "participant-opening-hours" && (
|
|
151
|
+
<section
|
|
152
|
+
role="tabpanel"
|
|
153
|
+
id="panel-participant-opening-hours"
|
|
154
|
+
aria-labelledby="tab-participant-opening-hours"
|
|
155
|
+
>
|
|
156
|
+
<ParticipantOpeningHoursTab />
|
|
157
|
+
</section>
|
|
158
|
+
)}
|
|
159
|
+
{activeId === "all-participant-opening-hours" && (
|
|
160
|
+
<section
|
|
161
|
+
role="tabpanel"
|
|
162
|
+
id="panel-all-participant-opening-hours"
|
|
163
|
+
aria-labelledby="tab-all-participant-opening-hours"
|
|
164
|
+
>
|
|
165
|
+
<AllParticipantOpeningHoursTab />
|
|
166
|
+
</section>
|
|
167
|
+
)}
|
|
131
168
|
{activeId === "availability" && (
|
|
132
169
|
<section role="tabpanel" id="panel-availability" aria-labelledby="tab-availability">
|
|
133
170
|
<AvailabilityTab />
|
|
@@ -45,7 +45,7 @@ export function mergeBlazeoUiWithFile(uiBaseUrl, uiConsumer) {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
|
-
* Re-apply global Blazeo `configure` from the
|
|
48
|
+
* Re-apply global Blazeo `configure` from the effective connection card state.
|
|
49
49
|
* Call at the start of any handler that uses `CalendarModel` / `EventModel` HTTP so
|
|
50
50
|
* `getParticipantOpeningHours` (instance env) and static helpers always see the same
|
|
51
51
|
* `baseUrl`.
|