@voyantjs/bookings 0.6.8 → 0.6.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.
Files changed (63) hide show
  1. package/README.md +2 -2
  2. package/dist/index.d.ts +7 -7
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +4 -4
  5. package/dist/pii.d.ts +10 -9
  6. package/dist/pii.d.ts.map +1 -1
  7. package/dist/pii.js +33 -33
  8. package/dist/routes-groups.d.ts +25 -5
  9. package/dist/routes-groups.d.ts.map +1 -1
  10. package/dist/routes-groups.js +3 -3
  11. package/dist/routes-public.d.ts +19 -21
  12. package/dist/routes-public.d.ts.map +1 -1
  13. package/dist/routes-public.js +1 -1
  14. package/dist/routes-shared.d.ts +1 -1
  15. package/dist/routes-shared.d.ts.map +1 -1
  16. package/dist/routes.d.ts +200 -187
  17. package/dist/routes.d.ts.map +1 -1
  18. package/dist/routes.js +65 -95
  19. package/dist/schema/travel-details.d.ts +27 -27
  20. package/dist/schema/travel-details.d.ts.map +1 -1
  21. package/dist/schema/travel-details.js +19 -14
  22. package/dist/schema-core.d.ts +194 -305
  23. package/dist/schema-core.d.ts.map +1 -1
  24. package/dist/schema-core.js +19 -10
  25. package/dist/schema-items.d.ts +15 -15
  26. package/dist/schema-items.d.ts.map +1 -1
  27. package/dist/schema-items.js +12 -12
  28. package/dist/schema-operations.d.ts +1 -1
  29. package/dist/schema-operations.js +3 -3
  30. package/dist/schema-relations.d.ts +26 -9
  31. package/dist/schema-relations.d.ts.map +1 -1
  32. package/dist/schema-relations.js +36 -21
  33. package/dist/schema-shared.d.ts +3 -2
  34. package/dist/schema-shared.d.ts.map +1 -1
  35. package/dist/schema-shared.js +4 -5
  36. package/dist/schema-staff.d.ts +267 -0
  37. package/dist/schema-staff.d.ts.map +1 -0
  38. package/dist/schema-staff.js +31 -0
  39. package/dist/schema.d.ts +1 -0
  40. package/dist/schema.d.ts.map +1 -1
  41. package/dist/schema.js +1 -0
  42. package/dist/service-groups.d.ts +3 -7
  43. package/dist/service-groups.d.ts.map +1 -1
  44. package/dist/service-groups.js +6 -10
  45. package/dist/service-public.d.ts +49 -55
  46. package/dist/service-public.d.ts.map +1 -1
  47. package/dist/service-public.js +106 -53
  48. package/dist/service.d.ts +227 -99
  49. package/dist/service.d.ts.map +1 -1
  50. package/dist/service.js +321 -108
  51. package/dist/transactions-ref.d.ts +930 -66
  52. package/dist/transactions-ref.d.ts.map +1 -1
  53. package/dist/transactions-ref.js +56 -2
  54. package/dist/validation-public.d.ts +29 -69
  55. package/dist/validation-public.d.ts.map +1 -1
  56. package/dist/validation-public.js +21 -20
  57. package/dist/validation-shared.d.ts +4 -5
  58. package/dist/validation-shared.d.ts.map +1 -1
  59. package/dist/validation-shared.js +2 -10
  60. package/dist/validation.d.ts +229 -44
  61. package/dist/validation.d.ts.map +1 -1
  62. package/dist/validation.js +84 -28
  63. package/package.json +6 -6
@@ -21,9 +21,9 @@ export declare const publicBookingsService: {
21
21
  expiredAt: string | null;
22
22
  cancelledAt: string | null;
23
23
  completedAt: string | null;
24
- participants: {
24
+ travelers: {
25
25
  id: string;
26
- participantType: "staff" | "other" | "traveler" | "booker" | "contact" | "occupant";
26
+ participantType: "other" | "traveler" | "occupant";
27
27
  travelerCategory: "other" | "adult" | "child" | "infant" | "senior" | null;
28
28
  firstName: string;
29
29
  lastName: string;
@@ -56,9 +56,9 @@ export declare const publicBookingsService: {
56
56
  optionId: string | null;
57
57
  optionUnitId: string | null;
58
58
  pricingCategoryId: string | null;
59
- participantLinks: {
59
+ travelerLinks: {
60
60
  id: string;
61
- participantId: string;
61
+ travelerId: string;
62
62
  role: string;
63
63
  isPrimary: boolean;
64
64
  }[];
@@ -79,9 +79,8 @@ export declare const publicBookingsService: {
79
79
  releasedAt: string | null;
80
80
  }[];
81
81
  checklist: {
82
- hasParticipants: boolean;
83
- hasTraveler: boolean;
84
- hasPrimaryParticipant: boolean;
82
+ hasTravelers: boolean;
83
+ hasPrimaryTraveler: boolean;
85
84
  hasItems: boolean;
86
85
  hasAllocations: boolean;
87
86
  readyForConfirmation: boolean;
@@ -114,9 +113,9 @@ export declare const publicBookingsService: {
114
113
  expiredAt: string | null;
115
114
  cancelledAt: string | null;
116
115
  completedAt: string | null;
117
- participants: {
116
+ travelers: {
118
117
  id: string;
119
- participantType: "staff" | "other" | "traveler" | "booker" | "contact" | "occupant";
118
+ participantType: "other" | "traveler" | "occupant";
120
119
  travelerCategory: "other" | "adult" | "child" | "infant" | "senior" | null;
121
120
  firstName: string;
122
121
  lastName: string;
@@ -149,9 +148,9 @@ export declare const publicBookingsService: {
149
148
  optionId: string | null;
150
149
  optionUnitId: string | null;
151
150
  pricingCategoryId: string | null;
152
- participantLinks: {
151
+ travelerLinks: {
153
152
  id: string;
154
- participantId: string;
153
+ travelerId: string;
155
154
  role: string;
156
155
  isPrimary: boolean;
157
156
  }[];
@@ -172,9 +171,8 @@ export declare const publicBookingsService: {
172
171
  releasedAt: string | null;
173
172
  }[];
174
173
  checklist: {
175
- hasParticipants: boolean;
176
- hasTraveler: boolean;
177
- hasPrimaryParticipant: boolean;
174
+ hasTravelers: boolean;
175
+ hasPrimaryTraveler: boolean;
178
176
  hasItems: boolean;
179
177
  hasAllocations: boolean;
180
178
  readyForConfirmation: boolean;
@@ -214,7 +212,7 @@ export declare const publicBookingsService: {
214
212
  version: number;
215
213
  createdAt: string;
216
214
  updatedAt: string;
217
- } | null;
215
+ };
218
216
  }>;
219
217
  updateSession(db: PostgresJsDatabase, bookingId: string, input: PublicUpdateBookingSessionInput, userId?: string): Promise<{
220
218
  status: Exclude<string, "ok">;
@@ -236,9 +234,9 @@ export declare const publicBookingsService: {
236
234
  expiredAt: string | null;
237
235
  cancelledAt: string | null;
238
236
  completedAt: string | null;
239
- participants: {
237
+ travelers: {
240
238
  id: string;
241
- participantType: "staff" | "other" | "traveler" | "booker" | "contact" | "occupant";
239
+ participantType: "other" | "traveler" | "occupant";
242
240
  travelerCategory: "other" | "adult" | "child" | "infant" | "senior" | null;
243
241
  firstName: string;
244
242
  lastName: string;
@@ -271,9 +269,9 @@ export declare const publicBookingsService: {
271
269
  optionId: string | null;
272
270
  optionUnitId: string | null;
273
271
  pricingCategoryId: string | null;
274
- participantLinks: {
272
+ travelerLinks: {
275
273
  id: string;
276
- participantId: string;
274
+ travelerId: string;
277
275
  role: string;
278
276
  isPrimary: boolean;
279
277
  }[];
@@ -294,9 +292,8 @@ export declare const publicBookingsService: {
294
292
  releasedAt: string | null;
295
293
  }[];
296
294
  checklist: {
297
- hasParticipants: boolean;
298
- hasTraveler: boolean;
299
- hasPrimaryParticipant: boolean;
295
+ hasTravelers: boolean;
296
+ hasPrimaryTraveler: boolean;
300
297
  hasItems: boolean;
301
298
  hasAllocations: boolean;
302
299
  readyForConfirmation: boolean;
@@ -370,9 +367,9 @@ export declare const publicBookingsService: {
370
367
  expiredAt: string | null;
371
368
  cancelledAt: string | null;
372
369
  completedAt: string | null;
373
- participants: {
370
+ travelers: {
374
371
  id: string;
375
- participantType: "staff" | "other" | "traveler" | "booker" | "contact" | "occupant";
372
+ participantType: "other" | "traveler" | "occupant";
376
373
  travelerCategory: "other" | "adult" | "child" | "infant" | "senior" | null;
377
374
  firstName: string;
378
375
  lastName: string;
@@ -405,9 +402,9 @@ export declare const publicBookingsService: {
405
402
  optionId: string | null;
406
403
  optionUnitId: string | null;
407
404
  pricingCategoryId: string | null;
408
- participantLinks: {
405
+ travelerLinks: {
409
406
  id: string;
410
- participantId: string;
407
+ travelerId: string;
411
408
  role: string;
412
409
  isPrimary: boolean;
413
410
  }[];
@@ -428,9 +425,8 @@ export declare const publicBookingsService: {
428
425
  releasedAt: string | null;
429
426
  }[];
430
427
  checklist: {
431
- hasParticipants: boolean;
432
- hasTraveler: boolean;
433
- hasPrimaryParticipant: boolean;
428
+ hasTravelers: boolean;
429
+ hasPrimaryTraveler: boolean;
434
430
  hasItems: boolean;
435
431
  hasAllocations: boolean;
436
432
  readyForConfirmation: boolean;
@@ -467,9 +463,9 @@ export declare const publicBookingsService: {
467
463
  expiredAt: string | null;
468
464
  cancelledAt: string | null;
469
465
  completedAt: string | null;
470
- participants: {
466
+ travelers: {
471
467
  id: string;
472
- participantType: "staff" | "other" | "traveler" | "booker" | "contact" | "occupant";
468
+ participantType: "other" | "traveler" | "occupant";
473
469
  travelerCategory: "other" | "adult" | "child" | "infant" | "senior" | null;
474
470
  firstName: string;
475
471
  lastName: string;
@@ -502,9 +498,9 @@ export declare const publicBookingsService: {
502
498
  optionId: string | null;
503
499
  optionUnitId: string | null;
504
500
  pricingCategoryId: string | null;
505
- participantLinks: {
501
+ travelerLinks: {
506
502
  id: string;
507
- participantId: string;
503
+ travelerId: string;
508
504
  role: string;
509
505
  isPrimary: boolean;
510
506
  }[];
@@ -525,9 +521,8 @@ export declare const publicBookingsService: {
525
521
  releasedAt: string | null;
526
522
  }[];
527
523
  checklist: {
528
- hasParticipants: boolean;
529
- hasTraveler: boolean;
530
- hasPrimaryParticipant: boolean;
524
+ hasTravelers: boolean;
525
+ hasPrimaryTraveler: boolean;
531
526
  hasItems: boolean;
532
527
  hasAllocations: boolean;
533
528
  readyForConfirmation: boolean;
@@ -564,9 +559,9 @@ export declare const publicBookingsService: {
564
559
  expiredAt: string | null;
565
560
  cancelledAt: string | null;
566
561
  completedAt: string | null;
567
- participants: {
562
+ travelers: {
568
563
  id: string;
569
- participantType: "staff" | "other" | "traveler" | "booker" | "contact" | "occupant";
564
+ participantType: "other" | "traveler" | "occupant";
570
565
  travelerCategory: "other" | "adult" | "child" | "infant" | "senior" | null;
571
566
  firstName: string;
572
567
  lastName: string;
@@ -599,9 +594,9 @@ export declare const publicBookingsService: {
599
594
  optionId: string | null;
600
595
  optionUnitId: string | null;
601
596
  pricingCategoryId: string | null;
602
- participantLinks: {
597
+ travelerLinks: {
603
598
  id: string;
604
- participantId: string;
599
+ travelerId: string;
605
600
  role: string;
606
601
  isPrimary: boolean;
607
602
  }[];
@@ -622,9 +617,8 @@ export declare const publicBookingsService: {
622
617
  releasedAt: string | null;
623
618
  }[];
624
619
  checklist: {
625
- hasParticipants: boolean;
626
- hasTraveler: boolean;
627
- hasPrimaryParticipant: boolean;
620
+ hasTravelers: boolean;
621
+ hasPrimaryTraveler: boolean;
628
622
  hasItems: boolean;
629
623
  hasAllocations: boolean;
630
624
  readyForConfirmation: boolean;
@@ -653,9 +647,9 @@ export declare const publicBookingsService: {
653
647
  confirmedAt: string | null;
654
648
  cancelledAt: string | null;
655
649
  completedAt: string | null;
656
- participants: {
650
+ travelers: {
657
651
  id: string;
658
- participantType: "staff" | "other" | "traveler" | "booker" | "contact" | "occupant";
652
+ participantType: "other" | "traveler" | "occupant";
659
653
  firstName: string;
660
654
  lastName: string;
661
655
  isPrimary: boolean;
@@ -681,16 +675,16 @@ export declare const publicBookingsService: {
681
675
  optionId: string | null;
682
676
  optionUnitId: string | null;
683
677
  pricingCategoryId: string | null;
684
- participantLinks: {
678
+ travelerLinks: {
685
679
  id: string;
686
- participantId: string;
680
+ travelerId: string;
687
681
  role: string;
688
682
  isPrimary: boolean;
689
683
  }[];
690
684
  }[];
691
685
  documents: {
692
686
  id: string;
693
- participantId: string | null;
687
+ travelerId: string | null;
694
688
  type: "visa" | "other" | "insurance" | "health" | "passport_copy";
695
689
  fileName: string;
696
690
  fileUrl: string;
@@ -698,7 +692,7 @@ export declare const publicBookingsService: {
698
692
  fulfillments: {
699
693
  id: string;
700
694
  bookingItemId: string | null;
701
- participantId: string | null;
695
+ travelerId: string | null;
702
696
  fulfillmentType: "other" | "voucher" | "ticket" | "pdf" | "qr_code" | "barcode" | "mobile";
703
697
  deliveryChannel: "email" | "other" | "download" | "api" | "wallet";
704
698
  status: "pending" | "issued" | "reissued" | "revoked" | "failed";
@@ -717,9 +711,9 @@ export declare const publicBookingsService: {
717
711
  confirmedAt: string | null;
718
712
  cancelledAt: string | null;
719
713
  completedAt: string | null;
720
- participants: {
714
+ travelers: {
721
715
  id: string;
722
- participantType: "staff" | "other" | "traveler" | "booker" | "contact" | "occupant";
716
+ participantType: "other" | "traveler" | "occupant";
723
717
  firstName: string;
724
718
  lastName: string;
725
719
  isPrimary: boolean;
@@ -745,16 +739,16 @@ export declare const publicBookingsService: {
745
739
  optionId: string | null;
746
740
  optionUnitId: string | null;
747
741
  pricingCategoryId: string | null;
748
- participantLinks: {
742
+ travelerLinks: {
749
743
  id: string;
750
- participantId: string;
744
+ travelerId: string;
751
745
  role: string;
752
746
  isPrimary: boolean;
753
747
  }[];
754
748
  }[];
755
749
  documents: {
756
750
  id: string;
757
- participantId: string | null;
751
+ travelerId: string | null;
758
752
  type: "visa" | "other" | "insurance" | "health" | "passport_copy";
759
753
  fileName: string;
760
754
  fileUrl: string;
@@ -762,7 +756,7 @@ export declare const publicBookingsService: {
762
756
  fulfillments: {
763
757
  id: string;
764
758
  bookingItemId: string | null;
765
- participantId: string | null;
759
+ travelerId: string | null;
766
760
  fulfillmentType: "other" | "voucher" | "ticket" | "pdf" | "qr_code" | "barcode" | "mobile";
767
761
  deliveryChannel: "email" | "other" | "download" | "api" | "wallet";
768
762
  status: "pending" | "issued" | "reissued" | "revoked" | "failed";
@@ -1 +1 @@
1
- {"version":3,"file":"service-public.d.ts","sourceRoot":"","sources":["../src/service-public.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAoBjE,OAAO,KAAK,EACV,kCAAkC,EAClC,gCAAgC,EAChC,iCAAiC,EACjC,gCAAgC,EAEhC,+BAA+B,EAC/B,+BAA+B,EAC/B,oCAAoC,EACrC,MAAM,wBAAwB,CAAA;AAyuB/B,eAAO,MAAM,qBAAqB;sBAE1B,kBAAkB,SACf,+BAA+B,WAC7B,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAlHT,MAAM;mCACK,MAAM;0BACf,MAAM;+BACD,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;oBAspBA,kBAAkB,SAAS,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAt+BzE,MAAM;4BACE,MAAM;sBACZ,MAAM;2BACD,OAAO;;;;;;;;;;;;;;;;;;;;4BAu+BQ,kBAAkB,SAAS,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBA1+BnF,MAAM;4BACE,MAAM;sBACZ,MAAM;2BACD,OAAO;;;;;;;;;;;;;;;;;;;;CA0+BvB,CAAA"}
@@ -1,7 +1,7 @@
1
1
  import { and, asc, desc, eq, inArray, or } from "drizzle-orm";
2
2
  import { optionPriceRulesRef, optionUnitPriceRulesRef, optionUnitTiersRef, priceCatalogsRef, } from "./pricing-ref.js";
3
3
  import { optionUnitsRef, productOptionsRef, productsRef } from "./products-ref.js";
4
- import { bookingAllocations, bookingDocuments, bookingFulfillments, bookingItemParticipants, bookingItems, bookingParticipants, bookingSessionStates, bookings, } from "./schema.js";
4
+ import { bookingAllocations, bookingDocuments, bookingFulfillments, bookingItems, bookingItemTravelers, bookingSessionStates, bookings, bookingTravelers, } from "./schema.js";
5
5
  import { bookingsService } from "./service.js";
6
6
  const travelerParticipantTypes = new Set(["traveler", "occupant"]);
7
7
  const WIZARD_STATE_KEY = "wizard";
@@ -20,6 +20,50 @@ function normalizeDateTime(value) {
20
20
  }
21
21
  return value instanceof Date ? value.toISOString() : value;
22
22
  }
23
+ function getRecord(value) {
24
+ return value && typeof value === "object" && !Array.isArray(value)
25
+ ? value
26
+ : null;
27
+ }
28
+ function getNestedRecord(record, keys) {
29
+ for (const key of keys) {
30
+ const value = getRecord(record?.[key]);
31
+ if (value) {
32
+ return value;
33
+ }
34
+ }
35
+ return null;
36
+ }
37
+ function getRecordString(record, keys) {
38
+ for (const key of keys) {
39
+ const value = record?.[key];
40
+ if (typeof value === "string" && value.length > 0) {
41
+ return value;
42
+ }
43
+ }
44
+ return null;
45
+ }
46
+ function extractBookingContactFromStatePayload(payload) {
47
+ const root = getRecord(payload);
48
+ const stepData = getNestedRecord(root, ["stepData", "steps"]);
49
+ const billingRecord = getNestedRecord(root, ["billing", "billingContact", "contact"]) ??
50
+ getNestedRecord(stepData, ["billing", "billingContact", "contact"]);
51
+ const billing = getNestedRecord(billingRecord, ["billing", "contact"]) ?? billingRecord;
52
+ if (!billing) {
53
+ return null;
54
+ }
55
+ return {
56
+ contactFirstName: getRecordString(billing, ["firstName"]),
57
+ contactLastName: getRecordString(billing, ["lastName"]),
58
+ contactEmail: getRecordString(billing, ["email"]),
59
+ contactPhone: getRecordString(billing, ["phone"]),
60
+ contactCountry: getRecordString(billing, ["country"]),
61
+ contactRegion: getRecordString(billing, ["state", "region"]),
62
+ contactCity: getRecordString(billing, ["city"]),
63
+ contactAddressLine1: getRecordString(billing, ["addressLine1", "address1", "line1"]),
64
+ contactPostalCode: getRecordString(billing, ["postalCode", "postal", "zip"]),
65
+ };
66
+ }
23
67
  function countTravelerParticipants(participants) {
24
68
  return participants.filter((participant) => travelerParticipantTypes.has(participant.participantType)).length;
25
69
  }
@@ -141,9 +185,9 @@ async function buildOverviewSnapshot(db, query) {
141
185
  const [participants, items, itemParticipantLinks, documents, fulfillments] = await Promise.all([
142
186
  db
143
187
  .select()
144
- .from(bookingParticipants)
145
- .where(eq(bookingParticipants.bookingId, booking.id))
146
- .orderBy(asc(bookingParticipants.createdAt)),
188
+ .from(bookingTravelers)
189
+ .where(eq(bookingTravelers.bookingId, booking.id))
190
+ .orderBy(asc(bookingTravelers.createdAt)),
147
191
  db
148
192
  .select()
149
193
  .from(bookingItems)
@@ -151,16 +195,16 @@ async function buildOverviewSnapshot(db, query) {
151
195
  .orderBy(asc(bookingItems.createdAt)),
152
196
  db
153
197
  .select({
154
- id: bookingItemParticipants.id,
155
- bookingItemId: bookingItemParticipants.bookingItemId,
156
- participantId: bookingItemParticipants.participantId,
157
- role: bookingItemParticipants.role,
158
- isPrimary: bookingItemParticipants.isPrimary,
198
+ id: bookingItemTravelers.id,
199
+ bookingItemId: bookingItemTravelers.bookingItemId,
200
+ travelerId: bookingItemTravelers.travelerId,
201
+ role: bookingItemTravelers.role,
202
+ isPrimary: bookingItemTravelers.isPrimary,
159
203
  })
160
- .from(bookingItemParticipants)
161
- .innerJoin(bookingItems, eq(bookingItems.id, bookingItemParticipants.bookingItemId))
204
+ .from(bookingItemTravelers)
205
+ .innerJoin(bookingItems, eq(bookingItems.id, bookingItemTravelers.bookingItemId))
162
206
  .where(eq(bookingItems.bookingId, booking.id))
163
- .orderBy(asc(bookingItemParticipants.createdAt)),
207
+ .orderBy(asc(bookingItemTravelers.createdAt)),
164
208
  db
165
209
  .select()
166
210
  .from(bookingDocuments)
@@ -184,7 +228,7 @@ async function buildOverviewSnapshot(db, query) {
184
228
  const existing = itemLinksByItemId.get(link.bookingItemId) ?? [];
185
229
  existing.push({
186
230
  id: link.id,
187
- participantId: link.participantId,
231
+ travelerId: link.travelerId,
188
232
  role: link.role,
189
233
  isPrimary: link.isPrimary,
190
234
  });
@@ -202,7 +246,7 @@ async function buildOverviewSnapshot(db, query) {
202
246
  confirmedAt: normalizeDateTime(booking.confirmedAt),
203
247
  cancelledAt: normalizeDateTime(booking.cancelledAt),
204
248
  completedAt: normalizeDateTime(booking.completedAt),
205
- participants: participants.map((participant) => ({
249
+ travelers: participants.map((participant) => ({
206
250
  id: participant.id,
207
251
  participantType: participant.participantType,
208
252
  firstName: participant.firstName,
@@ -230,11 +274,11 @@ async function buildOverviewSnapshot(db, query) {
230
274
  optionId: item.optionId ?? null,
231
275
  optionUnitId: item.optionUnitId ?? null,
232
276
  pricingCategoryId: item.pricingCategoryId ?? null,
233
- participantLinks: itemLinksByItemId.get(item.id) ?? [],
277
+ travelerLinks: itemLinksByItemId.get(item.id) ?? [],
234
278
  })),
235
279
  documents: documents.map((document) => ({
236
280
  id: document.id,
237
- participantId: document.participantId ?? null,
281
+ travelerId: document.travelerId ?? null,
238
282
  type: document.type,
239
283
  fileName: document.fileName,
240
284
  fileUrl: document.fileUrl,
@@ -242,7 +286,7 @@ async function buildOverviewSnapshot(db, query) {
242
286
  fulfillments: fulfillments.map((fulfillment) => ({
243
287
  id: fulfillment.id,
244
288
  bookingItemId: fulfillment.bookingItemId ?? null,
245
- participantId: fulfillment.participantId ?? null,
289
+ travelerId: fulfillment.travelerId ?? null,
246
290
  fulfillmentType: fulfillment.fulfillmentType,
247
291
  deliveryChannel: fulfillment.deliveryChannel,
248
292
  status: fulfillment.status,
@@ -388,9 +432,9 @@ async function buildSessionSnapshot(db, bookingId) {
388
432
  bookingsService.getBookingById(db, bookingId),
389
433
  db
390
434
  .select()
391
- .from(bookingParticipants)
392
- .where(eq(bookingParticipants.bookingId, bookingId))
393
- .orderBy(asc(bookingParticipants.createdAt)),
435
+ .from(bookingTravelers)
436
+ .where(eq(bookingTravelers.bookingId, bookingId))
437
+ .orderBy(asc(bookingTravelers.createdAt)),
394
438
  db
395
439
  .select()
396
440
  .from(bookingItems)
@@ -403,16 +447,16 @@ async function buildSessionSnapshot(db, bookingId) {
403
447
  .orderBy(asc(bookingAllocations.createdAt)),
404
448
  db
405
449
  .select({
406
- id: bookingItemParticipants.id,
407
- bookingItemId: bookingItemParticipants.bookingItemId,
408
- participantId: bookingItemParticipants.participantId,
409
- role: bookingItemParticipants.role,
410
- isPrimary: bookingItemParticipants.isPrimary,
450
+ id: bookingItemTravelers.id,
451
+ bookingItemId: bookingItemTravelers.bookingItemId,
452
+ travelerId: bookingItemTravelers.travelerId,
453
+ role: bookingItemTravelers.role,
454
+ isPrimary: bookingItemTravelers.isPrimary,
411
455
  })
412
- .from(bookingItemParticipants)
413
- .innerJoin(bookingItems, eq(bookingItems.id, bookingItemParticipants.bookingItemId))
456
+ .from(bookingItemTravelers)
457
+ .innerJoin(bookingItems, eq(bookingItems.id, bookingItemTravelers.bookingItemId))
414
458
  .where(eq(bookingItems.bookingId, bookingId))
415
- .orderBy(asc(bookingItemParticipants.createdAt)),
459
+ .orderBy(asc(bookingItemTravelers.createdAt)),
416
460
  getWizardSessionState(db, bookingId),
417
461
  ]);
418
462
  if (!booking) {
@@ -423,15 +467,15 @@ async function buildSessionSnapshot(db, bookingId) {
423
467
  const existing = itemLinksByItemId.get(link.bookingItemId) ?? [];
424
468
  existing.push({
425
469
  id: link.id,
426
- participantId: link.participantId,
470
+ travelerId: link.travelerId,
427
471
  role: link.role,
428
472
  isPrimary: link.isPrimary,
429
473
  });
430
474
  itemLinksByItemId.set(link.bookingItemId, existing);
431
475
  }
432
- const hasParticipants = participants.length > 0;
433
476
  const hasTraveler = countTravelerParticipants(participants) > 0;
434
- const hasPrimaryParticipant = participants.some((participant) => participant.isPrimary);
477
+ const hasTravelers = participants.length > 0;
478
+ const hasPrimaryTraveler = participants.some((participant) => participant.isPrimary);
435
479
  const hasItems = items.length > 0;
436
480
  const hasAllocations = allocations.length > 0;
437
481
  return {
@@ -450,7 +494,7 @@ async function buildSessionSnapshot(db, bookingId) {
450
494
  expiredAt: normalizeDateTime(booking.expiredAt),
451
495
  cancelledAt: normalizeDateTime(booking.cancelledAt),
452
496
  completedAt: normalizeDateTime(booking.completedAt),
453
- participants: participants.map((participant) => ({
497
+ travelers: participants.map((participant) => ({
454
498
  id: participant.id,
455
499
  participantType: participant.participantType,
456
500
  travelerCategory: participant.travelerCategory ?? null,
@@ -485,7 +529,7 @@ async function buildSessionSnapshot(db, bookingId) {
485
529
  optionId: item.optionId ?? null,
486
530
  optionUnitId: item.optionUnitId ?? null,
487
531
  pricingCategoryId: item.pricingCategoryId ?? null,
488
- participantLinks: itemLinksByItemId.get(item.id) ?? [],
532
+ travelerLinks: itemLinksByItemId.get(item.id) ?? [],
489
533
  })),
490
534
  allocations: allocations.map((allocation) => ({
491
535
  id: allocation.id,
@@ -503,15 +547,14 @@ async function buildSessionSnapshot(db, bookingId) {
503
547
  releasedAt: normalizeDateTime(allocation.releasedAt),
504
548
  })),
505
549
  checklist: {
506
- hasParticipants,
507
- hasTraveler,
508
- hasPrimaryParticipant,
550
+ hasTravelers,
551
+ hasPrimaryTraveler,
509
552
  hasItems,
510
553
  hasAllocations,
511
554
  readyForConfirmation: booking.status === "on_hold" &&
512
- hasParticipants &&
555
+ hasTravelers &&
513
556
  hasTraveler &&
514
- hasPrimaryParticipant &&
557
+ hasPrimaryTraveler &&
515
558
  hasItems &&
516
559
  hasAllocations,
517
560
  },
@@ -520,7 +563,8 @@ async function buildSessionSnapshot(db, bookingId) {
520
563
  }
521
564
  export const publicBookingsService = {
522
565
  async createSession(db, input, userId) {
523
- const travelerCount = countTravelerParticipants(input.participants);
566
+ const travelers = input.travelers ?? [];
567
+ const travelerCount = countTravelerParticipants(travelers);
524
568
  const bookingNumber = await generateBookingNumber(db);
525
569
  const result = await bookingsService.reserveBooking(db, {
526
570
  bookingNumber,
@@ -558,8 +602,8 @@ export const publicBookingsService = {
558
602
  if (!("booking" in result) || !result.booking) {
559
603
  return result;
560
604
  }
561
- for (const participant of input.participants) {
562
- await bookingsService.createParticipant(db, result.booking.id, {
605
+ for (const participant of travelers) {
606
+ await bookingsService.createTravelerRecord(db, result.booking.id, {
563
607
  participantType: participant.participantType,
564
608
  travelerCategory: participant.travelerCategory ?? null,
565
609
  firstName: participant.firstName,
@@ -593,6 +637,13 @@ export const publicBookingsService = {
593
637
  return { status: "not_found" };
594
638
  }
595
639
  const state = await upsertWizardSessionState(db, bookingId, input);
640
+ if (!state) {
641
+ return { status: "not_found" };
642
+ }
643
+ const bookingContact = extractBookingContactFromStatePayload(state.payload);
644
+ if (bookingContact) {
645
+ await bookingsService.updateBooking(db, bookingId, bookingContact);
646
+ }
596
647
  return { status: "ok", state };
597
648
  },
598
649
  async updateSession(db, bookingId, input, userId) {
@@ -609,20 +660,22 @@ export const publicBookingsService = {
609
660
  pax: input.pax,
610
661
  });
611
662
  }
612
- for (const participantId of input.removedParticipantIds) {
613
- const participant = await bookingsService.getParticipantById(db, bookingId, participantId);
663
+ const travelers = input.travelers;
664
+ const removedTravelerIds = input.removedTravelerIds ?? [];
665
+ for (const travelerId of removedTravelerIds) {
666
+ const participant = await bookingsService.getTravelerRecordById(db, bookingId, travelerId);
614
667
  if (participant) {
615
- await bookingsService.deleteParticipant(db, participant.id);
668
+ await bookingsService.deleteTravelerRecord(db, participant.id);
616
669
  }
617
670
  }
618
- if (input.participants) {
619
- for (const participant of input.participants) {
671
+ if (travelers) {
672
+ for (const participant of travelers) {
620
673
  if (participant.id) {
621
- const existing = await bookingsService.getParticipantById(db, bookingId, participant.id);
674
+ const existing = await bookingsService.getTravelerRecordById(db, bookingId, participant.id);
622
675
  if (!existing) {
623
676
  return { status: "participant_not_found" };
624
677
  }
625
- await bookingsService.updateParticipant(db, participant.id, {
678
+ await bookingsService.updateTravelerRecord(db, participant.id, {
626
679
  participantType: participant.participantType,
627
680
  travelerCategory: participant.travelerCategory ?? null,
628
681
  firstName: participant.firstName,
@@ -637,7 +690,7 @@ export const publicBookingsService = {
637
690
  });
638
691
  continue;
639
692
  }
640
- await bookingsService.createParticipant(db, bookingId, {
693
+ await bookingsService.createTravelerRecord(db, bookingId, {
641
694
  participantType: participant.participantType,
642
695
  travelerCategory: participant.travelerCategory ?? null,
643
696
  firstName: participant.firstName,
@@ -662,11 +715,11 @@ export const publicBookingsService = {
662
715
  return holdResult;
663
716
  }
664
717
  }
665
- if (input.pax === undefined && (input.participants || input.removedParticipantIds.length > 0)) {
718
+ if (input.pax === undefined && (travelers || removedTravelerIds.length > 0)) {
666
719
  const participants = await db
667
- .select({ participantType: bookingParticipants.participantType })
668
- .from(bookingParticipants)
669
- .where(eq(bookingParticipants.bookingId, bookingId));
720
+ .select({ participantType: bookingTravelers.participantType })
721
+ .from(bookingTravelers)
722
+ .where(eq(bookingTravelers.bookingId, bookingId));
670
723
  const travelerCount = countTravelerParticipants(participants);
671
724
  await bookingsService.updateBooking(db, bookingId, {
672
725
  pax: travelerCount > 0 ? travelerCount : null,