@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 CHANGED
@@ -256,6 +256,7 @@ function fromBookingNode(node, includeGuests = false, includePriceBreakdown = fa
256
256
  const data = node ?? {};
257
257
  const ticketQuantities = data.ticketQuantities ?? [];
258
258
  const app = data.order?.initialQuote?.source?.actor?.app ?? null;
259
+ const sourceDetails = data.order?.initialQuote?.source?.actor?.name ?? null;
259
260
  const customQuestionAnswers = (data.questionAnswers ?? []).map(
260
261
  (answer) => {
261
262
  const base = {
@@ -279,6 +280,7 @@ function fromBookingNode(node, includeGuests = false, includePriceBreakdown = fa
279
280
  source: sourceFromApp(app),
280
281
  sourceApp: app || UNKNOWN,
281
282
  sourceDescription: sourceDescriptionFromApp(app),
283
+ sourceDetails,
282
284
  customerName: data.primaryGuest?.name || "",
283
285
  customerEmail: data.primaryGuest?.email || null,
284
286
  customerPhone: data.primaryGuest?.phone || null,
@@ -714,6 +716,7 @@ var bookingQueryFields = `
714
716
  source {
715
717
  actor {
716
718
  app
719
+ name
717
720
  }
718
721
  }
719
722
  }
@@ -2349,17 +2352,17 @@ function fromTimeslotNode(node, productId) {
2349
2352
  durationMin: node.minuteLength ?? 0,
2350
2353
  date: node.date || "",
2351
2354
  startTime: node.start ?? null,
2352
- assignedResources: mapAssignedResources(node.resourceAllocations)
2355
+ assignedResources: mapAssignedResources(node.inheritedResourceAllocations)
2353
2356
  };
2354
2357
  }
2358
+ var ACTIVE_ALLOCATION_STATUS = "ACTIVE";
2355
2359
  function mapAssignedResources(allocations) {
2356
2360
  if (!Array.isArray(allocations) || allocations.length === 0) {
2357
2361
  return [];
2358
2362
  }
2359
- return allocations.map((allocation) => {
2363
+ return allocations.filter((allocation) => allocation.status === ACTIVE_ALLOCATION_STATUS).map((allocation) => {
2360
2364
  const pool = allocation.resourcePool;
2361
2365
  return {
2362
- id: pool?.id || "",
2363
2366
  name: pool?.name || "",
2364
2367
  capacity: pool?.capacity ?? 0,
2365
2368
  category: pool?.category || "",
@@ -2438,10 +2441,10 @@ var TIMESLOTS_QUERY = `
2438
2441
  minuteLength
2439
2442
  status
2440
2443
  date
2441
- resourceAllocations {
2444
+ inheritedResourceAllocations {
2442
2445
  quantity
2446
+ status
2443
2447
  resourcePool {
2444
- id
2445
2448
  name
2446
2449
  category
2447
2450
  capacity
@@ -2476,10 +2479,10 @@ var TIMESLOT_BY_ID_QUERY = `
2476
2479
  minuteLength
2477
2480
  status
2478
2481
  date
2479
- resourceAllocations {
2482
+ inheritedResourceAllocations {
2480
2483
  quantity
2484
+ status
2481
2485
  resourcePool {
2482
- id
2483
2486
  name
2484
2487
  category
2485
2488
  capacity