@acms-subir/client 0.1.18 → 0.1.19
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 +13 -4
- package/dist/index.d.ts +10 -0
- package/dist/index.js +3 -0
- package/dist/types.d.ts +23 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -49,8 +49,8 @@ language. Update the site before shipping an app build with a newer client.
|
|
|
49
49
|
| `calendars()` | Public calendars |
|
|
50
50
|
| `resources(opts)`, `resource(slug, opts)` | Public resources; slug lookup scans list pages |
|
|
51
51
|
| `availability(opts)` | Required `resource`, `link`; optional `from`, `days`, `minutes` |
|
|
52
|
-
| `rsvpStatus(slug, { start })` | One event date's RSVP status: `open` or `reason` (`disabled`, `ended`, `closed` past the event's deadline, `cancelled`, `full`), `closesAt` (when RSVPs to the date close, or `null`: open until it ends), live `going`/`left
|
|
53
|
-
| `book(opts)` | Resource booking or RSVP input (`RsvpInput` for an RSVP), optional `idempotencyKey`; sends the client's `locale` (or `opts.locale`) for its emails |
|
|
52
|
+
| `rsvpStatus(slug, { start })` | One event date's RSVP status: `open` or `reason` (`disabled`, `ended`, `closed` past the event's deadline, `cancelled`, `full`), `closesAt` (when RSVPs to the date close, or `null`: open until it ends), live `going`/`left` (held waitlist spots count as taken), `maxSeats` for one RSVP right now, `autoConfirm`, `waitlist` (`enabled`: a full date takes places in line; `waiting` people for `seats` seats; `maxSeats` for one place in line), and `form` (questions and `version`, or `null`). `start` is the occurrence's start exactly as `events()` returns it (a UTC ISO string such as `2026-10-05T14:00:00.000Z`). Never cached |
|
|
53
|
+
| `book(opts)` | Resource booking or RSVP input (`RsvpInput` for an RSVP; `waitlist: true` joins a full date's waitlist, status `waitlisted`), optional `idempotencyKey`; sends the client's `locale` (or `opts.locale`) for its emails |
|
|
54
54
|
| `openapi()` | Raw OpenAPI document |
|
|
55
55
|
| `registerDevice({ token, platform, locale?, topics?, channels? })` | Register or refresh an Expo push token (call on every app start); `{ created, device }`. `channels`: Android channels the app created (e.g. `['urgent']`) |
|
|
56
56
|
| `updateDevice(token, { topics?, locale?, channels? })` | Change a device's topics, language or channels |
|
|
@@ -60,7 +60,8 @@ language. Update the site before shipping an app build with a newer client.
|
|
|
60
60
|
| `live()` | Live video: the current broadcast (`snapshot` or `null`), `serverNow` and the owner's `display` choices. Never cached; 404 while `site.features.live` is false |
|
|
61
61
|
| `announcements({ kind?, pinned?, page?, limit? })`, `announcement(id)`, `paginate.announcements()` | Announcements up right now in the client's language, newest first (`pinned: true`: the banners, urgent first); 404 while `site.features.announcements` is false |
|
|
62
62
|
| `form(id)`, `submitForm(id, { answers, version?, idempotencyKey? })` | A published form's questions; send answers (checkbox groups as arrays). Each call makes one key; retries reuse it |
|
|
63
|
-
| `manageBooking(token)`, `cancelBooking(token)` | The booker's own booking from its `manageToken`, and cancelling it; `can` says what is allowed |
|
|
63
|
+
| `manageBooking(token)`, `cancelBooking(token)` | The booker's own booking from its `manageToken`, and cancelling it (or leaving a waitlist, or releasing a held spot); `can` says what is allowed. A waitlisted RSVP has `booking.position` (its place in line), an offered one `booking.holdUntil` |
|
|
64
|
+
| `confirmBooking(token)` | Take a spot the waitlist offered (`can.confirm`): `confirmed`, or `pending` when RSVPs need approval. 410 once `holdUntil` passed. Core 0.3.40 or later |
|
|
64
65
|
| `rescheduleAvailability(token, { from?, days?, minutes? })`, `rescheduleBooking(token, { start, minutes? })` | Open times for moving it (its own time counts as free), then the move |
|
|
65
66
|
| `bookingIcs(token)` | The booking as an iCalendar file (string) |
|
|
66
67
|
| `requestGuestCode(email)`, `guestSignIn({ email, code, deviceName? })`, `guestBookings(guestToken, { when? })`, `guestSignOut(guestToken)` | Guest sign-in for "My bookings" |
|
|
@@ -128,6 +129,14 @@ if (status.open) {
|
|
|
128
129
|
// result.manageToken changes or cancels it later (manageBooking, cancelBooking), like the email's link:
|
|
129
130
|
// keep it in secure storage only.
|
|
130
131
|
console.log(result.booking.status);
|
|
132
|
+
} else if (status.reason === 'full' && status.waitlist.enabled) {
|
|
133
|
+
// a place in line (status 'waitlisted', no seats); when a spot opens the site emails them and holds it
|
|
134
|
+
// for 24 hours: then manageBooking shows status 'offered' and holdUntil, and confirmBooking(token) takes it
|
|
135
|
+
const result = await client.book({
|
|
136
|
+
event: date.event.slug, start: date.start, seats: 2, name: 'Example Guest', email: 'guest@example.com', waitlist: true,
|
|
137
|
+
...(status.form ? { formVersion: status.form.version } : {}), idempotencyKey: crypto.randomUUID(),
|
|
138
|
+
});
|
|
139
|
+
console.log(result.booking.status);
|
|
131
140
|
}
|
|
132
141
|
|
|
133
142
|
const controller = new AbortController();
|
|
@@ -142,7 +151,7 @@ failures, 5xx and 429 responses at most twice (three attempts total), with
|
|
|
142
151
|
250/500ms backoff and at least the server's `Retry-After` delay (seconds or HTTP
|
|
143
152
|
date). A wait that would outlast `timeoutMs` throws the 429 straight away, with
|
|
144
153
|
`retryAfter`. One-shot writes (guest code requests and sign-in, cancelling and
|
|
145
|
-
moving a booking, guest sign-out) are never repeated automatically: on a
|
|
154
|
+
moving a booking, confirming a held spot, guest sign-out) are never repeated automatically: on a
|
|
146
155
|
network error, check the state before trying again. Booking retries always
|
|
147
156
|
reuse the same serialized body and UUID. By default each `book()` call creates
|
|
148
157
|
a key using `crypto.randomUUID`, falling back to a Math.random UUID v4 where
|
package/dist/index.d.ts
CHANGED
|
@@ -201,6 +201,10 @@ export declare const endpoints: {
|
|
|
201
201
|
readonly method: "POST";
|
|
202
202
|
readonly path: "/bookings/manage/cancel";
|
|
203
203
|
};
|
|
204
|
+
readonly confirmBooking: {
|
|
205
|
+
readonly method: "POST";
|
|
206
|
+
readonly path: "/bookings/manage/confirm";
|
|
207
|
+
};
|
|
204
208
|
readonly rescheduleAvailability: {
|
|
205
209
|
readonly method: "GET";
|
|
206
210
|
readonly path: "/bookings/manage/availability";
|
|
@@ -295,7 +299,13 @@ export interface AcmsClient {
|
|
|
295
299
|
}, o?: RequestOptions): Promise<FormReceipt>;
|
|
296
300
|
/** The booker's own booking, from its private token (`manageToken`). Never cached. Requires `site.features.bookingChanges`. */
|
|
297
301
|
manageBooking(token: string, o?: RequestOptions): Promise<ManagedBooking>;
|
|
302
|
+
/** Cancel it; for an RSVP on a waitlist, leave the line or release a held spot. */
|
|
298
303
|
cancelBooking(token: string, o?: RequestOptions): Promise<ManagedBooking>;
|
|
304
|
+
/**
|
|
305
|
+
* Take a spot an RSVP's waitlist offered (`booking.status` `offered`, `can.confirm`): confirmed, or
|
|
306
|
+
* pending when the event approves RSVPs. A spot past its `holdUntil` was released (410). Requires core 0.3.40.
|
|
307
|
+
*/
|
|
308
|
+
confirmBooking(token: string, o?: RequestOptions): Promise<ManagedBooking>;
|
|
299
309
|
/** Open times for moving the booking (its own time counts as free). */
|
|
300
310
|
rescheduleAvailability(token: string, q?: ManageAvailabilityQuery, o?: RequestOptions): Promise<Availability>;
|
|
301
311
|
rescheduleBooking(token: string, input: RescheduleInput, o?: RequestOptions): Promise<ManagedBooking>;
|
package/dist/index.js
CHANGED
|
@@ -23,6 +23,8 @@ export const endpoints = {
|
|
|
23
23
|
announcements: { method: 'GET', path: '/announcements' }, announcement: { method: 'GET', path: '/announcements/{id}' },
|
|
24
24
|
// the booker's own booking: its private token goes in the Booking-Token header
|
|
25
25
|
manageBooking: { method: 'GET', path: '/bookings/manage' }, cancelBooking: { method: 'POST', path: '/bookings/manage/cancel' },
|
|
26
|
+
// take a spot an RSVP's waitlist offered
|
|
27
|
+
confirmBooking: { method: 'POST', path: '/bookings/manage/confirm' },
|
|
26
28
|
rescheduleAvailability: { method: 'GET', path: '/bookings/manage/availability' }, rescheduleBooking: { method: 'POST', path: '/bookings/manage/reschedule' },
|
|
27
29
|
bookingIcs: { method: 'GET', path: '/bookings/manage/ics' },
|
|
28
30
|
// guest sign-in for "My bookings" (emailed code → guest token)
|
|
@@ -320,6 +322,7 @@ export function createClient(options) {
|
|
|
320
322
|
},
|
|
321
323
|
manageBooking: (token, o = {}) => request('manageBooking', o, {}, undefined, undefined, undefined, bookingAuth(token)),
|
|
322
324
|
cancelBooking: (token, o = {}) => request('cancelBooking', o, {}, undefined, undefined, undefined, bookingAuth(token)),
|
|
325
|
+
confirmBooking: (token, o = {}) => request('confirmBooking', o, {}, undefined, undefined, undefined, bookingAuth(token)),
|
|
323
326
|
rescheduleAvailability: (token, q = {}, o = {}) => request('rescheduleAvailability', o, { from: q.from, days: q.days, minutes: q.minutes }, undefined, undefined, undefined, bookingAuth(token)),
|
|
324
327
|
rescheduleBooking: (token, input, o = {}) => request('rescheduleBooking', o, {}, undefined, input, undefined, bookingAuth(token)),
|
|
325
328
|
bookingIcs: (token, o = {}) => request('bookingIcs', o, {}, undefined, undefined, undefined, { ...bookingAuth(token), text: true }),
|
package/dist/types.d.ts
CHANGED
|
@@ -223,6 +223,7 @@ export type Event = {
|
|
|
223
223
|
"maxSeats": number;
|
|
224
224
|
"closesAt": string | null;
|
|
225
225
|
"closeBefore": number;
|
|
226
|
+
"waitlist": boolean;
|
|
226
227
|
"form"?: {
|
|
227
228
|
"title": string;
|
|
228
229
|
"intro": string;
|
|
@@ -315,6 +316,7 @@ export type Events = {
|
|
|
315
316
|
"maxSeats": number;
|
|
316
317
|
"closesAt": string | null;
|
|
317
318
|
"closeBefore": number;
|
|
319
|
+
"waitlist": boolean;
|
|
318
320
|
"form"?: {
|
|
319
321
|
"title": string;
|
|
320
322
|
"intro": string;
|
|
@@ -402,6 +404,7 @@ export type EventDetail = {
|
|
|
402
404
|
"maxSeats": number;
|
|
403
405
|
"closesAt": string | null;
|
|
404
406
|
"closeBefore": number;
|
|
407
|
+
"waitlist": boolean;
|
|
405
408
|
"form"?: {
|
|
406
409
|
"title": string;
|
|
407
410
|
"intro": string;
|
|
@@ -542,6 +545,7 @@ export type SearchResults = {
|
|
|
542
545
|
"maxSeats": number;
|
|
543
546
|
"closesAt": string | null;
|
|
544
547
|
"closeBefore": number;
|
|
548
|
+
"waitlist": boolean;
|
|
545
549
|
"form"?: {
|
|
546
550
|
"title": string;
|
|
547
551
|
"intro": string;
|
|
@@ -709,6 +713,12 @@ export type RsvpStatus = {
|
|
|
709
713
|
"maxSeats": number;
|
|
710
714
|
"autoConfirm": boolean;
|
|
711
715
|
"closesAt": (string) | (null);
|
|
716
|
+
"waitlist": {
|
|
717
|
+
"enabled": boolean;
|
|
718
|
+
"waiting": number;
|
|
719
|
+
"seats": number;
|
|
720
|
+
"maxSeats": number;
|
|
721
|
+
};
|
|
712
722
|
"form": ({
|
|
713
723
|
"version": string;
|
|
714
724
|
"title": string;
|
|
@@ -733,7 +743,7 @@ export type ManagedBooking = {
|
|
|
733
743
|
"id": string;
|
|
734
744
|
"reference": string;
|
|
735
745
|
"kind": "booking" | "rsvp";
|
|
736
|
-
"status": "pending" | "confirmed" | "declined" | "cancelled";
|
|
746
|
+
"status": "pending" | "confirmed" | "declined" | "cancelled" | "waitlisted" | "offered" | "expired";
|
|
737
747
|
"start": string;
|
|
738
748
|
"end": string;
|
|
739
749
|
"allDay": boolean;
|
|
@@ -746,6 +756,8 @@ export type ManagedBooking = {
|
|
|
746
756
|
[key: string]: string;
|
|
747
757
|
};
|
|
748
758
|
"createdAt": string;
|
|
759
|
+
"position": (number) | (null);
|
|
760
|
+
"holdUntil": (string) | (null);
|
|
749
761
|
};
|
|
750
762
|
"title": string;
|
|
751
763
|
"location": string;
|
|
@@ -768,6 +780,7 @@ export type ManagedBooking = {
|
|
|
768
780
|
"can": {
|
|
769
781
|
"cancel": boolean;
|
|
770
782
|
"reschedule": boolean;
|
|
783
|
+
"confirm": boolean;
|
|
771
784
|
"cutoffHours": number;
|
|
772
785
|
"closed": boolean;
|
|
773
786
|
};
|
|
@@ -794,7 +807,7 @@ export type GuestBookings = {
|
|
|
794
807
|
"id": string;
|
|
795
808
|
"reference": string;
|
|
796
809
|
"kind": "booking" | "rsvp";
|
|
797
|
-
"status": "pending" | "confirmed" | "declined" | "cancelled";
|
|
810
|
+
"status": "pending" | "confirmed" | "declined" | "cancelled" | "waitlisted" | "offered" | "expired";
|
|
798
811
|
"start": string;
|
|
799
812
|
"end": string;
|
|
800
813
|
"seats": number;
|
|
@@ -804,6 +817,7 @@ export type GuestBookings = {
|
|
|
804
817
|
"can": {
|
|
805
818
|
"cancel": boolean;
|
|
806
819
|
"reschedule": boolean;
|
|
820
|
+
"confirm": boolean;
|
|
807
821
|
"cutoffHours": number;
|
|
808
822
|
"closed": boolean;
|
|
809
823
|
};
|
|
@@ -881,7 +895,7 @@ export type BookingResult = {
|
|
|
881
895
|
"booking": {
|
|
882
896
|
"id": string;
|
|
883
897
|
"kind": "booking" | "block" | "rsvp";
|
|
884
|
-
"status": "pending" | "confirmed" | "declined" | "cancelled";
|
|
898
|
+
"status": "pending" | "confirmed" | "declined" | "cancelled" | "waitlisted" | "offered" | "expired";
|
|
885
899
|
"name": string;
|
|
886
900
|
"email": string;
|
|
887
901
|
"phone": string;
|
|
@@ -1249,6 +1263,7 @@ export type EditorDocument = {
|
|
|
1249
1263
|
"closesAt": string | null;
|
|
1250
1264
|
"closeBefore": number;
|
|
1251
1265
|
"notifyStaff": boolean;
|
|
1266
|
+
"waitlist": boolean;
|
|
1252
1267
|
"form"?: {
|
|
1253
1268
|
"title": string;
|
|
1254
1269
|
"intro": string;
|
|
@@ -1442,7 +1457,7 @@ export type EditorMediaList = {
|
|
|
1442
1457
|
export type EditorBooking = {
|
|
1443
1458
|
"id": string;
|
|
1444
1459
|
"kind": "booking" | "block" | "rsvp";
|
|
1445
|
-
"status": "pending" | "confirmed" | "declined" | "cancelled";
|
|
1460
|
+
"status": "pending" | "confirmed" | "declined" | "cancelled" | "waitlisted" | "offered" | "expired";
|
|
1446
1461
|
"name": string;
|
|
1447
1462
|
"email": string;
|
|
1448
1463
|
"phone": string;
|
|
@@ -1489,7 +1504,7 @@ export type EditorBookingList = {
|
|
|
1489
1504
|
"items": Array<{
|
|
1490
1505
|
"id": string;
|
|
1491
1506
|
"kind": "booking" | "block" | "rsvp";
|
|
1492
|
-
"status": "pending" | "confirmed" | "declined" | "cancelled";
|
|
1507
|
+
"status": "pending" | "confirmed" | "declined" | "cancelled" | "waitlisted" | "offered" | "expired";
|
|
1493
1508
|
"name": string;
|
|
1494
1509
|
"email": string;
|
|
1495
1510
|
"phone": string;
|
|
@@ -2084,6 +2099,7 @@ export type BookingInput = ({
|
|
|
2084
2099
|
"event": string;
|
|
2085
2100
|
"seats"?: number;
|
|
2086
2101
|
"formVersion"?: string;
|
|
2102
|
+
"waitlist"?: boolean;
|
|
2087
2103
|
});
|
|
2088
2104
|
export type DeviceInput = {
|
|
2089
2105
|
"token": string;
|
|
@@ -2182,6 +2198,7 @@ export type EditorSaveInput = {
|
|
|
2182
2198
|
"closesAt"?: (string) | (null);
|
|
2183
2199
|
"closeBefore"?: number;
|
|
2184
2200
|
"notifyStaff"?: boolean;
|
|
2201
|
+
"waitlist"?: boolean;
|
|
2185
2202
|
"form"?: {
|
|
2186
2203
|
"title"?: string;
|
|
2187
2204
|
"intro"?: string;
|
|
@@ -2221,7 +2238,7 @@ export type EditorMediaQuery = {
|
|
|
2221
2238
|
"limit"?: number;
|
|
2222
2239
|
};
|
|
2223
2240
|
export type EditorBookingsQuery = {
|
|
2224
|
-
"status"?: "active" | "pending" | "confirmed" | "declined" | "cancelled" | "all";
|
|
2241
|
+
"status"?: "active" | "pending" | "confirmed" | "waitlist" | "waitlisted" | "offered" | "expired" | "declined" | "cancelled" | "all";
|
|
2225
2242
|
"from"?: (undefined) | (string);
|
|
2226
2243
|
"page"?: number;
|
|
2227
2244
|
"limit"?: number;
|