@peektravel/app-utilities 0.2.5 → 0.2.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/dist/index.cjs +49 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +212 -23
- package/dist/index.d.ts +212 -23
- package/dist/index.js +49 -25
- package/dist/index.js.map +1 -1
- package/dist/ui/index.cjs +39 -8
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.d.cts +9 -3
- package/dist/ui/index.d.ts +9 -3
- package/dist/ui/index.js +39 -8
- package/dist/ui/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -156,113 +156,243 @@ declare class ProductService {
|
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
/**
|
|
159
|
-
* The clean data model for Peek Pro bookings.
|
|
159
|
+
* The clean, transport-agnostic data model for Peek Pro bookings.
|
|
160
|
+
*
|
|
161
|
+
* This is the shape consumers of the package work with. It is intentionally
|
|
162
|
+
* decoupled from the underlying Peek GraphQL schema — the raw GraphQL types and
|
|
163
|
+
* the conversion logic live inside the package and are never exposed here. A
|
|
164
|
+
* booking is the central resource: it carries the customer, the activity and
|
|
165
|
+
* slot, the ticket lines, lifecycle flags, money totals, and (optionally) the
|
|
166
|
+
* guest list and full price breakdown.
|
|
160
167
|
*/
|
|
161
|
-
/** A ticket line within a booking. */
|
|
168
|
+
/** A ticket line within a booking (one resource option and its quantity). */
|
|
162
169
|
interface Ticket {
|
|
170
|
+
/** Ticket (resource option) name, e.g. `"Adult"`. Falls back to `"Unknown"`. */
|
|
163
171
|
name: string;
|
|
172
|
+
/** How many of this ticket are on the booking. */
|
|
164
173
|
quantity: number;
|
|
174
|
+
/** The resource option id backing this ticket. Falls back to `"unknown"`. */
|
|
165
175
|
ticketId: string;
|
|
176
|
+
/**
|
|
177
|
+
* Per-unit list price of the ticket — only populated when
|
|
178
|
+
* `includePriceBreakdown` is requested.
|
|
179
|
+
*/
|
|
180
|
+
listPrice?: Price;
|
|
181
|
+
/**
|
|
182
|
+
* Total value for this ticket line — only populated when
|
|
183
|
+
* `includePriceBreakdown` is requested.
|
|
184
|
+
*/
|
|
185
|
+
totalValue?: Price;
|
|
166
186
|
}
|
|
167
|
-
/** A formatted monetary value. */
|
|
187
|
+
/** A formatted monetary value: a human display string plus its raw amount. */
|
|
168
188
|
interface Price {
|
|
189
|
+
/** Human-formatted amount (e.g. `"$25.00"`). */
|
|
169
190
|
display: string;
|
|
191
|
+
/** Numeric amount as a string (e.g. `"25.00"`). */
|
|
170
192
|
amount: string;
|
|
171
193
|
}
|
|
172
|
-
/**
|
|
194
|
+
/**
|
|
195
|
+
* A resource pool used by a booking (e.g. a kayak or guide pool), with the
|
|
196
|
+
* quantity drawn from it.
|
|
197
|
+
*/
|
|
173
198
|
interface Resource {
|
|
199
|
+
/** How many units of the resource the booking uses. */
|
|
174
200
|
quantity: number;
|
|
201
|
+
/** Resource pool name. */
|
|
175
202
|
name: string;
|
|
203
|
+
/** Resource pool short name. */
|
|
176
204
|
shortName: string;
|
|
177
205
|
}
|
|
178
|
-
/**
|
|
206
|
+
/**
|
|
207
|
+
* A concrete resource assigned to a booking (a specific resource within a
|
|
208
|
+
* pool, as opposed to the pool-level {@link Resource} count).
|
|
209
|
+
*/
|
|
179
210
|
interface ResourcePoolAssignment {
|
|
211
|
+
/** Assigned resource id. */
|
|
180
212
|
id: string;
|
|
213
|
+
/** Assigned resource name. */
|
|
181
214
|
name: string;
|
|
182
215
|
}
|
|
183
|
-
/**
|
|
216
|
+
/**
|
|
217
|
+
* A custom question/answer captured on a booking or a guest. Location questions
|
|
218
|
+
* additionally carry a captured lat/long.
|
|
219
|
+
*/
|
|
184
220
|
interface CustomQuestionAnswer {
|
|
221
|
+
/** The question text as shown to the customer. */
|
|
185
222
|
question: string;
|
|
223
|
+
/** The customer's answer. */
|
|
186
224
|
answer: string;
|
|
225
|
+
/** Captured latitude, present only for location questions. */
|
|
187
226
|
latitude?: string;
|
|
227
|
+
/** Captured longitude, present only for location questions. */
|
|
188
228
|
longitude?: string;
|
|
189
229
|
}
|
|
190
|
-
/** A
|
|
230
|
+
/** A custom field response captured against a {@link Guest}. */
|
|
191
231
|
interface GuestMetadata {
|
|
232
|
+
/** Field response id. */
|
|
192
233
|
id: string;
|
|
234
|
+
/** The field's name. */
|
|
193
235
|
name: string;
|
|
236
|
+
/** The captured value (empty string when none). */
|
|
194
237
|
value: string;
|
|
195
238
|
}
|
|
196
|
-
/**
|
|
239
|
+
/**
|
|
240
|
+
* A guest on a booking. Populated only when guests are requested
|
|
241
|
+
* (`includeGuests`); the primary guest is included and flagged via
|
|
242
|
+
* {@link Guest.isPrimary}.
|
|
243
|
+
*/
|
|
197
244
|
interface Guest {
|
|
245
|
+
/** Unique guest id. */
|
|
198
246
|
id: string;
|
|
247
|
+
/** Guest name, or null. */
|
|
199
248
|
name: string | null;
|
|
249
|
+
/** Guest country, or null. */
|
|
200
250
|
country: string | null;
|
|
251
|
+
/** Date of birth, or null. */
|
|
201
252
|
dateOfBirth: Date | null;
|
|
253
|
+
/** Phone number, or null. */
|
|
202
254
|
phone: string | null;
|
|
255
|
+
/** Email address, or null. */
|
|
203
256
|
email: string | null;
|
|
257
|
+
/** Whether the guest is subject to GDPR handling. */
|
|
204
258
|
isGdpr: boolean;
|
|
259
|
+
/** Whether the guest is an actual participant (vs. a booker only). */
|
|
205
260
|
isParticipant: boolean;
|
|
261
|
+
/** Whether this is the booking's primary guest. */
|
|
206
262
|
isPrimary: boolean;
|
|
263
|
+
/** Whether the guest opted in to SMS. */
|
|
207
264
|
optinSms: boolean;
|
|
265
|
+
/** Whether the guest opted in to marketing. */
|
|
208
266
|
optinMarketing: boolean;
|
|
267
|
+
/** Postal code, or null. */
|
|
209
268
|
postalCode: string | null;
|
|
269
|
+
/** Custom field responses captured for this guest. */
|
|
210
270
|
metadata: GuestMetadata[];
|
|
211
271
|
}
|
|
212
272
|
/** A booking in Peek Pro. */
|
|
213
273
|
interface Booking {
|
|
274
|
+
/** Stable unique booking id. */
|
|
214
275
|
bookingId: string;
|
|
276
|
+
/** Human-facing display id shown in the Peek UI (e.g. `"B-123456"`). */
|
|
215
277
|
displayId: string;
|
|
278
|
+
/**
|
|
279
|
+
* Normalized booking source, e.g. `"website"`, `"app"`, `"expedia"`.
|
|
280
|
+
* `"unknown"` when the origin can't be mapped.
|
|
281
|
+
*/
|
|
216
282
|
source: string;
|
|
283
|
+
/** Raw source app reported by Peek (e.g. `"WIDGET"`). `"unknown"` if absent. */
|
|
217
284
|
sourceApp: string;
|
|
285
|
+
/**
|
|
286
|
+
* Human-readable source description (e.g. `"Website Booking Flow"`).
|
|
287
|
+
* `"unknown"` when the origin can't be mapped.
|
|
288
|
+
*/
|
|
218
289
|
sourceDescription: string;
|
|
290
|
+
/** Primary guest's name, or `""` when unknown. */
|
|
219
291
|
customerName: string | null;
|
|
292
|
+
/** Primary guest's email, or null. */
|
|
220
293
|
customerEmail: string | null;
|
|
294
|
+
/** Primary guest's phone, or null. */
|
|
221
295
|
customerPhone: string | null;
|
|
296
|
+
/** The activity (product) id this booking is for. `"unknown"` if absent. */
|
|
222
297
|
productId: string;
|
|
298
|
+
/** The activity (product) name. `"unknown"` if absent. */
|
|
223
299
|
productName: string;
|
|
300
|
+
/** Whether the booked product is a rental (vs. a standard activity). */
|
|
224
301
|
isRentalProduct: boolean;
|
|
302
|
+
/** The timeslot's legacy id, or null when the booking has no timeslot. */
|
|
225
303
|
timeslotId: string | null;
|
|
304
|
+
/** Total number of tickets across all ticket lines. */
|
|
226
305
|
totalTickets: number;
|
|
306
|
+
/** Human-readable ticket summary (e.g. `"2x Adult, 1x Child"`). */
|
|
227
307
|
ticketDescription: string;
|
|
308
|
+
/** The individual ticket lines on the booking. */
|
|
228
309
|
tickets: Ticket[];
|
|
310
|
+
/** Whether the booking has been canceled. */
|
|
229
311
|
isCanceled: boolean;
|
|
312
|
+
/** Whether the booking was marked a no-show. */
|
|
230
313
|
isNoShow: boolean;
|
|
314
|
+
/** Whether any guest on the booking has been checked in. */
|
|
231
315
|
isCheckedIn: boolean;
|
|
316
|
+
/** Whether the booking's rental has been returned. */
|
|
232
317
|
isReturned: boolean;
|
|
318
|
+
/** Purchase time in the account's local zone (ISO datetime), or null. */
|
|
233
319
|
purchasedAt: string | null;
|
|
320
|
+
/** Purchase time in UTC (ISO datetime), or null. */
|
|
234
321
|
purchasedAtUtc: string | null;
|
|
322
|
+
/** Activity start in the account's local zone (ISO datetime), or null. */
|
|
235
323
|
startsAt: string | null;
|
|
324
|
+
/** Activity start in UTC (ISO datetime), or null. */
|
|
236
325
|
startsAtUtc: string | null;
|
|
326
|
+
/** Activity end in the account's local zone (ISO datetime), or null. */
|
|
237
327
|
endsAt: string | null;
|
|
328
|
+
/** Activity end in UTC (ISO datetime), or null. */
|
|
238
329
|
endsAtUtc: string | null;
|
|
330
|
+
/** Activity duration in minutes (0 when start/end are unknown). */
|
|
239
331
|
durationMin: number;
|
|
332
|
+
/** The availability time id for the booked slot, or null. */
|
|
240
333
|
availabilityTimeId: string | null;
|
|
334
|
+
/** Customer booking-portal URL, or null. */
|
|
241
335
|
portalUrl: string | null;
|
|
336
|
+
/** Operator notes on the booking (`""` when none). */
|
|
242
337
|
notes: string;
|
|
338
|
+
/** Total booking value, human-formatted (e.g. `"$75.00"`). `""` if absent. */
|
|
243
339
|
valueDisplay: string;
|
|
340
|
+
/** Total booking value as a numeric string. `""` if absent. */
|
|
244
341
|
valueAmount: string;
|
|
342
|
+
/** Outstanding balance as a numeric string. `""` if absent. */
|
|
245
343
|
outstandingBalanceAmount: string;
|
|
344
|
+
/** Outstanding balance, human-formatted. `""` if absent. */
|
|
246
345
|
outstandingBalanceDisplay: string;
|
|
346
|
+
/** Redemption codes of promo codes applied to the order. */
|
|
247
347
|
promoCodes: string[];
|
|
348
|
+
/** Tips left on the booking. */
|
|
248
349
|
tips: Price[];
|
|
249
|
-
/**
|
|
350
|
+
/**
|
|
351
|
+
* Convenience fee — only populated when `includePriceBreakdown` is requested.
|
|
352
|
+
*/
|
|
250
353
|
convenienceFee?: Price;
|
|
354
|
+
/** Deposit — only populated when `includePriceBreakdown` is requested. */
|
|
251
355
|
deposit?: Price;
|
|
356
|
+
/** Discount — only populated when `includePriceBreakdown` is requested. */
|
|
252
357
|
discount?: Price;
|
|
358
|
+
/**
|
|
359
|
+
* Price after discount — only populated when `includePriceBreakdown` is
|
|
360
|
+
* requested.
|
|
361
|
+
*/
|
|
253
362
|
discountedPrice?: Price;
|
|
363
|
+
/** Fees — only populated when `includePriceBreakdown` is requested. */
|
|
254
364
|
fees?: Price;
|
|
365
|
+
/**
|
|
366
|
+
* Flat partner fee — only populated when `includePriceBreakdown` is requested.
|
|
367
|
+
*/
|
|
255
368
|
flatPartnerFee?: Price;
|
|
369
|
+
/** Base price — only populated when `includePriceBreakdown` is requested. */
|
|
256
370
|
price?: Price;
|
|
371
|
+
/** Retail price — only populated when `includePriceBreakdown` is requested. */
|
|
257
372
|
retailPrice?: Price;
|
|
373
|
+
/** Taxes — only populated when `includePriceBreakdown` is requested. */
|
|
258
374
|
taxes?: Price;
|
|
375
|
+
/**
|
|
376
|
+
* Tips total in the breakdown — only populated when `includePriceBreakdown`
|
|
377
|
+
* is requested.
|
|
378
|
+
*/
|
|
259
379
|
tipsBreakdown?: Price;
|
|
380
|
+
/** Pool-level resource usage (quantity per resource pool). */
|
|
260
381
|
resources: Resource[];
|
|
382
|
+
/** Concrete resources assigned to the booking. */
|
|
261
383
|
resourcePoolAssignments: ResourcePoolAssignment[];
|
|
384
|
+
/** Reseller channel id, or null for a direct booking. */
|
|
262
385
|
resellerId: string | null;
|
|
386
|
+
/**
|
|
387
|
+
* Reseller display name (channel name, plus `" - <agent>"` when an agent is
|
|
388
|
+
* set), or null for a direct booking.
|
|
389
|
+
*/
|
|
263
390
|
resellerName: string | null;
|
|
391
|
+
/** The order id this booking belongs to. `""` if absent. */
|
|
264
392
|
orderId: string;
|
|
393
|
+
/** Custom question answers captured at the booking level. */
|
|
265
394
|
customQuestionAnswers: CustomQuestionAnswer[];
|
|
395
|
+
/** Custom question answers captured per guest/ticket. */
|
|
266
396
|
customGuestQuestionAnswers: CustomQuestionAnswer[];
|
|
267
397
|
/** Guests — only populated when `includeGuests` is requested. */
|
|
268
398
|
guests?: Guest[];
|
|
@@ -336,13 +466,19 @@ interface CreateBookingInput {
|
|
|
336
466
|
}
|
|
337
467
|
/** The result of creating a booking. */
|
|
338
468
|
interface CreatedBooking {
|
|
469
|
+
/** The order id the new booking belongs to. */
|
|
339
470
|
orderId: string;
|
|
471
|
+
/** The new booking's id. */
|
|
340
472
|
bookingId: string;
|
|
473
|
+
/** The new booking's human-facing display id. */
|
|
341
474
|
displayId: string;
|
|
475
|
+
/** Remaining balance as a numeric string. */
|
|
342
476
|
balanceAmount: string;
|
|
477
|
+
/** 3-letter uppercase ISO currency code of the balance. */
|
|
343
478
|
balanceCurrency: string;
|
|
479
|
+
/** Balance, human-formatted (e.g. `"$75.00"`). */
|
|
344
480
|
balanceFormatted: string;
|
|
345
|
-
/**
|
|
481
|
+
/** The charge transaction id — set only when the booking was marked paid. */
|
|
346
482
|
transactionId?: string;
|
|
347
483
|
}
|
|
348
484
|
|
|
@@ -351,13 +487,16 @@ interface CreatedBooking {
|
|
|
351
487
|
*/
|
|
352
488
|
/** A single payment applied to a booking's order. */
|
|
353
489
|
interface Payment {
|
|
490
|
+
/** Payment id (`pmt_…`). */
|
|
354
491
|
id: string;
|
|
355
492
|
/** Date the payment was applied (YYYY-MM-DD). */
|
|
356
493
|
paidAt: string;
|
|
494
|
+
/** The payment's current (net of refunds) amount. */
|
|
357
495
|
currentAmount: {
|
|
358
496
|
amount: string;
|
|
359
497
|
currency: string;
|
|
360
498
|
};
|
|
499
|
+
/** How much of the payment can still be refunded. */
|
|
361
500
|
refundableAmount: {
|
|
362
501
|
amount: string;
|
|
363
502
|
currency: string;
|
|
@@ -365,16 +504,22 @@ interface Payment {
|
|
|
365
504
|
}
|
|
366
505
|
/** A payment source on the order, with any payments made against it. */
|
|
367
506
|
interface PaymentSource {
|
|
507
|
+
/** Human-readable description of the source (e.g. a card summary). */
|
|
368
508
|
description: string;
|
|
509
|
+
/** Payment source id (`ps_…`, or a synthetic id like `cash/cash`). */
|
|
369
510
|
id: string;
|
|
511
|
+
/** Source type reported by Peek (e.g. card/cash/custom). */
|
|
370
512
|
type: string;
|
|
371
513
|
/** Payments made against this source, when any exist. */
|
|
372
514
|
payments?: Payment[];
|
|
373
515
|
}
|
|
374
516
|
/** The payments-on-file result for a booking. */
|
|
375
517
|
interface BookingPaymentsOnFile {
|
|
518
|
+
/** The booking these payments belong to. */
|
|
376
519
|
bookingId: string;
|
|
520
|
+
/** The order id the payments live on. */
|
|
377
521
|
orderId: string;
|
|
522
|
+
/** The order's payment sources, each with its payments grouped under it. */
|
|
378
523
|
paymentsOnFile: PaymentSource[];
|
|
379
524
|
}
|
|
380
525
|
/** Input for charging a booking. */
|
|
@@ -394,11 +539,17 @@ interface MakePaymentInput {
|
|
|
394
539
|
}
|
|
395
540
|
/** Result of charging a booking. */
|
|
396
541
|
interface MakePaymentResult {
|
|
542
|
+
/** The gateway transaction id for the charge. */
|
|
397
543
|
transactionId: string;
|
|
544
|
+
/** The booking that was charged. */
|
|
398
545
|
bookingId: string;
|
|
546
|
+
/** The order the charge was applied to. */
|
|
399
547
|
orderId: string;
|
|
548
|
+
/** Amount charged, as a numeric string. */
|
|
400
549
|
amount: string;
|
|
550
|
+
/** 3-letter uppercase ISO currency code of the charge. */
|
|
401
551
|
currency: string;
|
|
552
|
+
/** The payment source that was charged. */
|
|
402
553
|
paymentSourceId: string;
|
|
403
554
|
}
|
|
404
555
|
/** Input for refunding a booking payment. */
|
|
@@ -416,17 +567,26 @@ interface RefundInput {
|
|
|
416
567
|
}
|
|
417
568
|
/** Result of refunding a booking payment. */
|
|
418
569
|
interface RefundResult {
|
|
570
|
+
/** The gateway transaction id for the refund. */
|
|
419
571
|
transactionId: string;
|
|
572
|
+
/** The booking that was refunded. */
|
|
420
573
|
bookingId: string;
|
|
574
|
+
/** The order the refund was applied to. */
|
|
421
575
|
orderId: string;
|
|
576
|
+
/** Amount refunded, as a numeric string. */
|
|
422
577
|
amount: string;
|
|
578
|
+
/** 3-letter uppercase ISO currency code of the refund. */
|
|
423
579
|
currency: string;
|
|
580
|
+
/** The payment that was refunded (`pmt_…`). */
|
|
424
581
|
paymentId: string;
|
|
425
582
|
}
|
|
426
583
|
/** Result of creating an invoice link. */
|
|
427
584
|
interface InvoiceLinkResult {
|
|
585
|
+
/** The booking the invoice is for. */
|
|
428
586
|
bookingId: string;
|
|
587
|
+
/** The order the invoice is for. */
|
|
429
588
|
orderId: string;
|
|
589
|
+
/** The customer-facing URL where the invoice can be paid. */
|
|
430
590
|
invoiceLink: string;
|
|
431
591
|
}
|
|
432
592
|
|
|
@@ -439,8 +599,11 @@ interface InvoiceLinkResult {
|
|
|
439
599
|
*/
|
|
440
600
|
/** Money amount for an add-on line, as returned by the gateway. */
|
|
441
601
|
interface BookingAddonMoney {
|
|
602
|
+
/** Numeric amount as a string (e.g. `"10.00"`). */
|
|
442
603
|
amount: string;
|
|
604
|
+
/** ISO currency code (e.g. `"USD"`). */
|
|
443
605
|
currency: string;
|
|
606
|
+
/** Human-formatted amount (e.g. `"$10.00"`). */
|
|
444
607
|
formatted: string;
|
|
445
608
|
}
|
|
446
609
|
/** A single add-on option with the quantity attached to the booking. */
|
|
@@ -465,8 +628,11 @@ interface BookingAddon {
|
|
|
465
628
|
}
|
|
466
629
|
/** A booking's add-ons. */
|
|
467
630
|
interface BookingAddons {
|
|
631
|
+
/** The booking id these add-ons belong to. */
|
|
468
632
|
bookingId: string;
|
|
633
|
+
/** The booking's human-facing display id. */
|
|
469
634
|
displayId: string;
|
|
635
|
+
/** The order id the add-ons live on. */
|
|
470
636
|
orderId: string;
|
|
471
637
|
/** Add-ons with at least one live option; fully-canceled add-ons are omitted. */
|
|
472
638
|
addons: BookingAddon[];
|
|
@@ -568,8 +734,9 @@ declare class BookingService {
|
|
|
568
734
|
* @throws {Error} when `paymentSourceId` is missing or not a `ps_…` id / one
|
|
569
735
|
* of `cash/cash`, `custom/other`, `custom/voucher`; when `amount` is not a
|
|
570
736
|
* valid number; when `currency` is not a 3-letter uppercase code; when
|
|
571
|
-
* `idempotencyKey` is empty; when `bookingId`
|
|
572
|
-
* when the booking or payment source is not found; or when the
|
|
737
|
+
* `idempotencyKey` is empty; when `bookingId` is not a valid booking id
|
|
738
|
+
* (`b_…`/`B-…`); when the booking or payment source is not found; or when the
|
|
739
|
+
* charge fails.
|
|
573
740
|
*/
|
|
574
741
|
makePayment(input: MakePaymentInput): Promise<MakePaymentResult>;
|
|
575
742
|
/**
|
|
@@ -717,49 +884,71 @@ interface PurchasedMembership {
|
|
|
717
884
|
}
|
|
718
885
|
|
|
719
886
|
/**
|
|
720
|
-
* The clean data
|
|
887
|
+
* The clean, transport-agnostic data models for Peek Pro activity availability
|
|
888
|
+
* times.
|
|
889
|
+
*
|
|
890
|
+
* `PeekAccessService.getAvailabilityTimes()` returns the bookable time slots for
|
|
891
|
+
* a given activity and date, each carrying its per-resource-option availability
|
|
892
|
+
* so callers can decide whether a requested party fits.
|
|
893
|
+
*/
|
|
894
|
+
/**
|
|
895
|
+
* A single bookable availability time slot for an activity.
|
|
896
|
+
*
|
|
897
|
+
* Each slot describes a start/end window on the queried date and reports how
|
|
898
|
+
* much capacity remains per resource option (see {@link Availability}).
|
|
721
899
|
*/
|
|
722
|
-
/** A single bookable availability time slot for an activity. */
|
|
723
900
|
interface AvailabilityTime {
|
|
724
|
-
/**
|
|
901
|
+
/** Stable unique identifier of the slot. */
|
|
725
902
|
id: string;
|
|
726
|
-
/**
|
|
903
|
+
/** Human-readable time label for the slot (e.g. `"10:00 AM"`). */
|
|
727
904
|
time: string;
|
|
728
|
-
/** Slot start. */
|
|
905
|
+
/** Slot start as reported by Peek (ISO datetime). */
|
|
729
906
|
from: string;
|
|
730
|
-
/** Slot end. */
|
|
907
|
+
/** Slot end as reported by Peek (ISO datetime). */
|
|
731
908
|
end: string;
|
|
732
|
-
/**
|
|
909
|
+
/** How long the slot runs (see {@link Duration}). */
|
|
733
910
|
duration: Duration;
|
|
734
|
-
/** Availability status. */
|
|
911
|
+
/** Availability status reported by Peek (e.g. open/closed/sold-out). */
|
|
735
912
|
status: string;
|
|
736
|
-
/**
|
|
913
|
+
/**
|
|
914
|
+
* Remaining availability broken down per resource option. One entry per
|
|
915
|
+
* resource option offered for the slot.
|
|
916
|
+
*/
|
|
737
917
|
availability: Availability[];
|
|
738
918
|
}
|
|
739
|
-
/**
|
|
919
|
+
/** The length of an {@link AvailabilityTime} slot. */
|
|
740
920
|
interface Duration {
|
|
921
|
+
/** Human-readable duration name (e.g. `"1 hour"`). */
|
|
741
922
|
name: string;
|
|
923
|
+
/** The numeric length paired with its unit. */
|
|
742
924
|
length: {
|
|
925
|
+
/** Quantity of `unit` (e.g. `60`). */
|
|
743
926
|
amount: number;
|
|
927
|
+
/** Unit of `amount` (e.g. `"minutes"`). */
|
|
744
928
|
unit: string;
|
|
745
929
|
};
|
|
746
930
|
}
|
|
747
931
|
/** Availability for a specific resource option within a slot. */
|
|
748
932
|
interface Availability {
|
|
933
|
+
/** Total capacity of this resource option for the slot. */
|
|
749
934
|
qty: number;
|
|
935
|
+
/** How much of `qty` is already taken. */
|
|
750
936
|
taken: number;
|
|
937
|
+
/** The resource option this availability is for. */
|
|
751
938
|
resourceOptionId: string;
|
|
752
939
|
}
|
|
753
940
|
/** A requested resource-option quantity used when querying availability. */
|
|
754
941
|
interface ResourceOptionQuantity {
|
|
942
|
+
/** The resource option to check. */
|
|
755
943
|
resourceOptionId: string;
|
|
944
|
+
/** How many units of that option to check availability for. */
|
|
756
945
|
quantity: number;
|
|
757
946
|
}
|
|
758
947
|
/** Query parameters for fetching availability times. */
|
|
759
948
|
interface AvailabilityTimesQuery {
|
|
760
949
|
/** Activity (product) id. */
|
|
761
950
|
activityId: string;
|
|
762
|
-
/** Date (YYYY-MM-DD). */
|
|
951
|
+
/** Date to check (YYYY-MM-DD). */
|
|
763
952
|
date: string;
|
|
764
953
|
/** The resource options and quantities to check availability for. */
|
|
765
954
|
resourceOptionQuantities: ResourceOptionQuantity[];
|