@voyant-travel/bookings-react 0.138.8 → 0.138.10

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.
@@ -1 +1 @@
1
- {"version":3,"file":"booking-journey-host.d.ts","sourceRoot":"","sources":["../../src/admin/booking-journey-host.tsx"],"names":[],"mappings":"AAuDA,MAAM,WAAW,uBAAuB;IACtC,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,4EAA4E;IAC5E,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,2EAA2E;IAC3E,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,iFAAiF;IACjF,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;oCACgC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,wBAAgB,kBAAkB,CAAC,EACjC,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,kBAAkB,EAClB,SAAS,EACT,WAAW,EACX,aAAa,EACb,QAAQ,EACR,UAAU,EACV,UAAU,EACV,KAAK,EACL,UAAU,EACV,cAAc,EACd,OAAO,EACP,SAAS,GACV,EAAE,uBAAuB,GAAG,KAAK,CAAC,YAAY,CAqG9C"}
1
+ {"version":3,"file":"booking-journey-host.d.ts","sourceRoot":"","sources":["../../src/admin/booking-journey-host.tsx"],"names":[],"mappings":"AAuDA,MAAM,WAAW,uBAAuB;IACtC,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,4EAA4E;IAC5E,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,2EAA2E;IAC3E,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,iFAAiF;IACjF,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;oCACgC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,wBAAgB,kBAAkB,CAAC,EACjC,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,kBAAkB,EAClB,SAAS,EACT,WAAW,EACX,aAAa,EACb,QAAQ,EACR,UAAU,EACV,UAAU,EACV,KAAK,EACL,UAAU,EACV,cAAc,EACd,OAAO,EACP,SAAS,GACV,EAAE,uBAAuB,GAAG,KAAK,CAAC,YAAY,CAsG9C"}
@@ -92,14 +92,15 @@ export function BookingJourneyHost({ entityModule, entityId, sourceKind, sourceC
92
92
  ...(ratePlanId ? { ratePlanId } : {}),
93
93
  ...(board ? { board } : {}),
94
94
  }, defaultBuyerType: "B2B",
95
- // Operator payment options: hold (reserve, collect later), online payment
96
- // link (the customer pays via the hosted PSP page — we never charge a card
97
- // instantly here), bank transfer, and agency credit.
95
+ // The admin in-process commit route can reserve/hold bookings. Tokenized
96
+ // card charges, bank-transfer checkout instructions, and agency-credit
97
+ // account collection are separate flows that this packaged host does not
98
+ // wire yet, so do not advertise them here.
98
99
  paymentCapabilities: {
99
- acceptsCard: true,
100
+ acceptsCard: false,
100
101
  acceptsHold: true,
101
- acceptsBankTransfer: true,
102
- acceptsTicketOnCredit: true,
102
+ acceptsBankTransfer: false,
103
+ acceptsTicketOnCredit: false,
103
104
  }, entitySummary: entitySummary, className: className, ...slots }));
104
105
  }
105
106
  /**
@@ -208,9 +209,10 @@ function CrmLeadPicker({ apply, buyerType, variant = "lead", linkedPersonId, })
208
209
  if (!org || appliedOrgId.current === org.id)
209
210
  return;
210
211
  appliedOrgId.current = org.id;
212
+ const companyName = org.legalName ?? org.name;
211
213
  apply({
212
214
  organizationId: org.id,
213
- companyName: org.legalName ?? org.name,
215
+ companyName,
214
216
  taxId: org.taxId ?? undefined,
215
217
  });
216
218
  }, [orgQuery.data]);
@@ -15,6 +15,15 @@ export declare function buildCommitParty(draft: Draft): Record<string, unknown>;
15
15
  * otherwise awaiting payment.
16
16
  */
17
17
  export declare function resolveInitialStatus(draft: Draft): "draft" | "confirmed" | "awaiting_payment";
18
+ /**
19
+ * The packaged admin journey's in-process commit route can only create a held
20
+ * booking. Other payment intents need a dedicated checkout/provider flow
21
+ * because the route contract requires fields the generic draft does not carry
22
+ * (`tokenizedCard`, `agencyAccount`, bank-transfer instructions, etc.).
23
+ */
24
+ export declare function buildCommitPaymentIntent(draft: Draft): {
25
+ type: "hold";
26
+ };
18
27
  export declare function isStepVisible(step: JourneyStep, shape: BookingDraftShape): boolean;
19
28
  export declare function canAdvanceFromStep(step: JourneyStep, draft: Draft, shape: BookingDraftShape, available: boolean): boolean;
20
29
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"booking-journey-rules.d.ts","sourceRoot":"","sources":["../../../src/journey/components/booking-journey-rules.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EAOvB,MAAM,6DAA6D,CAAA;AACpE,OAAO,EAAE,KAAK,kBAAkB,EAAiB,MAAM,qBAAqB,CAAA;AAC5E,OAAO,EAAE,KAAK,KAAK,EAAY,MAAM,uBAAuB,CAAA;AAG5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAqBtE;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,GAAG,WAAW,GAAG,kBAAkB,CAK7F;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAgClF;AAED,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,iBAAiB,EACxB,SAAS,EAAE,OAAO,GACjB,OAAO,CA2DT;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,iBAAiB,EACxB,SAAS,EAAE,OAAO,GACjB,OAAO,CAeT;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,iBAAiB,EACxB,QAAQ,EAAE,kBAAkB,GAC3B,aAAa,CAAC,MAAM,CAAC,CA4DvB;AAMD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,GACf,MAAM,GAAG,IAAI,CAMf;AAED,wBAAgB,mBAAmB,IAAI,iBAAiB,CAavD"}
1
+ {"version":3,"file":"booking-journey-rules.d.ts","sourceRoot":"","sources":["../../../src/journey/components/booking-journey-rules.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EAOvB,MAAM,6DAA6D,CAAA;AACpE,OAAO,EAAE,KAAK,kBAAkB,EAAiB,MAAM,qBAAqB,CAAA;AAC5E,OAAO,EAAE,KAAK,KAA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
11
11
  */
12
12
  export function buildCommitParty(draft) {
13
13
  const c = draft.billing.contact;
14
+ const companyName = draft.billing.company?.name?.trim();
15
+ const contactFirstName = draft.billing.buyerType === "B2B" && companyName ? companyName : c.firstName;
16
+ const contactLastName = draft.billing.buyerType === "B2B" && contactFirstName === companyName ? "" : c.lastName;
17
+ const personId = draft.billing.buyerType === "B2B" ? undefined : c.personId;
14
18
  const organizationId = draft.billing.buyerType === "B2B" ? draft.billing.organizationId : undefined;
15
19
  return {
16
- personId: c.personId,
20
+ personId,
17
21
  organizationId,
18
22
  billing: {
19
- personId: c.personId,
23
+ personId,
20
24
  organizationId,
21
25
  contact: {
22
- firstName: c.firstName,
23
- lastName: c.lastName,
24
- email: c.email,
25
- phone: c.phone,
26
+ firstName: contactFirstName,
27
+ lastName: contactLastName,
28
+ email: draft.billing.buyerType === "B2B" && companyName ? "" : c.email,
29
+ phone: draft.billing.buyerType === "B2B" && companyName ? undefined : c.phone,
26
30
  },
27
31
  },
28
32
  travelerParty: {
@@ -42,6 +46,17 @@ export function resolveInitialStatus(draft) {
42
46
  const fullyPaid = schedules.length > 0 && schedules.every((s) => s.status === "paid");
43
47
  return fullyPaid ? "confirmed" : "awaiting_payment";
44
48
  }
49
+ /**
50
+ * The packaged admin journey's in-process commit route can only create a held
51
+ * booking. Other payment intents need a dedicated checkout/provider flow
52
+ * because the route contract requires fields the generic draft does not carry
53
+ * (`tokenizedCard`, `agencyAccount`, bank-transfer instructions, etc.).
54
+ */
55
+ export function buildCommitPaymentIntent(draft) {
56
+ if (draft.payment.intent === "hold")
57
+ return { type: "hold" };
58
+ throw new Error(`Unsupported booking payment intent: ${draft.payment.intent}`);
59
+ }
45
60
  export function isStepVisible(step, shape) {
46
61
  const subSteps = shape.configureSubSteps ?? [];
47
62
  switch (step) {
@@ -1 +1 @@
1
- {"version":3,"file":"booking-journey.d.ts","sourceRoot":"","sources":["../../../src/journey/components/booking-journey.tsx"],"names":[],"mappings":"AAgCA,OAAO,EACL,KAAK,mBAAmB,EAIzB,MAAM,aAAa,CAAA;AA6BpB,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,KAAK,CAAC,YAAY,CAkwB7E"}
1
+ {"version":3,"file":"booking-journey.d.ts","sourceRoot":"","sources":["../../../src/journey/components/booking-journey.tsx"],"names":[],"mappings":"AAgCA,OAAO,EACL,KAAK,mBAAmB,EAIzB,MAAM,aAAa,CAAA;AA8BpB,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,KAAK,CAAC,YAAY,CA4wB7E"}
@@ -8,7 +8,7 @@ import { useBookingsUiMessagesOrDefault } from "../../i18n/index.js";
8
8
  import { emptyDraft, totalPax } from "../lib/draft-state.js";
9
9
  import { findPaidScheduleRowsMissingPaymentDate } from "../lib/payment-schedule.js";
10
10
  import { JOURNEY_STEP_ORDER, } from "../types.js";
11
- import { buildCommitParty, canAdvanceFromStep, defaultMinimalShape, isStepVisible, makeHoldSignature, resolveInitialStatus, stackedStepComplete, warningsForStep, } from "./booking-journey-rules.js";
11
+ import { buildCommitParty, buildCommitPaymentIntent, canAdvanceFromStep, defaultMinimalShape, isStepVisible, makeHoldSignature, resolveInitialStatus, stackedStepComplete, warningsForStep, } from "./booking-journey-rules.js";
12
12
  import { ConfigureStepSkeleton } from "./configure-step-skeleton.js";
13
13
  import { ContractPreviewDialog } from "./contract-preview-dialog.js";
14
14
  import { AccommodationStep, AddonsStep, BillingStep, DepartureStep, DocumentsStep, FinalizeControls, OptionsStep, PaymentStep, ReviewStep, TravelersStep, } from "./journey-steps.js";
@@ -180,6 +180,7 @@ export function BookingJourney(props) {
180
180
  (quote.data.available === false ||
181
181
  (quote.data.invalidReason != null && quote.data.invalidReason !== ""));
182
182
  const quoteBlocked = hasQuoteError || quoteUnpriceable;
183
+ const quoteReady = Boolean(quote.data?.quoteId);
183
184
  // Step navigation only hard-blocks on a thrown quote error (a transient fetch
184
185
  // failure that a retry fixes). An un-priceable quote (e.g. `rates_missing`
185
186
  // from a preselected room) is *corrected by navigating* — often the room/rate
@@ -194,7 +195,9 @@ export function BookingJourney(props) {
194
195
  stackedSteps[stackedSteps.length - 1] ??
195
196
  stackedSteps[0] ??
196
197
  "departure", [stackedSteps, draft, shape, available]);
197
- const canCommit = useMemo(() => stackedSteps.every((s) => canAdvanceFromStep(s, draft, shape, available)) && !quoteBlocked, [stackedSteps, draft, shape, available, quoteBlocked]);
198
+ const canCommit = useMemo(() => stackedSteps.every((s) => canAdvanceFromStep(s, draft, shape, available)) &&
199
+ quoteReady &&
200
+ !quoteBlocked, [stackedSteps, draft, shape, available, quoteReady, quoteBlocked]);
198
201
  const [isAdvanceGuardPending, setIsAdvanceGuardPending] = useState(false);
199
202
  const [advanceGuardError, setAdvanceGuardError] = useState(null);
200
203
  // Set when Confirm can't proceed because there's no valid quote — makes the
@@ -278,8 +281,12 @@ export function BookingJourney(props) {
278
281
  return contractConfig.resolveVariables({ draft, pricing: quote.data?.pricing ?? null });
279
282
  }, [contractConfig, draft, quote.data?.pricing]);
280
283
  const commitDraft = async () => {
281
- if (!quote.data?.quoteId)
284
+ if (!quote.data?.quoteId || quoteBlocked) {
285
+ setConfirmError(quoteUnpriceable
286
+ ? messages.bookingJourney.validation.pricingUnavailable
287
+ : messages.bookingJourney.validation.quoteUnavailable);
282
288
  return;
289
+ }
283
290
  await commit.mutateAsync({
284
291
  draft: { ...draft, quoteId: quote.data.quoteId },
285
292
  quoteId: quote.data.quoteId,
@@ -287,7 +294,7 @@ export function BookingJourney(props) {
287
294
  // draft — without this the create rejects with "no billing person/org".
288
295
  party: buildCommitParty(draft),
289
296
  initialStatus: resolveInitialStatus(draft),
290
- paymentIntent: { type: draft.payment.intent === "card" ? "card" : "hold" },
297
+ paymentIntent: buildCommitPaymentIntent(draft),
291
298
  });
292
299
  };
293
300
  const handleAccepted = async (acceptance) => {
@@ -431,7 +438,7 @@ export function BookingJourney(props) {
431
438
  // Disable Confirm when the live quote can't be priced (error or
432
439
  // rates_missing) so contract acceptance / commit never fires
433
440
  // against an unpriced booking (#2638).
434
- canConfirm: !quoteBlocked, renderExtras: props.renderReviewExtras, surface: surface, pricing: quote.data?.pricing ?? null })) : null, warnings.length > 0 ? (_jsx("ul", { className: "space-y-1 rounded-md border border-amber-300 bg-amber-50 p-3 text-amber-900 text-sm dark:border-amber-700 dark:bg-amber-950 dark:text-amber-100", children: warnings.map((w) => (_jsxs("li", { children: ["\u26A0 ", w] }, w))) })) : null, _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Button, { type: "button", variant: "outline", disabled: isAdvanceGuardPending, onClick: () => {
441
+ canConfirm: quoteReady && !quoteBlocked, renderExtras: props.renderReviewExtras, surface: surface, pricing: quote.data?.pricing ?? null })) : null, warnings.length > 0 ? (_jsx("ul", { className: "space-y-1 rounded-md border border-amber-300 bg-amber-50 p-3 text-amber-900 text-sm dark:border-amber-700 dark:bg-amber-950 dark:text-amber-100", children: warnings.map((w) => (_jsxs("li", { children: ["\u26A0 ", w] }, w))) })) : null, _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Button, { type: "button", variant: "outline", disabled: isAdvanceGuardPending, onClick: () => {
435
442
  if (prev)
436
443
  goBack();
437
444
  else
@@ -1 +1 @@
1
- {"version":3,"file":"review-step.d.ts","sourceRoot":"","sources":["../../../../src/journey/components/journey-steps/review-step.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAOrD,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,UAAU,EACV,YAAY,EACZ,OAAO,EACP,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,KAAK,CAAA;IACZ,QAAQ,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,IAAI,CAAA;IAC/B,YAAY,EAAE,OAAO,CAAA;IACrB,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,QAAQ,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IAChC;;;sCAGkC;IAClC,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,KAAK,CAAC,SAAS,CAAA;IACpC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;IAC5B,uEAAuE;IACvE,OAAO,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;CACrD,GAAG,KAAK,CAAC,YAAY,CAiErB"}
1
+ {"version":3,"file":"review-step.d.ts","sourceRoot":"","sources":["../../../../src/journey/components/journey-steps/review-step.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAOrD,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,UAAU,EACV,YAAY,EACZ,OAAO,EACP,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,KAAK,CAAA;IACZ,QAAQ,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,IAAI,CAAA;IAC/B,YAAY,EAAE,OAAO,CAAA;IACrB,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,QAAQ,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IAChC;;;sCAGkC;IAClC,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,KAAK,CAAC,SAAS,CAAA;IACpC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;IAC5B,uEAAuE;IACvE,OAAO,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;CACrD,GAAG,KAAK,CAAC,YAAY,CAqErB"}
@@ -14,5 +14,9 @@ import { JourneyWarnings } from "./shared.js";
14
14
  export function ReviewStep({ draft, setDraft, isCommitting, onConfirm, canConfirm, renderExtras, surface, warnings, }) {
15
15
  const messages = useBookingsUiMessagesOrDefault();
16
16
  const isPublic = surface === "public";
17
- return (_jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: messages.bookingJourney.review.title }) }), _jsx(Separator, {}), _jsxs(CardContent, { className: "space-y-4", children: [_jsxs("div", { children: [_jsx("div", { className: "font-medium", children: messages.bookingJourney.review.leadContact }), _jsxs("div", { className: "text-muted-foreground text-sm", children: [draft.billing.contact.firstName, " ", draft.billing.contact.lastName, " \u00B7", " ", draft.billing.contact.email] })] }), _jsxs("div", { children: [_jsx("div", { className: "font-medium", children: messages.bookingJourney.review.travelers }), _jsx("ul", { className: "text-muted-foreground text-sm", children: draft.travelers.map((t, i) => (_jsxs("li", { children: [t.firstName, " ", t.lastName, " (", t.band, ")"] }, t.rowId ?? i))) })] }), isPublic ? (_jsxs("div", { className: "space-y-1", children: [_jsx(Label, { htmlFor: "bj-customer-notes", children: messages.bookingJourney.review.customerNotes }), _jsx(Textarea, { id: "bj-customer-notes", placeholder: messages.bookingJourney.review.customerNotesPlaceholder, value: draft.customerNotes ?? "", onChange: (e) => setDraft({ ...draft, customerNotes: e.target.value }) })] })) : null, renderExtras ? _jsx("div", { children: renderExtras() }) : null, _jsx(JourneyWarnings, { warnings: warnings }), _jsxs("div", { className: "space-y-2", children: [_jsx(Button, { onClick: onConfirm, disabled: isCommitting || canConfirm === false, children: isCommitting ? (_jsxs(_Fragment, { children: [_jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }), messages.bookingJourney.review.confirming] })) : (messages.bookingJourney.review.confirmBooking) }), canConfirm === false ? (_jsx("p", { className: "text-muted-foreground text-sm", children: messages.bookingJourney.review.completeToConfirm })) : null] })] })] }));
17
+ const leadName = (draft.billing.buyerType === "B2B" ? draft.billing.company?.name : undefined) ||
18
+ [draft.billing.contact.firstName, draft.billing.contact.lastName].filter(Boolean).join(" ") ||
19
+ messages.bookingJourney.values.noValue;
20
+ const leadEmail = draft.billing.contact.email || messages.bookingJourney.values.noValue;
21
+ return (_jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: messages.bookingJourney.review.title }) }), _jsx(Separator, {}), _jsxs(CardContent, { className: "space-y-4", children: [_jsxs("div", { children: [_jsx("div", { className: "font-medium", children: messages.bookingJourney.review.leadContact }), _jsxs("div", { className: "text-muted-foreground text-sm", children: [leadName, " \u00B7 ", leadEmail] })] }), _jsxs("div", { children: [_jsx("div", { className: "font-medium", children: messages.bookingJourney.review.travelers }), _jsx("ul", { className: "text-muted-foreground text-sm", children: draft.travelers.map((t, i) => (_jsxs("li", { children: [t.firstName, " ", t.lastName, " (", t.band, ")"] }, t.rowId ?? i))) })] }), isPublic ? (_jsxs("div", { className: "space-y-1", children: [_jsx(Label, { htmlFor: "bj-customer-notes", children: messages.bookingJourney.review.customerNotes }), _jsx(Textarea, { id: "bj-customer-notes", placeholder: messages.bookingJourney.review.customerNotesPlaceholder, value: draft.customerNotes ?? "", onChange: (e) => setDraft({ ...draft, customerNotes: e.target.value }) })] })) : null, renderExtras ? _jsx("div", { children: renderExtras() }) : null, _jsx(JourneyWarnings, { warnings: warnings }), _jsxs("div", { className: "space-y-2", children: [_jsx(Button, { onClick: onConfirm, disabled: isCommitting || canConfirm === false, children: isCommitting ? (_jsxs(_Fragment, { children: [_jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }), messages.bookingJourney.review.confirming] })) : (messages.bookingJourney.review.confirmBooking) }), canConfirm === false ? (_jsx("p", { className: "text-muted-foreground text-sm", children: messages.bookingJourney.review.completeToConfirm })) : null] })] })] }));
18
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"side-panel.d.ts","sourceRoot":"","sources":["../../../src/journey/components/side-panel.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAiB,8BAA8B,EAAE,MAAM,qBAAqB,CAAA;AACnF,OAAO,KAAK,EAAwB,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEpF;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,SAAS,EACT,aAAa,EACb,aAAa,EACb,WAAW,EACX,KAAK,EACL,KAAK,EACL,KAAK,EACL,SAAS,EACT,aAAa,GACd,EAAE,cAAc,GAAG;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;kDAC8C;IAC9C,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAChC,GAAG,KAAK,CAAC,YAAY,CA2FrB;AAoFD,wBAAgB,YAAY,CAC1B,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,WAAW,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,EAC3C,QAAQ,EAAE,UAAU,CAAC,OAAO,8BAA8B,CAAC,GAC1D,MAAM,CAgER"}
1
+ {"version":3,"file":"side-panel.d.ts","sourceRoot":"","sources":["../../../src/journey/components/side-panel.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAiB,8BAA8B,EAAE,MAAM,qBAAqB,CAAA;AACnF,OAAO,KAAK,EAAwB,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEpF;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,SAAS,EACT,aAAa,EACb,aAAa,EACb,WAAW,EACX,KAAK,EACL,KAAK,EACL,KAAK,EACL,SAAS,EACT,aAAa,GACd,EAAE,cAAc,GAAG;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;kDAC8C;IAC9C,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAChC,GAAG,KAAK,CAAC,YAAY,CA2FrB;AAoFD,wBAAgB,YAAY,CAC1B,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,WAAW,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,EAC3C,QAAQ,EAAE,UAAU,CAAC,OAAO,8BAA8B,CAAC,GAC1D,MAAM,CAkER"}
@@ -80,7 +80,8 @@ export function stepHeadline(step, draft, messages) {
80
80
  case "billing": {
81
81
  const c = draft.billing.contact;
82
82
  const name = [c.firstName, c.lastName].filter(Boolean).join(" ").trim();
83
- return name || c.email || messages.bookingJourney.values.notSet;
83
+ const companyName = draft.billing.buyerType === "B2B" ? draft.billing.company?.name?.trim() : undefined;
84
+ return companyName || name || c.email || messages.bookingJourney.values.notSet;
84
85
  }
85
86
  case "travelers": {
86
87
  const filled = draft.travelers.filter((t) => t.firstName && t.lastName).length;
@@ -161,8 +162,9 @@ function BillingDetails({ draft, }) {
161
162
  const c = draft.billing.contact;
162
163
  const a = draft.billing.address;
163
164
  const addressLine = [a.line1, a.line2, a.city, a.postal, a.country].filter(Boolean).join(", ");
164
- return (_jsxs("dl", { className: "space-y-1 text-xs", children: [_jsx(Row, { label: messages.bookingJourney.sidePanel.name, value: [c.firstName, c.lastName].filter(Boolean).join(" ") ||
165
- messages.bookingJourney.values.noValue }), _jsx(Row, { label: messages.bookingJourney.sidePanel.email, value: c.email || messages.bookingJourney.values.noValue }), c.phone ? _jsx(Row, { label: messages.bookingJourney.sidePanel.phone, value: c.phone }) : null, _jsx(Row, { label: messages.bookingJourney.sidePanel.buyer, value: draft.billing.buyerType === "B2B"
165
+ const contactName = (draft.billing.buyerType === "B2B" ? draft.billing.company?.name : undefined) ||
166
+ [c.firstName, c.lastName].filter(Boolean).join(" ");
167
+ return (_jsxs("dl", { className: "space-y-1 text-xs", children: [_jsx(Row, { label: messages.bookingJourney.sidePanel.name, value: contactName || messages.bookingJourney.values.noValue }), _jsx(Row, { label: messages.bookingJourney.sidePanel.email, value: c.email || messages.bookingJourney.values.noValue }), c.phone ? _jsx(Row, { label: messages.bookingJourney.sidePanel.phone, value: c.phone }) : null, _jsx(Row, { label: messages.bookingJourney.sidePanel.buyer, value: draft.billing.buyerType === "B2B"
166
168
  ? messages.bookingJourney.sidePanel.company
167
169
  : messages.bookingJourney.sidePanel.individual }), draft.billing.buyerType === "B2B" && draft.billing.company?.name ? (_jsx(Row, { label: messages.bookingJourney.sidePanel.company, value: draft.billing.company.name })) : null, draft.billing.buyerType === "B2B" && draft.billing.company?.vatId ? (_jsx(Row, { label: messages.bookingJourney.sidePanel.vat, value: draft.billing.company.vatId })) : null, addressLine ? (_jsx(Row, { label: messages.bookingJourney.sidePanel.address, value: addressLine })) : null] }));
168
170
  }
@@ -1 +1 @@
1
- {"version":3,"file":"draft-state.d.ts","sourceRoot":"","sources":["../../../src/journey/lib/draft-state.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2DAA2D,CAAA;AAE/F,MAAM,MAAM,KAAK,GAAG,cAAc,CAAA;AAElC,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAA;IACd,EAAE,EAAE,MAAM,CAAA;IACV;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAA;IAClB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,wBAAgB,UAAU,CACxB,MAAM,EAAE,mBAAmB,EAC3B,QAAQ,GAAE;IAAE,SAAS,CAAC,EAAE,KAAK,GAAG,KAAK,CAAA;CAAO,GAC3C,KAAK,CAaP;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,GAAG,KAAK,CAEtF;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,GAAG,KAAK,CAElF;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,CAcjF;AAED,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,GAAG,OAAO,CAE7F;AAED,w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AW,CAAC,CAAC,GAAG,KAAK,CAEtF;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,GAAG,KAAK,CAElF;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,CAiBjF;AAED,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,GAAG,OAAO,CAE7F;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,KAAK,CAK9E;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,WAAW,CAAC,GAAG,KAAK,CAE/E;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,CAAC,eAAe,CAAC,GAAG,KAAK,CAE3F;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,KAAK,CAEtE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,GAAG,KAAK,CAEzE;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAM7C"}
@@ -38,7 +38,10 @@ export function setBillingBuyerType(draft, buyerType) {
38
38
  },
39
39
  };
40
40
  }
41
- return patchBilling(draft, { buyerType });
41
+ return patchBilling(draft, {
42
+ buyerType,
43
+ contact: { firstName: "", lastName: "", email: "" },
44
+ });
42
45
  }
43
46
  export function canCopyBillingContactToTraveler(contact) {
44
47
  return Boolean(contact.firstName || contact.lastName || contact.email || contact.phone);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voyant-travel/bookings-react",
3
- "version": "0.138.8",
3
+ "version": "0.138.10",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -140,16 +140,16 @@
140
140
  "peerDependencies": {
141
141
  "@tanstack/react-query": "^5.0.0",
142
142
  "@tanstack/react-table": "^8.0.0",
143
- "lucide-react": "^0.475.0",
143
+ "lucide-react": "^1.23.0",
144
144
  "react": "^19.0.0",
145
145
  "react-dom": "^19.0.0",
146
146
  "react-hook-form": "^7.80.0",
147
147
  "zod": "^4.0.0",
148
148
  "@voyant-travel/admin": "^0.115.3",
149
- "@voyant-travel/bookings": "^0.138.8",
150
- "@voyant-travel/catalog-react": "^0.136.3",
149
+ "@voyant-travel/bookings": "^0.138.10",
150
+ "@voyant-travel/catalog-react": "^0.136.4",
151
151
  "@voyant-travel/distribution-react": "^0.128.4",
152
- "@voyant-travel/relationships-react": "^0.138.1",
152
+ "@voyant-travel/relationships-react": "^0.138.2",
153
153
  "@voyant-travel/finance-react": "^0.138.9",
154
154
  "@voyant-travel/identity-react": "^0.138.3",
155
155
  "@voyant-travel/legal-react": "^0.138.2",
@@ -214,7 +214,7 @@
214
214
  "@tanstack/react-table": "^8.21.3",
215
215
  "@types/react": "^19.2.17",
216
216
  "@types/react-dom": "^19.2.3",
217
- "lucide-react": "^0.475.0",
217
+ "lucide-react": "^1.23.0",
218
218
  "react": "^19.2.7",
219
219
  "react-dom": "^19.2.7",
220
220
  "react-hook-form": "^7.80.0",
@@ -223,10 +223,10 @@
223
223
  "vitest": "^4.1.9",
224
224
  "zod": "^4.4.3",
225
225
  "@voyant-travel/admin": "^0.115.3",
226
- "@voyant-travel/bookings": "^0.138.8",
227
- "@voyant-travel/catalog-react": "^0.136.3",
226
+ "@voyant-travel/bookings": "^0.138.10",
227
+ "@voyant-travel/catalog-react": "^0.136.4",
228
228
  "@voyant-travel/distribution-react": "^0.128.4",
229
- "@voyant-travel/relationships-react": "^0.138.1",
229
+ "@voyant-travel/relationships-react": "^0.138.2",
230
230
  "@voyant-travel/finance-react": "^0.138.9",
231
231
  "@voyant-travel/identity-react": "^0.138.3",
232
232
  "@voyant-travel/legal-react": "^0.138.2",