@peektravel/app-utilities 0.2.6 → 0.2.9
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 +10 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +10 -7
- package/dist/index.js.map +1 -1
- package/docs/webhooks.md +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -287,6 +287,11 @@ interface Booking {
|
|
|
287
287
|
* `"unknown"` when the origin can't be mapped.
|
|
288
288
|
*/
|
|
289
289
|
sourceDescription: string;
|
|
290
|
+
/**
|
|
291
|
+
* Raw source actor name reported by Peek, when present. `null` when the
|
|
292
|
+
* origin actor carries no name.
|
|
293
|
+
*/
|
|
294
|
+
sourceDetails: string | null;
|
|
290
295
|
/** Primary guest's name, or `""` when unknown. */
|
|
291
296
|
customerName: string | null;
|
|
292
297
|
/** Primary guest's email, or null. */
|
|
@@ -1036,8 +1041,6 @@ interface Timeslot {
|
|
|
1036
1041
|
}
|
|
1037
1042
|
/** A resource allocated to a {@link Timeslot}. */
|
|
1038
1043
|
interface AssignedResource {
|
|
1039
|
-
/** Resource pool id. */
|
|
1040
|
-
id: string;
|
|
1041
1044
|
/** Resource pool name. */
|
|
1042
1045
|
name: string;
|
|
1043
1046
|
/** Resource pool capacity. */
|
package/dist/index.d.ts
CHANGED
|
@@ -287,6 +287,11 @@ interface Booking {
|
|
|
287
287
|
* `"unknown"` when the origin can't be mapped.
|
|
288
288
|
*/
|
|
289
289
|
sourceDescription: string;
|
|
290
|
+
/**
|
|
291
|
+
* Raw source actor name reported by Peek, when present. `null` when the
|
|
292
|
+
* origin actor carries no name.
|
|
293
|
+
*/
|
|
294
|
+
sourceDetails: string | null;
|
|
290
295
|
/** Primary guest's name, or `""` when unknown. */
|
|
291
296
|
customerName: string | null;
|
|
292
297
|
/** Primary guest's email, or null. */
|
|
@@ -1036,8 +1041,6 @@ interface Timeslot {
|
|
|
1036
1041
|
}
|
|
1037
1042
|
/** A resource allocated to a {@link Timeslot}. */
|
|
1038
1043
|
interface AssignedResource {
|
|
1039
|
-
/** Resource pool id. */
|
|
1040
|
-
id: string;
|
|
1041
1044
|
/** Resource pool name. */
|
|
1042
1045
|
name: string;
|
|
1043
1046
|
/** Resource pool capacity. */
|
package/dist/index.js
CHANGED
|
@@ -234,6 +234,7 @@ function fromBookingNode(node, includeGuests = false, includePriceBreakdown = fa
|
|
|
234
234
|
const data = node ?? {};
|
|
235
235
|
const ticketQuantities = data.ticketQuantities ?? [];
|
|
236
236
|
const app = data.order?.initialQuote?.source?.actor?.app ?? null;
|
|
237
|
+
const sourceDetails = data.order?.initialQuote?.source?.actor?.name ?? null;
|
|
237
238
|
const customQuestionAnswers = (data.questionAnswers ?? []).map(
|
|
238
239
|
(answer) => {
|
|
239
240
|
const base = {
|
|
@@ -257,6 +258,7 @@ function fromBookingNode(node, includeGuests = false, includePriceBreakdown = fa
|
|
|
257
258
|
source: sourceFromApp(app),
|
|
258
259
|
sourceApp: app || UNKNOWN,
|
|
259
260
|
sourceDescription: sourceDescriptionFromApp(app),
|
|
261
|
+
sourceDetails,
|
|
260
262
|
customerName: data.primaryGuest?.name || "",
|
|
261
263
|
customerEmail: data.primaryGuest?.email || null,
|
|
262
264
|
customerPhone: data.primaryGuest?.phone || null,
|
|
@@ -692,6 +694,7 @@ var bookingQueryFields = `
|
|
|
692
694
|
source {
|
|
693
695
|
actor {
|
|
694
696
|
app
|
|
697
|
+
name
|
|
695
698
|
}
|
|
696
699
|
}
|
|
697
700
|
}
|
|
@@ -2327,17 +2330,17 @@ function fromTimeslotNode(node, productId) {
|
|
|
2327
2330
|
durationMin: node.minuteLength ?? 0,
|
|
2328
2331
|
date: node.date || "",
|
|
2329
2332
|
startTime: node.start ?? null,
|
|
2330
|
-
assignedResources: mapAssignedResources(node.
|
|
2333
|
+
assignedResources: mapAssignedResources(node.inheritedResourceAllocations)
|
|
2331
2334
|
};
|
|
2332
2335
|
}
|
|
2336
|
+
var ACTIVE_ALLOCATION_STATUS = "ACTIVE";
|
|
2333
2337
|
function mapAssignedResources(allocations) {
|
|
2334
2338
|
if (!Array.isArray(allocations) || allocations.length === 0) {
|
|
2335
2339
|
return [];
|
|
2336
2340
|
}
|
|
2337
|
-
return allocations.map((allocation) => {
|
|
2341
|
+
return allocations.filter((allocation) => allocation.status === ACTIVE_ALLOCATION_STATUS).map((allocation) => {
|
|
2338
2342
|
const pool = allocation.resourcePool;
|
|
2339
2343
|
return {
|
|
2340
|
-
id: pool?.id || "",
|
|
2341
2344
|
name: pool?.name || "",
|
|
2342
2345
|
capacity: pool?.capacity ?? 0,
|
|
2343
2346
|
category: pool?.category || "",
|
|
@@ -2416,10 +2419,10 @@ var TIMESLOTS_QUERY = `
|
|
|
2416
2419
|
minuteLength
|
|
2417
2420
|
status
|
|
2418
2421
|
date
|
|
2419
|
-
|
|
2422
|
+
inheritedResourceAllocations {
|
|
2420
2423
|
quantity
|
|
2424
|
+
status
|
|
2421
2425
|
resourcePool {
|
|
2422
|
-
id
|
|
2423
2426
|
name
|
|
2424
2427
|
category
|
|
2425
2428
|
capacity
|
|
@@ -2454,10 +2457,10 @@ var TIMESLOT_BY_ID_QUERY = `
|
|
|
2454
2457
|
minuteLength
|
|
2455
2458
|
status
|
|
2456
2459
|
date
|
|
2457
|
-
|
|
2460
|
+
inheritedResourceAllocations {
|
|
2458
2461
|
quantity
|
|
2462
|
+
status
|
|
2459
2463
|
resourcePool {
|
|
2460
|
-
id
|
|
2461
2464
|
name
|
|
2462
2465
|
category
|
|
2463
2466
|
capacity
|