@voyant-travel/bookings-react 0.138.6 → 0.138.7

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.
@@ -44,7 +44,7 @@ export function BookingJourneyHost({ entityModule, entityId, sourceKind, sourceC
44
44
  });
45
45
  const slots = {
46
46
  renderLeadContactPicker({ apply, buyerType }) {
47
- return _jsx(CrmLeadPicker, { apply: apply, buyerType: buyerType });
47
+ return _jsx(CrmLeadPicker, { apply: apply, buyerType: buyerType }, buyerType);
48
48
  },
49
49
  renderBillingExtras(ctx) {
50
50
  // Warn if the picked lead already booked this departure.
@@ -18,17 +18,102 @@ export declare function useBooking(id: string | null | undefined, options?: UseB
18
18
  internalNotes: string | null;
19
19
  createdAt: string;
20
20
  updatedAt: string;
21
- startsAt?: string | null | undefined;
22
- endsAt?: string | null | undefined;
23
- items?: {
21
+ items: {
24
22
  id: string;
23
+ bookingId: string;
25
24
  title: string;
26
- itemType: string;
25
+ description: string | null;
26
+ itemType: "other" | "unit" | "extra" | "service" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
27
+ status: "draft" | "cancelled" | "fulfilled" | "on_hold" | "confirmed" | "expired";
28
+ serviceDate: string | null;
29
+ startsAt: string | null;
30
+ endsAt: string | null;
31
+ quantity: number;
32
+ sellCurrency: string;
33
+ unitSellAmountCents: number | null;
34
+ totalSellAmountCents: number | null;
35
+ costCurrency: string | null;
36
+ unitCostAmountCents: number | null;
37
+ totalCostAmountCents: number | null;
38
+ notes: string | null;
27
39
  productId: string | null;
28
- productName?: string | null | undefined;
29
- startsAt?: string | null | undefined;
30
- endsAt?: string | null | undefined;
31
- }[] | undefined;
40
+ optionId: string | null;
41
+ optionUnitId: string | null;
42
+ pricingCategoryId: string | null;
43
+ availabilitySlotId: string | null;
44
+ createdAt: string;
45
+ updatedAt: string;
46
+ productNameSnapshot?: string | null | undefined;
47
+ optionNameSnapshot?: string | null | undefined;
48
+ unitNameSnapshot?: string | null | undefined;
49
+ departureLabelSnapshot?: string | null | undefined;
50
+ }[];
51
+ travelers: ({
52
+ id: string;
53
+ bookingId: string;
54
+ participantType: string;
55
+ firstName: string;
56
+ lastName: string;
57
+ email: string | null;
58
+ phone: string | null;
59
+ specialRequests: string | null;
60
+ isPrimary: boolean;
61
+ createdAt: string;
62
+ travelerCategory?: string | null | undefined;
63
+ personId?: string | null | undefined;
64
+ preferredLanguage?: string | null | undefined;
65
+ notes?: string | null | undefined;
66
+ updatedAt?: string | undefined;
67
+ } | {
68
+ id: string;
69
+ bookingId: string;
70
+ participantType: string;
71
+ firstName: string;
72
+ lastName: string;
73
+ email: string | null;
74
+ phone: string | null;
75
+ specialRequests: string | null;
76
+ isPrimary: boolean;
77
+ createdAt: string;
78
+ travelDetails: {
79
+ travelerId: string;
80
+ nationality: string | null;
81
+ documentType: "other" | "passport" | "id_card" | "driver_license" | "visa" | null;
82
+ documentNumber: string | null;
83
+ documentExpiry: string | null;
84
+ documentIssuingCountry: string | null;
85
+ documentIssuingAuthority: string | null;
86
+ documentPersonDocumentId: string | null;
87
+ dateOfBirth: string | null;
88
+ dietaryRequirements: string | null;
89
+ accessibilityNeeds: string | null;
90
+ isLeadTraveler: boolean;
91
+ sharingGroupId: string | null;
92
+ roomTypeId: string | null;
93
+ bedPreference: "double" | "single" | "twin" | "no-preference" | null;
94
+ allocations: Record<string, string>;
95
+ createdAt: string;
96
+ updatedAt: string;
97
+ } | null;
98
+ travelerCategory?: string | null | undefined;
99
+ personId?: string | null | undefined;
100
+ preferredLanguage?: string | null | undefined;
101
+ notes?: string | null | undefined;
102
+ updatedAt?: string | undefined;
103
+ })[];
104
+ documents: {
105
+ id: string;
106
+ bookingId: string;
107
+ travelerId: string | null;
108
+ type: "other" | "visa" | "insurance" | "health" | "passport_copy";
109
+ fileName: string;
110
+ fileUrl: string;
111
+ expiresAt: string | null;
112
+ notes: string | null;
113
+ createdAt: string;
114
+ }[];
115
+ startsAt?: string | null | undefined;
116
+ endsAt?: string | null | undefined;
32
117
  communicationLanguage?: string | null | undefined;
33
118
  contactFirstName?: string | null | undefined;
34
119
  contactLastName?: string | null | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"use-booking.d.ts","sourceRoot":"","sources":["../../src/hooks/use-booking.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,OAAO,GAAE,iBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAQxF"}
1
+ {"version":3,"file":"use-booking.d.ts","sourceRoot":"","sources":["../../src/hooks/use-booking.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,OAAO,GAAE,iBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAQxF"}
@@ -105,7 +105,7 @@ export declare function usePublicBookingSessionFlowMutation(sessionId: string):
105
105
  availabilitySlotId: string | null;
106
106
  quantity: number;
107
107
  allocationType: "resource" | "unit" | "pickup";
108
- status: "cancelled" | "fulfilled" | "confirmed" | "expired" | "released" | "held";
108
+ status: "cancelled" | "fulfilled" | "confirmed" | "expired" | "held" | "released";
109
109
  holdExpiresAt: string | null;
110
110
  confirmedAt: string | null;
111
111
  releasedAt: string | null;
@@ -69,7 +69,7 @@ export declare function usePublicBookingSession(sessionId: string | null | undef
69
69
  availabilitySlotId: string | null;
70
70
  quantity: number;
71
71
  allocationType: "resource" | "unit" | "pickup";
72
- status: "cancelled" | "fulfilled" | "confirmed" | "expired" | "released" | "held";
72
+ status: "cancelled" | "fulfilled" | "confirmed" | "expired" | "held" | "released";
73
73
  holdExpiresAt: string | null;
74
74
  confirmedAt: string | null;
75
75
  releasedAt: string | null;
@@ -106,7 +106,7 @@ export const bookingsUiEnJourney = {
106
106
  decrease: "Decrease {label}",
107
107
  increase: "Increase {label}",
108
108
  empty: "Pick traveler counts in the Configure step to start adding details.",
109
- addTraveler: "Add traveler",
109
+ addTraveler: "Add another traveler",
110
110
  travelerType: "Traveler type",
111
111
  travelerNumber: "Traveler {number}",
112
112
  ageLabel: "age {age}",
@@ -106,7 +106,7 @@ export const bookingsUiRoJourney = {
106
106
  decrease: "Scade {label}",
107
107
  increase: "Adauga {label}",
108
108
  empty: "Alege numarul de calatori in pasul Configurare pentru a adauga detalii.",
109
- addTraveler: "Adauga calator",
109
+ addTraveler: "Adauga inca un calator",
110
110
  travelerType: "Tip calator",
111
111
  travelerNumber: "Calator {number}",
112
112
  ageLabel: "varsta {age}",
@@ -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;AAE5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAmBtE;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,CAyDT;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,iBAAiB,EACxB,SAAS,EAAE,OAAO,GACjB,OAAO,CAYT;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,CAmDvB;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,KAAK,EAAY,MAAM,uBAAuB,CAAA;AAE5D,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,CAyDT;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,iBAAiB,EACxB,SAAS,EAAE,OAAO,GACjB,OAAO,CAYT;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,CAmDvB;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"}
@@ -10,12 +10,13 @@ import { evaluatePaxBandDependencies } from "../lib/pax-band-dependencies.js";
10
10
  */
11
11
  export function buildCommitParty(draft) {
12
12
  const c = draft.billing.contact;
13
+ const organizationId = draft.billing.buyerType === "B2B" ? draft.billing.organizationId : undefined;
13
14
  return {
14
15
  personId: c.personId,
15
- organizationId: draft.billing.organizationId,
16
+ organizationId,
16
17
  billing: {
17
18
  personId: c.personId,
18
- organizationId: draft.billing.organizationId,
19
+ organizationId,
19
20
  contact: {
20
21
  firstName: c.firstName,
21
22
  lastName: c.lastName,
@@ -1 +1 @@
1
- {"version":3,"file":"booking-journey.d.ts","sourceRoot":"","sources":["../../../src/journey/components/booking-journey.tsx"],"names":[],"mappings":"AA+BA,OAAO,EACL,KAAK,mBAAmB,EAIzB,MAAM,aAAa,CAAA;AA6BpB,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,KAAK,CAAC,YAAY,CA6vB7E"}
1
+ {"version":3,"file":"booking-journey.d.ts","sourceRoot":"","sources":["../../../src/journey/components/booking-journey.tsx"],"names":[],"mappings":"AA+BA,OAAO,EACL,KAAK,mBAAmB,EAIzB,MAAM,aAAa,CAAA;AA6BpB,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,KAAK,CAAC,YAAY,CA8vB7E"}
@@ -356,7 +356,7 @@ export function BookingJourney(props) {
356
356
  ? () => props.renderBillingExtras?.({
357
357
  buyerType: draft.billing.buyerType,
358
358
  personId: draft.billing.contact.personId,
359
- organizationId: draft.billing.organizationId,
359
+ organizationId: draft.billing.buyerType === "B2B" ? draft.billing.organizationId : undefined,
360
360
  productId: props.entityId,
361
361
  departureSlotId: draft.configure.departureSlotId,
362
362
  departureDate: draft.configure.departureDate,
@@ -6,7 +6,7 @@ import { CountryCombobox } from "@voyant-travel/ui/components/country-combobox";
6
6
  import { Label } from "@voyant-travel/ui/components/label";
7
7
  import { RadioGroup, RadioGroupItem } from "@voyant-travel/ui/components/radio-group";
8
8
  import { useBookingsUiMessagesOrDefault } from "../../../i18n/index.js";
9
- import { patchBilling } from "../../lib/draft-state.js";
9
+ import { patchBilling, setBillingBuyerType } from "../../lib/draft-state.js";
10
10
  import { Field, JourneyWarnings, PhoneField } from "./shared.js";
11
11
  // ─────────────────────────────────────────────────────────────────
12
12
  // Billing
@@ -46,7 +46,7 @@ export function BillingStep({ draft, setDraft, renderLeadContactPicker, renderEx
46
46
  }
47
47
  setDraft(patchBilling(draft, patch));
48
48
  };
49
- return (_jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: messages.bookingJourney.billing.title }) }), _jsx(Separator, {}), _jsxs(CardContent, { className: "space-y-6", children: [_jsxs("div", { className: "space-y-2", children: [_jsx(Label, { children: messages.bookingJourney.billing.buyerType }), _jsxs(RadioGroup, { value: billing.buyerType, onValueChange: (v) => setDraft(patchBilling(draft, { buyerType: v })), className: "flex gap-4", children: [_jsxs("label", { className: "flex items-center gap-2 text-sm", children: [_jsx(RadioGroupItem, { value: "B2C" }), " ", messages.bookingJourney.billing.individual] }), _jsxs("label", { className: "flex items-center gap-2 text-sm", children: [_jsx(RadioGroupItem, { value: "B2B" }), " ", messages.bookingJourney.billing.company] })] })] }), renderLeadContactPicker ? (_jsx("div", { children: renderLeadContactPicker({ apply, buyerType: billing.buyerType }) })) : null, renderLeadContactPicker ? null : (_jsxs(_Fragment, { children: [_jsxs("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-2", children: [_jsx(Field, { id: "bj-billing-firstName", label: messages.bookingJourney.billing.firstName, value: billing.contact.firstName, onChange: (v) => setDraft(patchBilling(draft, {
49
+ return (_jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: messages.bookingJourney.billing.title }) }), _jsx(Separator, {}), _jsxs(CardContent, { className: "space-y-6", children: [_jsxs("div", { className: "space-y-2", children: [_jsx(Label, { children: messages.bookingJourney.billing.buyerType }), _jsxs(RadioGroup, { value: billing.buyerType, onValueChange: (v) => setDraft(setBillingBuyerType(draft, v)), className: "flex gap-4", children: [_jsxs("label", { className: "flex items-center gap-2 text-sm", children: [_jsx(RadioGroupItem, { value: "B2C" }), " ", messages.bookingJourney.billing.individual] }), _jsxs("label", { className: "flex items-center gap-2 text-sm", children: [_jsx(RadioGroupItem, { value: "B2B" }), " ", messages.bookingJourney.billing.company] })] })] }), renderLeadContactPicker ? (_jsx("div", { children: renderLeadContactPicker({ apply, buyerType: billing.buyerType }) })) : null, renderLeadContactPicker ? null : (_jsxs(_Fragment, { children: [_jsxs("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-2", children: [_jsx(Field, { id: "bj-billing-firstName", label: messages.bookingJourney.billing.firstName, value: billing.contact.firstName, onChange: (v) => setDraft(patchBilling(draft, {
50
50
  contact: { ...billing.contact, firstName: v },
51
51
  })) }), _jsx(Field, { id: "bj-billing-lastName", label: messages.bookingJourney.billing.lastName, value: billing.contact.lastName, onChange: (v) => setDraft(patchBilling(draft, {
52
52
  contact: { ...billing.contact, lastName: v },
@@ -164,7 +164,7 @@ function BillingDetails({ draft, }) {
164
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
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"
166
166
  ? messages.bookingJourney.sidePanel.company
167
- : messages.bookingJourney.sidePanel.individual }), draft.billing.company?.name ? (_jsx(Row, { label: messages.bookingJourney.sidePanel.company, value: draft.billing.company.name })) : null, 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] }));
167
+ : 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
168
  }
169
169
  function TravelersDetails({ draft, }) {
170
170
  const messages = useBookingsUiMessagesOrDefault();
@@ -25,6 +25,7 @@ export declare function emptyDraft(entity: DraftEntityIdentity, defaults?: {
25
25
  }): Draft;
26
26
  export declare function patchConfigure(draft: Draft, patch: Partial<Draft["configure"]>): Draft;
27
27
  export declare function patchBilling(draft: Draft, patch: Partial<Draft["billing"]>): Draft;
28
+ export declare function setBillingBuyerType(draft: Draft, buyerType: "B2C" | "B2B"): Draft;
28
29
  export declare function canCopyBillingContactToTraveler(contact: Draft["billing"]["contact"]): boolean;
29
30
  export declare function patchPaxCount(draft: Draft, band: string, count: number): Draft;
30
31
  export declare function setTravelers(draft: Draft, travelers: Draft["travelers"]): Draft;
@@ -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,+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"}
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,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"}
@@ -26,6 +26,20 @@ export function patchConfigure(draft, patch) {
26
26
  export function patchBilling(draft, patch) {
27
27
  return { ...draft, billing: { ...draft.billing, ...patch } };
28
28
  }
29
+ export function setBillingBuyerType(draft, buyerType) {
30
+ if (buyerType === "B2C") {
31
+ const { organizationId: _organizationId, company: _company, ...billing } = draft.billing;
32
+ return {
33
+ ...draft,
34
+ billing: {
35
+ ...billing,
36
+ buyerType,
37
+ address: {},
38
+ },
39
+ };
40
+ }
41
+ return patchBilling(draft, { buyerType });
42
+ }
29
43
  export function canCopyBillingContactToTraveler(contact) {
30
44
  return Boolean(contact.firstName || contact.lastName || contact.email || contact.phone);
31
45
  }