@aglyn/plugins-bookings 1.0.0-beta.143 → 1.0.0-beta.145
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/README.md +82 -6
- package/package.json +11 -11
package/README.md
CHANGED
|
@@ -1,7 +1,83 @@
|
|
|
1
|
-
# @aglyn/plugins-
|
|
1
|
+
# @aglyn/plugins-bookings
|
|
2
2
|
|
|
3
|
-
The Bookings
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
The Bookings plugin for Aglyn: bookable services, open time slots, and free or paid appointments taken on a published site and managed in the console. Install it if you are running or building on the Aglyn platform and want its booking feature.
|
|
4
|
+
|
|
5
|
+
> Beta. Published from the Aglyn monorepo under the `beta` dist-tag; APIs can change between beta releases.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
npm install @aglyn/plugins-bookings@beta
|
|
10
|
+
|
|
11
|
+
Peer dependencies:
|
|
12
|
+
|
|
13
|
+
- `@mui/material`
|
|
14
|
+
- `firebase`
|
|
15
|
+
- `firebase-admin`
|
|
16
|
+
- `next`
|
|
17
|
+
- `react`
|
|
18
|
+
|
|
19
|
+
None is optional. `firebase-admin` and `next` are used by the server half (`@aglyn/plugins-bookings/server`).
|
|
20
|
+
|
|
21
|
+
## What's in it
|
|
22
|
+
|
|
23
|
+
This package is a first-party Aglyn plugin. It is loaded through Aglyn's plugin manager: the apps read its entry in the monorepo's `plugins.config.json`, import the module each surface names, and call the registrar declared for that surface. It is not a standalone library; installing it on its own loads nothing.
|
|
24
|
+
|
|
25
|
+
### On a published site
|
|
26
|
+
|
|
27
|
+
- One canvas component, `booking`: a service and time picker that books an appointment. It is placed in Besigner like any other element and registered by `registerBookingsPlugin()`.
|
|
28
|
+
|
|
29
|
+
### In the console
|
|
30
|
+
|
|
31
|
+
`registerBookingsConsole()` registers:
|
|
32
|
+
|
|
33
|
+
- A **Bookings** nav item and page at `/bookings`, behind the `bookings` feature flag. The page is code-split and loads when opened.
|
|
34
|
+
- A "Book a meeting" widget in the `crmRecordBooking` slot. The CRM plugin hosts that zone on a record; this plugin draws the control in it, so neither package imports the other.
|
|
35
|
+
- A plugin config schema (`BOOKINGS_CONFIG_SCHEMA`) with two settings: `maxDaysAhead` (the booking horizon in days) and `bookingPath` (the page on the site that holds the Booking block, used to build booking links).
|
|
36
|
+
|
|
37
|
+
### On the server
|
|
38
|
+
|
|
39
|
+
`@aglyn/plugins-bookings/server` imports `firebase-admin` and is kept out of the client entry point.
|
|
40
|
+
|
|
41
|
+
- `registerBookingsApi()` (the `tenantApi` surface) registers the site-facing routes `bookings/slots` (open slots for a service) and `bookings/book` (take a booking; a paid service goes through Stripe Checkout).
|
|
42
|
+
- `registerBookingsConsoleApi()` (the `consoleApi` surface) registers `bookings/reminders`, `bookings/refund` and `bookings/booking-analytics`, a handler on the platform billing webhook that confirms paid bookings, and a bookings-by-service figure reader.
|
|
43
|
+
- Loading the module registers two scheduled plugin jobs: `expire-stale-holds` and `booking-reminders` (a reminder email about a day before a confirmed booking). This is why `package.json` lists `./src/lib/server.*` under `sideEffects`.
|
|
44
|
+
|
|
45
|
+
Routes are served by the host app's API dispatcher under `/api/`, for example `/api/bookings/slots`.
|
|
46
|
+
|
|
47
|
+
### Entry points
|
|
48
|
+
|
|
49
|
+
| import | contents |
|
|
50
|
+
| -- | -- |
|
|
51
|
+
| `@aglyn/plugins-bookings` | `BUNDLE_ID`, `registerBookingsConsole`, the site half, and the pure model (`computeOpenSlots`, `isSlotOpen`, `bookingLinkFor`, `normalizeBookingPath`, the `HostBookingService` and `BookingSlot` types) |
|
|
52
|
+
| `@aglyn/plugins-bookings/site` | `registerBookingsPlugin` and `BOOKINGS_BUNDLE` only. This is what a published page loads, so it carries no console code |
|
|
53
|
+
| `@aglyn/plugins-bookings/server` | `registerBookingsApi`, `registerBookingsConsoleApi`, `slotsHandler`, `bookHandler`, `scanBookingReminders` |
|
|
54
|
+
| `@aglyn/plugins-bookings/*` | any module under `src/lib/` |
|
|
55
|
+
|
|
56
|
+
## Usage
|
|
57
|
+
|
|
58
|
+
The registrars are normally called by Aglyn's generated plugin loaders, not by hand. Called directly they look like this:
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
// Published site (canvas half only)
|
|
62
|
+
import { registerBookingsPlugin } from '@aglyn/plugins-bookings/site'
|
|
63
|
+
registerBookingsPlugin()
|
|
64
|
+
|
|
65
|
+
// Console app
|
|
66
|
+
import { registerBookingsConsole } from '@aglyn/plugins-bookings'
|
|
67
|
+
registerBookingsConsole()
|
|
68
|
+
|
|
69
|
+
// Server-only API dispatcher
|
|
70
|
+
import {
|
|
71
|
+
registerBookingsApi,
|
|
72
|
+
registerBookingsConsoleApi,
|
|
73
|
+
} from '@aglyn/plugins-bookings/server'
|
|
74
|
+
registerBookingsApi()
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## How it fits
|
|
78
|
+
|
|
79
|
+
A plugin may import the tenant runtime, the renderer, the Besigner logic, the core and the shared packages. It never imports another plugin, and the core never imports a plugin. Bookings depends on `@aglyn/aglyn` (the core and its plugin-manager seams), `@aglyn/tenant-runtime`, `@aglyn/tenant-data-admin`, `@aglyn/tenant-feature-instance` and several `@aglyn/shared-*` packages. What it shares with other plugins goes through core seams: tax on a paid booking is asked of the core's plugin tax profile, and the CRM control is drawn in a zone the CRM hosts.
|
|
80
|
+
|
|
81
|
+
## License
|
|
82
|
+
|
|
83
|
+
Apache-2.0. Source: https://github.com/aglyn/aglyn/tree/main/libs/plugins/bookings
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aglyn/plugins-bookings",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.145",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"homepage": "https://aglyn.com",
|
|
6
6
|
"repository": {
|
|
@@ -25,16 +25,16 @@
|
|
|
25
25
|
"./package.json": "./package.json"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@aglyn/aglyn": "1.0.0-beta.
|
|
29
|
-
"@aglyn/shared-data-mdi": "1.0.0-beta.
|
|
30
|
-
"@aglyn/shared-ui-jsx": "1.0.0-beta.
|
|
31
|
-
"@aglyn/shared-ui-snackstack": "1.0.0-beta.
|
|
32
|
-
"@aglyn/shared-util-email": "1.0.0-beta.
|
|
33
|
-
"@aglyn/shared-util-http": "1.0.0-beta.
|
|
34
|
-
"@aglyn/shared-util-timestamp": "1.0.0-beta.
|
|
35
|
-
"@aglyn/tenant-data-admin": "1.0.0-beta.
|
|
36
|
-
"@aglyn/tenant-feature-instance": "1.0.0-beta.
|
|
37
|
-
"@aglyn/tenant-runtime": "1.0.0-beta.
|
|
28
|
+
"@aglyn/aglyn": "1.0.0-beta.145",
|
|
29
|
+
"@aglyn/shared-data-mdi": "1.0.0-beta.145",
|
|
30
|
+
"@aglyn/shared-ui-jsx": "1.0.0-beta.145",
|
|
31
|
+
"@aglyn/shared-ui-snackstack": "1.0.0-beta.145",
|
|
32
|
+
"@aglyn/shared-util-email": "1.0.0-beta.145",
|
|
33
|
+
"@aglyn/shared-util-http": "1.0.0-beta.145",
|
|
34
|
+
"@aglyn/shared-util-timestamp": "1.0.0-beta.145",
|
|
35
|
+
"@aglyn/tenant-data-admin": "1.0.0-beta.145",
|
|
36
|
+
"@aglyn/tenant-feature-instance": "1.0.0-beta.145",
|
|
37
|
+
"@aglyn/tenant-runtime": "1.0.0-beta.145",
|
|
38
38
|
"@swc/helpers": "0.5.23"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|