@voyant-travel/storefront 0.120.1
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/LICENSE +201 -0
- package/README.md +231 -0
- package/dist/booking-intents.d.ts +42 -0
- package/dist/booking-intents.d.ts.map +1 -0
- package/dist/booking-intents.js +83 -0
- package/dist/customer-portal/index.d.ts +16 -0
- package/dist/customer-portal/index.d.ts.map +1 -0
- package/dist/customer-portal/index.js +23 -0
- package/dist/customer-portal/route-runtime.d.ts +16 -0
- package/dist/customer-portal/route-runtime.d.ts.map +1 -0
- package/dist/customer-portal/route-runtime.js +27 -0
- package/dist/customer-portal/routes-public.d.ts +1936 -0
- package/dist/customer-portal/routes-public.d.ts.map +1 -0
- package/dist/customer-portal/routes-public.js +165 -0
- package/dist/customer-portal/routes.d.ts +43 -0
- package/dist/customer-portal/routes.d.ts.map +1 -0
- package/dist/customer-portal/routes.js +17 -0
- package/dist/customer-portal/service-public-impl.d.ts +138 -0
- package/dist/customer-portal/service-public-impl.d.ts.map +1 -0
- package/dist/customer-portal/service-public-impl.js +1808 -0
- package/dist/customer-portal/service-public.d.ts +2 -0
- package/dist/customer-portal/service-public.d.ts.map +1 -0
- package/dist/customer-portal/service-public.js +1 -0
- package/dist/customer-portal/validation-public/bookings.d.ts +551 -0
- package/dist/customer-portal/validation-public/bookings.d.ts.map +1 -0
- package/dist/customer-portal/validation-public/bookings.js +132 -0
- package/dist/customer-portal/validation-public/common.d.ts +162 -0
- package/dist/customer-portal/validation-public/common.d.ts.map +1 -0
- package/dist/customer-portal/validation-public/common.js +139 -0
- package/dist/customer-portal/validation-public/profile.d.ts +749 -0
- package/dist/customer-portal/validation-public/profile.d.ts.map +1 -0
- package/dist/customer-portal/validation-public/profile.js +308 -0
- package/dist/customer-portal/validation-public.d.ts +3 -0
- package/dist/customer-portal/validation-public.d.ts.map +1 -0
- package/dist/customer-portal/validation-public.js +2 -0
- package/dist/guest-booking-guard.d.ts +24 -0
- package/dist/guest-booking-guard.d.ts.map +1 -0
- package/dist/guest-booking-guard.js +55 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +41 -0
- package/dist/product-extra-ref.d.ts +238 -0
- package/dist/product-extra-ref.d.ts.map +1 -0
- package/dist/product-extra-ref.js +22 -0
- package/dist/routes-admin.d.ts +220 -0
- package/dist/routes-admin.d.ts.map +1 -0
- package/dist/routes-admin.js +28 -0
- package/dist/routes-public.d.ts +1475 -0
- package/dist/routes-public.d.ts.map +1 -0
- package/dist/routes-public.js +362 -0
- package/dist/service-booking-session-bootstrap.d.ts +227 -0
- package/dist/service-booking-session-bootstrap.d.ts.map +1 -0
- package/dist/service-booking-session-bootstrap.js +287 -0
- package/dist/service-boundary-resource-sql.d.ts +18 -0
- package/dist/service-boundary-resource-sql.d.ts.map +1 -0
- package/dist/service-boundary-resource-sql.js +73 -0
- package/dist/service-boundary-sql.d.ts +103 -0
- package/dist/service-boundary-sql.d.ts.map +1 -0
- package/dist/service-boundary-sql.js +307 -0
- package/dist/service-departures-core.d.ts +41 -0
- package/dist/service-departures-core.d.ts.map +1 -0
- package/dist/service-departures-core.js +92 -0
- package/dist/service-departures-extensions.d.ts +46 -0
- package/dist/service-departures-extensions.d.ts.map +1 -0
- package/dist/service-departures-extensions.js +81 -0
- package/dist/service-departures-offers.d.ts +220 -0
- package/dist/service-departures-offers.d.ts.map +1 -0
- package/dist/service-departures-offers.js +177 -0
- package/dist/service-departures-price-preview.d.ts +306 -0
- package/dist/service-departures-price-preview.d.ts.map +1 -0
- package/dist/service-departures-price-preview.js +383 -0
- package/dist/service-departures-pricing-context.d.ts +115 -0
- package/dist/service-departures-pricing-context.d.ts.map +1 -0
- package/dist/service-departures-pricing-context.js +237 -0
- package/dist/service-departures-pricing.d.ts +5 -0
- package/dist/service-departures-pricing.d.ts.map +1 -0
- package/dist/service-departures-pricing.js +4 -0
- package/dist/service-departures.d.ts +192 -0
- package/dist/service-departures.d.ts.map +1 -0
- package/dist/service-departures.js +213 -0
- package/dist/service-intake.d.ts +130 -0
- package/dist/service-intake.d.ts.map +1 -0
- package/dist/service-intake.js +274 -0
- package/dist/service-transport-eligibility.d.ts +10 -0
- package/dist/service-transport-eligibility.d.ts.map +1 -0
- package/dist/service-transport-eligibility.js +198 -0
- package/dist/service.d.ts +1062 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/service.js +332 -0
- package/dist/transport-eligibility.d.ts +4 -0
- package/dist/transport-eligibility.d.ts.map +1 -0
- package/dist/transport-eligibility.js +2 -0
- package/dist/validation/departures.d.ts +1669 -0
- package/dist/validation/departures.d.ts.map +1 -0
- package/dist/validation/departures.js +397 -0
- package/dist/validation/intake.d.ts +147 -0
- package/dist/validation/intake.d.ts.map +1 -0
- package/dist/validation/intake.js +69 -0
- package/dist/validation/offers.d.ts +340 -0
- package/dist/validation/offers.d.ts.map +1 -0
- package/dist/validation/offers.js +117 -0
- package/dist/validation-settings.d.ts +609 -0
- package/dist/validation-settings.d.ts.map +1 -0
- package/dist/validation-settings.js +235 -0
- package/dist/validation-transport-eligibility.d.ts +314 -0
- package/dist/validation-transport-eligibility.d.ts.map +1 -0
- package/dist/validation-transport-eligibility.js +97 -0
- package/dist/validation.d.ts +6 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +4 -0
- package/dist/verification/index.d.ts +12 -0
- package/dist/verification/index.d.ts.map +1 -0
- package/dist/verification/index.js +18 -0
- package/dist/verification/routes-public.d.ts +121 -0
- package/dist/verification/routes-public.d.ts.map +1 -0
- package/dist/verification/routes-public.js +125 -0
- package/dist/verification/schema.d.ts +273 -0
- package/dist/verification/schema.d.ts.map +1 -0
- package/dist/verification/schema.js +50 -0
- package/dist/verification/service.d.ts +114 -0
- package/dist/verification/service.d.ts.map +1 -0
- package/dist/verification/service.js +283 -0
- package/dist/verification/validation.d.ts +98 -0
- package/dist/verification/validation.d.ts.map +1 -0
- package/dist/verification/validation.js +54 -0
- package/package.json +148 -0
|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EF,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAA;AAC7F,MAAM,MAAM,yCAAyC,GAAG,CAAC,CAAC,KAAK,CAC7D,OAAO,+CAA+C,CACvD,CAAA;AACD,MAAM,MAAM,oCAAoC,GAAG,CAAC,CAAC,KAAK,CACxD,OAAO,0CAA0C,CAClD,CAAA;AACD,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qCAAqC,CAAC,CAAA;AACnG,MAAM,MAAM,sCAAsC,GAAG,CAAC,CAAC,KAAK,CAC1D,OAAO,4CAA4C,CACpD,CAAA;AACD,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CACrD,OAAO,uCAAuC,CAC/C,CAAA"}
|
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
import { extraPricingModeSchema } from "@voyant-travel/bookings/extras";
|
|
2
|
+
import { publicBookingSessionAllocationSchema, publicBookingSessionRepriceSummarySchema, publicBookingSessionSchema, publicCreateBookingSessionSchema, } from "@voyant-travel/bookings/public-validation";
|
|
3
|
+
import { publicBookingPaymentScheduleSchema } from "@voyant-travel/finance/public-validation";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { languageTagSchema } from "../validation-settings.js";
|
|
6
|
+
import { storefrontAppliedOfferSchema, storefrontOfferConflictSchema, storefrontOfferMutationResultSchema, storefrontPromotionalOfferSchema, } from "./offers.js";
|
|
7
|
+
export const storefrontDepartureStatusSchema = z.enum([
|
|
8
|
+
"open",
|
|
9
|
+
"closed",
|
|
10
|
+
"sold_out",
|
|
11
|
+
"cancelled",
|
|
12
|
+
"on_request",
|
|
13
|
+
]);
|
|
14
|
+
const persistedDepartureStatusSchema = z.enum(["open", "closed", "sold_out", "cancelled"]);
|
|
15
|
+
export const storefrontDepartureRoomOccupancySchema = z.object({
|
|
16
|
+
adultsMin: z.number().int().min(0),
|
|
17
|
+
adultsMax: z.number().int().min(0),
|
|
18
|
+
childrenMax: z.number().int().min(0),
|
|
19
|
+
});
|
|
20
|
+
export const storefrontDepartureRoomPriceSchema = z.object({
|
|
21
|
+
amount: z.number(),
|
|
22
|
+
currencyCode: z.string(),
|
|
23
|
+
roomType: z.object({
|
|
24
|
+
id: z.string(),
|
|
25
|
+
name: z.string(),
|
|
26
|
+
occupancy: storefrontDepartureRoomOccupancySchema,
|
|
27
|
+
}),
|
|
28
|
+
});
|
|
29
|
+
export const storefrontDepartureRatePlanSchema = z.object({
|
|
30
|
+
id: z.string(),
|
|
31
|
+
active: z.boolean(),
|
|
32
|
+
name: z.string(),
|
|
33
|
+
pricingModel: z.string(),
|
|
34
|
+
basePrices: z.array(z.object({
|
|
35
|
+
amount: z.number(),
|
|
36
|
+
currencyCode: z.string(),
|
|
37
|
+
})),
|
|
38
|
+
roomPrices: z.array(storefrontDepartureRoomPriceSchema),
|
|
39
|
+
});
|
|
40
|
+
export const storefrontDepartureStartTimeSchema = z.object({
|
|
41
|
+
id: z.string(),
|
|
42
|
+
label: z.string().nullable(),
|
|
43
|
+
startTimeLocal: z.string(),
|
|
44
|
+
durationMinutes: z.number().int().nullable(),
|
|
45
|
+
});
|
|
46
|
+
export const storefrontDepartureSchema = z.object({
|
|
47
|
+
id: z.string(),
|
|
48
|
+
productId: z.string(),
|
|
49
|
+
itineraryId: z.string(),
|
|
50
|
+
optionId: z.string().nullable(),
|
|
51
|
+
dateLocal: z.string().nullable(),
|
|
52
|
+
startAt: z.string().nullable(),
|
|
53
|
+
endAt: z.string().nullable(),
|
|
54
|
+
timezone: z.string(),
|
|
55
|
+
startTime: storefrontDepartureStartTimeSchema.nullable(),
|
|
56
|
+
meetingPoint: z.string().nullable(),
|
|
57
|
+
capacity: z.number().int().nullable(),
|
|
58
|
+
remaining: z.number().int().nullable(),
|
|
59
|
+
departureStatus: storefrontDepartureStatusSchema,
|
|
60
|
+
nights: z.number().int().nullable(),
|
|
61
|
+
days: z.number().int().nullable(),
|
|
62
|
+
ratePlans: z.array(storefrontDepartureRatePlanSchema),
|
|
63
|
+
});
|
|
64
|
+
export const storefrontDepartureListQuerySchema = z.object({
|
|
65
|
+
optionId: z.string().optional(),
|
|
66
|
+
status: persistedDepartureStatusSchema.optional(),
|
|
67
|
+
dateFrom: z.string().date().optional(),
|
|
68
|
+
dateTo: z.string().date().optional(),
|
|
69
|
+
limit: z.coerce.number().int().min(1).max(250).default(100),
|
|
70
|
+
offset: z.coerce.number().int().min(0).default(0),
|
|
71
|
+
});
|
|
72
|
+
export const storefrontDepartureListResponseSchema = z.object({
|
|
73
|
+
data: z.array(storefrontDepartureSchema),
|
|
74
|
+
total: z.number().int(),
|
|
75
|
+
limit: z.number().int(),
|
|
76
|
+
offset: z.number().int(),
|
|
77
|
+
});
|
|
78
|
+
export const storefrontProductAvailabilityStateSchema = z.enum([
|
|
79
|
+
"available",
|
|
80
|
+
"sold_out",
|
|
81
|
+
"closed",
|
|
82
|
+
"cancelled",
|
|
83
|
+
"on_request",
|
|
84
|
+
"past_cutoff",
|
|
85
|
+
"too_early",
|
|
86
|
+
"unavailable",
|
|
87
|
+
]);
|
|
88
|
+
export const storefrontProductAvailabilitySummaryQuerySchema = z.object({
|
|
89
|
+
optionId: z.string().optional(),
|
|
90
|
+
status: storefrontDepartureStatusSchema.optional(),
|
|
91
|
+
dateFrom: z.string().date().optional(),
|
|
92
|
+
dateTo: z.string().date().optional(),
|
|
93
|
+
locale: languageTagSchema.optional(),
|
|
94
|
+
limit: z.coerce.number().int().min(1).max(250).default(100),
|
|
95
|
+
offset: z.coerce.number().int().min(0).default(0),
|
|
96
|
+
});
|
|
97
|
+
export const storefrontProductAvailabilitySlotSchema = z.object({
|
|
98
|
+
id: z.string(),
|
|
99
|
+
productId: z.string(),
|
|
100
|
+
optionId: z.string().nullable(),
|
|
101
|
+
dateLocal: z.string().nullable(),
|
|
102
|
+
startAt: z.string().nullable(),
|
|
103
|
+
endAt: z.string().nullable(),
|
|
104
|
+
timezone: z.string(),
|
|
105
|
+
status: storefrontDepartureStatusSchema,
|
|
106
|
+
availabilityState: storefrontProductAvailabilityStateSchema,
|
|
107
|
+
capacity: z.number().int().nullable(),
|
|
108
|
+
remaining: z.number().int().nullable(),
|
|
109
|
+
pastCutoff: z.boolean(),
|
|
110
|
+
tooEarly: z.boolean(),
|
|
111
|
+
});
|
|
112
|
+
export const storefrontProductAvailabilitySummarySchema = z.object({
|
|
113
|
+
productId: z.string(),
|
|
114
|
+
availabilityState: storefrontProductAvailabilityStateSchema,
|
|
115
|
+
counts: z.object({
|
|
116
|
+
total: z.number().int(),
|
|
117
|
+
open: z.number().int(),
|
|
118
|
+
closed: z.number().int(),
|
|
119
|
+
soldOut: z.number().int(),
|
|
120
|
+
cancelled: z.number().int(),
|
|
121
|
+
onRequest: z.number().int(),
|
|
122
|
+
pastCutoff: z.number().int(),
|
|
123
|
+
tooEarly: z.number().int(),
|
|
124
|
+
available: z.number().int(),
|
|
125
|
+
}),
|
|
126
|
+
departures: z.array(storefrontProductAvailabilitySlotSchema),
|
|
127
|
+
total: z.number().int(),
|
|
128
|
+
limit: z.number().int(),
|
|
129
|
+
offset: z.number().int(),
|
|
130
|
+
});
|
|
131
|
+
export const storefrontProductAvailabilitySummaryResponseSchema = z.object({
|
|
132
|
+
data: storefrontProductAvailabilitySummarySchema,
|
|
133
|
+
});
|
|
134
|
+
export const storefrontDeparturePricePreviewInputSchema = z.object({
|
|
135
|
+
pax: z
|
|
136
|
+
.object({
|
|
137
|
+
adults: z.coerce.number().int().min(0).default(1),
|
|
138
|
+
children: z.coerce.number().int().min(0).default(0),
|
|
139
|
+
infants: z.coerce.number().int().min(0).default(0),
|
|
140
|
+
})
|
|
141
|
+
.default({ adults: 1, children: 0, infants: 0 }),
|
|
142
|
+
currencyCode: z.string().trim().min(1).optional().nullable(),
|
|
143
|
+
rooms: z
|
|
144
|
+
.array(z.object({
|
|
145
|
+
unitId: z.string().trim().min(1),
|
|
146
|
+
occupancy: z.coerce.number().int().min(1).default(1),
|
|
147
|
+
quantity: z.coerce.number().int().min(1).default(1),
|
|
148
|
+
}))
|
|
149
|
+
.default([]),
|
|
150
|
+
extras: z
|
|
151
|
+
.array(z.object({
|
|
152
|
+
extraId: z.string().trim().min(1),
|
|
153
|
+
quantity: z.coerce.number().int().min(1).default(1),
|
|
154
|
+
}))
|
|
155
|
+
.default([]),
|
|
156
|
+
offers: z
|
|
157
|
+
.array(z.object({
|
|
158
|
+
slug: z.string().trim().min(1).max(120),
|
|
159
|
+
}))
|
|
160
|
+
.default([]),
|
|
161
|
+
offerCode: z.string().trim().min(1).max(80).optional().nullable(),
|
|
162
|
+
locale: languageTagSchema.optional(),
|
|
163
|
+
market: z.string().trim().min(1).default("default"),
|
|
164
|
+
});
|
|
165
|
+
export const storefrontDeparturePriceLineItemSchema = z.object({
|
|
166
|
+
name: z.string(),
|
|
167
|
+
total: z.number(),
|
|
168
|
+
quantity: z.number().int().min(1),
|
|
169
|
+
unitPrice: z.number(),
|
|
170
|
+
});
|
|
171
|
+
export const storefrontDeparturePriceSlotSchema = z.object({
|
|
172
|
+
id: z.string(),
|
|
173
|
+
productId: z.string(),
|
|
174
|
+
optionId: z.string().nullable(),
|
|
175
|
+
dateLocal: z.string().nullable(),
|
|
176
|
+
startAt: z.string().nullable(),
|
|
177
|
+
endAt: z.string().nullable(),
|
|
178
|
+
timezone: z.string(),
|
|
179
|
+
status: storefrontDepartureStatusSchema,
|
|
180
|
+
availabilityState: storefrontProductAvailabilityStateSchema,
|
|
181
|
+
capacity: z.number().int().nullable(),
|
|
182
|
+
remaining: z.number().int().nullable(),
|
|
183
|
+
pastCutoff: z.boolean(),
|
|
184
|
+
tooEarly: z.boolean(),
|
|
185
|
+
});
|
|
186
|
+
export const storefrontDeparturePricePaxSchema = z.object({
|
|
187
|
+
adults: z.number().int().min(0),
|
|
188
|
+
children: z.number().int().min(0),
|
|
189
|
+
infants: z.number().int().min(0),
|
|
190
|
+
total: z.number().int().min(1),
|
|
191
|
+
});
|
|
192
|
+
export const storefrontDeparturePriceUnitRowSchema = z.object({
|
|
193
|
+
unitId: z.string().nullable(),
|
|
194
|
+
requestRef: z.string().nullable(),
|
|
195
|
+
name: z.string(),
|
|
196
|
+
unitType: z.string().nullable(),
|
|
197
|
+
quantity: z.number().int().min(1),
|
|
198
|
+
pricingMode: z.string().nullable(),
|
|
199
|
+
unitPrice: z.number(),
|
|
200
|
+
total: z.number(),
|
|
201
|
+
currencyCode: z.string(),
|
|
202
|
+
tierId: z.string().nullable(),
|
|
203
|
+
});
|
|
204
|
+
export const storefrontDeparturePriceRoomRowSchema = z.object({
|
|
205
|
+
unitId: z.string(),
|
|
206
|
+
name: z.string(),
|
|
207
|
+
occupancy: z.number().int().min(1),
|
|
208
|
+
quantity: z.number().int().min(1),
|
|
209
|
+
pax: z.number().int().min(1),
|
|
210
|
+
pricingMode: z.string().nullable(),
|
|
211
|
+
unitPrice: z.number(),
|
|
212
|
+
total: z.number(),
|
|
213
|
+
currencyCode: z.string(),
|
|
214
|
+
tierId: z.string().nullable(),
|
|
215
|
+
});
|
|
216
|
+
export const storefrontDeparturePriceAllocationSchema = z.object({
|
|
217
|
+
slot: storefrontDeparturePriceSlotSchema,
|
|
218
|
+
pax: storefrontDeparturePricePaxSchema,
|
|
219
|
+
requestedUnits: z.array(storefrontDeparturePriceUnitRowSchema),
|
|
220
|
+
rooms: z.array(storefrontDeparturePriceRoomRowSchema),
|
|
221
|
+
});
|
|
222
|
+
export const storefrontDeparturePriceExtraImpactSchema = z.object({
|
|
223
|
+
extraId: z.string(),
|
|
224
|
+
name: z.string(),
|
|
225
|
+
required: z.boolean(),
|
|
226
|
+
selectable: z.boolean(),
|
|
227
|
+
selected: z.boolean(),
|
|
228
|
+
pricingMode: z.lazy(() => extraPricingModeSchema),
|
|
229
|
+
quantity: z.number().int().min(0),
|
|
230
|
+
unitPrice: z.number(),
|
|
231
|
+
total: z.number(),
|
|
232
|
+
currencyCode: z.string(),
|
|
233
|
+
});
|
|
234
|
+
export const storefrontDeparturePriceOfferImpactSchema = z.object({
|
|
235
|
+
offer: z.lazy(() => storefrontPromotionalOfferSchema),
|
|
236
|
+
status: z.enum(["applied", "not_applicable", "conflict"]),
|
|
237
|
+
reason: z.enum(["min_pax", "eligibility", "currency", "no_discount", "conflict"]).nullable(),
|
|
238
|
+
selected: z.boolean(),
|
|
239
|
+
discountAppliedCents: z.number().int(),
|
|
240
|
+
discountedPriceCents: z.number().int(),
|
|
241
|
+
});
|
|
242
|
+
export const storefrontDeparturePriceRequestedOfferSchema = z.object({
|
|
243
|
+
kind: z.enum(["slug", "code"]),
|
|
244
|
+
value: z.string(),
|
|
245
|
+
result: z.lazy(() => storefrontOfferMutationResultSchema).nullable(),
|
|
246
|
+
});
|
|
247
|
+
export const storefrontDeparturePriceOffersSchema = z.object({
|
|
248
|
+
available: z.array(storefrontDeparturePriceOfferImpactSchema),
|
|
249
|
+
requested: z.array(storefrontDeparturePriceRequestedOfferSchema),
|
|
250
|
+
applied: z.array(z.lazy(() => storefrontAppliedOfferSchema)),
|
|
251
|
+
conflict: z.lazy(() => storefrontOfferConflictSchema).nullable(),
|
|
252
|
+
discountTotal: z.number(),
|
|
253
|
+
discountTotalCents: z.number().int(),
|
|
254
|
+
totalAfterDiscount: z.number(),
|
|
255
|
+
currencyCode: z.string(),
|
|
256
|
+
});
|
|
257
|
+
export const storefrontDeparturePriceTotalsSchema = z.object({
|
|
258
|
+
currencyCode: z.string(),
|
|
259
|
+
base: z.number(),
|
|
260
|
+
extras: z.number(),
|
|
261
|
+
subtotal: z.number(),
|
|
262
|
+
discount: z.number(),
|
|
263
|
+
tax: z.number(),
|
|
264
|
+
total: z.number(),
|
|
265
|
+
perPerson: z.number(),
|
|
266
|
+
perBooking: z.number(),
|
|
267
|
+
});
|
|
268
|
+
export const storefrontDeparturePricePreviewSchema = z.object({
|
|
269
|
+
departureId: z.string(),
|
|
270
|
+
productId: z.string(),
|
|
271
|
+
optionId: z.string().nullable(),
|
|
272
|
+
currencyCode: z.string(),
|
|
273
|
+
basePrice: z.number(),
|
|
274
|
+
taxAmount: z.number(),
|
|
275
|
+
total: z.number(),
|
|
276
|
+
notes: z.string().nullable(),
|
|
277
|
+
lineItems: z.array(storefrontDeparturePriceLineItemSchema),
|
|
278
|
+
allocation: storefrontDeparturePriceAllocationSchema,
|
|
279
|
+
units: z.array(storefrontDeparturePriceUnitRowSchema),
|
|
280
|
+
rooms: z.array(storefrontDeparturePriceRoomRowSchema),
|
|
281
|
+
extras: z.array(storefrontDeparturePriceExtraImpactSchema),
|
|
282
|
+
offers: storefrontDeparturePriceOffersSchema,
|
|
283
|
+
totals: storefrontDeparturePriceTotalsSchema,
|
|
284
|
+
});
|
|
285
|
+
export const storefrontBookingSessionQuoteSchema = z.object({
|
|
286
|
+
currencyCode: z.string().trim().min(3).max(3),
|
|
287
|
+
totalSellAmountCents: z.number().int().min(0),
|
|
288
|
+
quotedAt: z.string().datetime().optional().nullable(),
|
|
289
|
+
expiresAt: z.string().datetime().optional().nullable(),
|
|
290
|
+
});
|
|
291
|
+
export const storefrontBookingSessionBootstrapInputSchema = z
|
|
292
|
+
.object({
|
|
293
|
+
departureId: z.string().trim().min(1),
|
|
294
|
+
slotId: z.string().trim().min(1),
|
|
295
|
+
catalogId: z.string().trim().min(1).optional(),
|
|
296
|
+
quote: storefrontBookingSessionQuoteSchema,
|
|
297
|
+
session: publicCreateBookingSessionSchema,
|
|
298
|
+
})
|
|
299
|
+
.superRefine((value, ctx) => {
|
|
300
|
+
if (!value.session.items.some((item) => item.availabilitySlotId === value.slotId)) {
|
|
301
|
+
ctx.addIssue({
|
|
302
|
+
code: "custom",
|
|
303
|
+
path: ["session", "items"],
|
|
304
|
+
message: "At least one session item must reference slotId",
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
export const storefrontBookingSessionPaymentPlanSchema = z.object({
|
|
309
|
+
source: z.literal("storefront_default"),
|
|
310
|
+
depositKind: z.enum(["none", "percent", "fixed_cents"]),
|
|
311
|
+
depositPercent: z.number().nullable(),
|
|
312
|
+
depositAmountCents: z.number().int().nullable(),
|
|
313
|
+
requiresFullPayment: z.boolean(),
|
|
314
|
+
});
|
|
315
|
+
export const storefrontBookingSessionAvailabilitySnapshotSchema = z.object({
|
|
316
|
+
departureId: z.string(),
|
|
317
|
+
slotId: z.string(),
|
|
318
|
+
productId: z.string(),
|
|
319
|
+
optionId: z.string().nullable(),
|
|
320
|
+
dateLocal: z.string().nullable(),
|
|
321
|
+
startsAt: z.string().nullable(),
|
|
322
|
+
endsAt: z.string().nullable(),
|
|
323
|
+
timezone: z.string(),
|
|
324
|
+
status: storefrontDepartureStatusSchema,
|
|
325
|
+
capacity: z.number().int().nullable(),
|
|
326
|
+
remaining: z.number().int().nullable(),
|
|
327
|
+
});
|
|
328
|
+
export const storefrontBookingSessionRepricingSnapshotSchema = z.object({
|
|
329
|
+
originalQuote: storefrontBookingSessionQuoteSchema,
|
|
330
|
+
current: publicBookingSessionRepriceSummarySchema,
|
|
331
|
+
deltaAmountCents: z.number().int(),
|
|
332
|
+
staleQuote: z.boolean(),
|
|
333
|
+
});
|
|
334
|
+
export const storefrontBookingSessionBootstrapSchema = z.object({
|
|
335
|
+
session: publicBookingSessionSchema,
|
|
336
|
+
paymentPlan: storefrontBookingSessionPaymentPlanSchema,
|
|
337
|
+
paymentSchedule: z.array(publicBookingPaymentScheduleSchema),
|
|
338
|
+
repricing: storefrontBookingSessionRepricingSnapshotSchema,
|
|
339
|
+
availability: storefrontBookingSessionAvailabilitySnapshotSchema,
|
|
340
|
+
allocation: z.array(publicBookingSessionAllocationSchema),
|
|
341
|
+
currency: z.string(),
|
|
342
|
+
});
|
|
343
|
+
export const storefrontProductExtensionsQuerySchema = z.object({
|
|
344
|
+
optionId: z.string().optional(),
|
|
345
|
+
});
|
|
346
|
+
export const storefrontProductExtensionMediaSchema = z.object({
|
|
347
|
+
url: z.string().trim().min(1),
|
|
348
|
+
alt: z.string().trim().min(1).nullable(),
|
|
349
|
+
});
|
|
350
|
+
export const storefrontProductExtensionDetailSchema = z.object({
|
|
351
|
+
description: z.string().nullable(),
|
|
352
|
+
media: z.array(storefrontProductExtensionMediaSchema),
|
|
353
|
+
});
|
|
354
|
+
export const storefrontProductExtensionSchema = z.object({
|
|
355
|
+
id: z.string(),
|
|
356
|
+
name: z.string(),
|
|
357
|
+
label: z.string(),
|
|
358
|
+
required: z.boolean(),
|
|
359
|
+
selectable: z.boolean(),
|
|
360
|
+
hasOptions: z.boolean(),
|
|
361
|
+
refProductId: z.string().nullable(),
|
|
362
|
+
thumb: z.string().nullable(),
|
|
363
|
+
pricePerPerson: z.number().nullable(),
|
|
364
|
+
currencyCode: z.string(),
|
|
365
|
+
// `z.lazy(() => …)` for cross-package init-cycle protection — see #501.
|
|
366
|
+
pricingMode: z.lazy(() => extraPricingModeSchema),
|
|
367
|
+
defaultQuantity: z.number().int().nullable(),
|
|
368
|
+
minQuantity: z.number().int().nullable(),
|
|
369
|
+
maxQuantity: z.number().int().nullable(),
|
|
370
|
+
});
|
|
371
|
+
export const storefrontProductExtensionsResponseSchema = z.object({
|
|
372
|
+
extensions: z.array(storefrontProductExtensionSchema),
|
|
373
|
+
items: z.array(storefrontProductExtensionSchema),
|
|
374
|
+
details: z.record(z.string(), storefrontProductExtensionDetailSchema),
|
|
375
|
+
currencyCode: z.string(),
|
|
376
|
+
});
|
|
377
|
+
export const storefrontDepartureItinerarySegmentSchema = z.object({
|
|
378
|
+
id: z.string(),
|
|
379
|
+
title: z.string(),
|
|
380
|
+
description: z.string().nullable(),
|
|
381
|
+
});
|
|
382
|
+
export const storefrontDepartureItineraryDaySchema = z.object({
|
|
383
|
+
id: z.string(),
|
|
384
|
+
title: z.string(),
|
|
385
|
+
description: z.string().nullable(),
|
|
386
|
+
thumbnail: z
|
|
387
|
+
.object({
|
|
388
|
+
url: z.string().trim().min(1),
|
|
389
|
+
})
|
|
390
|
+
.nullable(),
|
|
391
|
+
segments: z.array(storefrontDepartureItinerarySegmentSchema),
|
|
392
|
+
});
|
|
393
|
+
export const storefrontDepartureItinerarySchema = z.object({
|
|
394
|
+
id: z.string(),
|
|
395
|
+
itineraryId: z.string(),
|
|
396
|
+
days: z.array(storefrontDepartureItineraryDaySchema),
|
|
397
|
+
});
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const storefrontIntakeConsentSchema: z.ZodObject<{
|
|
3
|
+
marketing: z.ZodDefault<z.ZodBoolean>;
|
|
4
|
+
newsletter: z.ZodDefault<z.ZodBoolean>;
|
|
5
|
+
gdpr: z.ZodDefault<z.ZodBoolean>;
|
|
6
|
+
scope: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
7
|
+
acceptedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export declare const storefrontLeadContactSchema: z.ZodObject<{
|
|
10
|
+
name: z.ZodOptional<z.ZodString>;
|
|
11
|
+
firstName: z.ZodOptional<z.ZodString>;
|
|
12
|
+
lastName: z.ZodOptional<z.ZodString>;
|
|
13
|
+
email: z.ZodOptional<z.ZodEmail>;
|
|
14
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
export declare const storefrontLeadIntakeInputSchema: z.ZodObject<{
|
|
17
|
+
kind: z.ZodDefault<z.ZodEnum<{
|
|
18
|
+
notify: "notify";
|
|
19
|
+
wishlist: "wishlist";
|
|
20
|
+
inquiry: "inquiry";
|
|
21
|
+
request_offer: "request_offer";
|
|
22
|
+
referral: "referral";
|
|
23
|
+
}>>;
|
|
24
|
+
source: z.ZodDefault<z.ZodEnum<{
|
|
25
|
+
admin: "admin";
|
|
26
|
+
phone: "phone";
|
|
27
|
+
booking: "booking";
|
|
28
|
+
form: "form";
|
|
29
|
+
website: "website";
|
|
30
|
+
abandoned_cart: "abandoned_cart";
|
|
31
|
+
}>>;
|
|
32
|
+
contact: z.ZodObject<{
|
|
33
|
+
name: z.ZodOptional<z.ZodString>;
|
|
34
|
+
firstName: z.ZodOptional<z.ZodString>;
|
|
35
|
+
lastName: z.ZodOptional<z.ZodString>;
|
|
36
|
+
email: z.ZodOptional<z.ZodEmail>;
|
|
37
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
productId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
40
|
+
optionUnitId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
41
|
+
notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
42
|
+
tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
43
|
+
sourceSubmissionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
44
|
+
sourceUrl: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
|
|
45
|
+
locale: z.ZodOptional<z.ZodString>;
|
|
46
|
+
payload: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
47
|
+
consent: z.ZodDefault<z.ZodObject<{
|
|
48
|
+
marketing: z.ZodDefault<z.ZodBoolean>;
|
|
49
|
+
newsletter: z.ZodDefault<z.ZodBoolean>;
|
|
50
|
+
gdpr: z.ZodDefault<z.ZodBoolean>;
|
|
51
|
+
scope: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
52
|
+
acceptedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
53
|
+
}, z.core.$strip>>;
|
|
54
|
+
}, z.core.$strip>;
|
|
55
|
+
export declare const storefrontNewsletterSubscribeInputSchema: z.ZodObject<{
|
|
56
|
+
email: z.ZodEmail;
|
|
57
|
+
name: z.ZodOptional<z.ZodString>;
|
|
58
|
+
firstName: z.ZodOptional<z.ZodString>;
|
|
59
|
+
lastName: z.ZodOptional<z.ZodString>;
|
|
60
|
+
source: z.ZodDefault<z.ZodEnum<{
|
|
61
|
+
admin: "admin";
|
|
62
|
+
phone: "phone";
|
|
63
|
+
booking: "booking";
|
|
64
|
+
form: "form";
|
|
65
|
+
website: "website";
|
|
66
|
+
abandoned_cart: "abandoned_cart";
|
|
67
|
+
}>>;
|
|
68
|
+
sourceSubmissionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
69
|
+
sourceUrl: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
|
|
70
|
+
locale: z.ZodOptional<z.ZodString>;
|
|
71
|
+
tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
72
|
+
payload: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
73
|
+
consent: z.ZodObject<{
|
|
74
|
+
marketing: z.ZodDefault<z.ZodBoolean>;
|
|
75
|
+
gdpr: z.ZodDefault<z.ZodBoolean>;
|
|
76
|
+
scope: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
77
|
+
acceptedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
78
|
+
newsletter: z.ZodLiteral<true>;
|
|
79
|
+
}, z.core.$strip>;
|
|
80
|
+
}, z.core.$strip>;
|
|
81
|
+
export declare const storefrontIntakeResponseSchema: z.ZodObject<{
|
|
82
|
+
id: z.ZodString;
|
|
83
|
+
personId: z.ZodString;
|
|
84
|
+
kind: z.ZodEnum<{
|
|
85
|
+
notify: "notify";
|
|
86
|
+
wishlist: "wishlist";
|
|
87
|
+
inquiry: "inquiry";
|
|
88
|
+
request_offer: "request_offer";
|
|
89
|
+
referral: "referral";
|
|
90
|
+
}>;
|
|
91
|
+
source: z.ZodEnum<{
|
|
92
|
+
admin: "admin";
|
|
93
|
+
phone: "phone";
|
|
94
|
+
booking: "booking";
|
|
95
|
+
form: "form";
|
|
96
|
+
website: "website";
|
|
97
|
+
abandoned_cart: "abandoned_cart";
|
|
98
|
+
}>;
|
|
99
|
+
status: z.ZodEnum<{
|
|
100
|
+
expired: "expired";
|
|
101
|
+
lost: "lost";
|
|
102
|
+
new: "new";
|
|
103
|
+
contacted: "contacted";
|
|
104
|
+
qualified: "qualified";
|
|
105
|
+
converted: "converted";
|
|
106
|
+
}>;
|
|
107
|
+
duplicate: z.ZodBoolean;
|
|
108
|
+
}, z.core.$strip>;
|
|
109
|
+
export declare const storefrontNewsletterSubscribeResponseSchema: z.ZodObject<{
|
|
110
|
+
id: z.ZodString;
|
|
111
|
+
personId: z.ZodString;
|
|
112
|
+
kind: z.ZodEnum<{
|
|
113
|
+
notify: "notify";
|
|
114
|
+
wishlist: "wishlist";
|
|
115
|
+
inquiry: "inquiry";
|
|
116
|
+
request_offer: "request_offer";
|
|
117
|
+
referral: "referral";
|
|
118
|
+
}>;
|
|
119
|
+
source: z.ZodEnum<{
|
|
120
|
+
admin: "admin";
|
|
121
|
+
phone: "phone";
|
|
122
|
+
booking: "booking";
|
|
123
|
+
form: "form";
|
|
124
|
+
website: "website";
|
|
125
|
+
abandoned_cart: "abandoned_cart";
|
|
126
|
+
}>;
|
|
127
|
+
status: z.ZodEnum<{
|
|
128
|
+
expired: "expired";
|
|
129
|
+
lost: "lost";
|
|
130
|
+
new: "new";
|
|
131
|
+
contacted: "contacted";
|
|
132
|
+
qualified: "qualified";
|
|
133
|
+
converted: "converted";
|
|
134
|
+
}>;
|
|
135
|
+
duplicate: z.ZodBoolean;
|
|
136
|
+
doubleOptIn: z.ZodEnum<{
|
|
137
|
+
requested: "requested";
|
|
138
|
+
not_configured: "not_configured";
|
|
139
|
+
}>;
|
|
140
|
+
}, z.core.$strip>;
|
|
141
|
+
export type StorefrontIntakeConsent = z.infer<typeof storefrontIntakeConsentSchema>;
|
|
142
|
+
export type StorefrontLeadContact = z.infer<typeof storefrontLeadContactSchema>;
|
|
143
|
+
export type StorefrontLeadIntakeInput = z.infer<typeof storefrontLeadIntakeInputSchema>;
|
|
144
|
+
export type StorefrontNewsletterSubscribeInput = z.infer<typeof storefrontNewsletterSubscribeInputSchema>;
|
|
145
|
+
export type StorefrontIntakeResponse = z.infer<typeof storefrontIntakeResponseSchema>;
|
|
146
|
+
export type StorefrontNewsletterSubscribeResponse = z.infer<typeof storefrontNewsletterSubscribeResponseSchema>;
|
|
147
|
+
//# sourceMappingURL=intake.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intake.d.ts","sourceRoot":"","sources":["../../src/validation/intake.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAYvB,eAAO,MAAM,6BAA6B;;;;;;iBAMxC,CAAA;AAEF,eAAO,MAAM,2BAA2B;;;;;;iBAUpC,CAAA;AAEJ,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiB1C,CAAA;AAEF,eAAO,MAAM,wCAAwC;;;;;;;;;;;;;;;;;;;;;;;;;iBAYnD,CAAA;AAEF,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAOzC,CAAA;AAEF,eAAO,MAAM,2CAA2C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAEtD,CAAA;AAEF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAA;AACnF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAA;AAC/E,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAA;AACvF,MAAM,MAAM,kCAAkC,GAAG,CAAC,CAAC,KAAK,CACtD,OAAO,wCAAwC,CAChD,CAAA;AACD,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAA;AACrF,MAAM,MAAM,qCAAqC,GAAG,CAAC,CAAC,KAAK,CACzD,OAAO,2CAA2C,CACnD,CAAA"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { customerSignalKindSchema, customerSignalSourceSchema, customerSignalStatusSchema, } from "@voyant-travel/crm-contracts/validation";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { languageTagSchema } from "../validation-settings.js";
|
|
4
|
+
const boundedRecordSchema = z
|
|
5
|
+
.record(z.string(), z.unknown())
|
|
6
|
+
.refine((value) => JSON.stringify(value).length <= 8000, {
|
|
7
|
+
message: "Object payload must be 8KB or smaller",
|
|
8
|
+
});
|
|
9
|
+
const storefrontIntakeTagsSchema = z.array(z.string().trim().min(1).max(64)).max(20).default([]);
|
|
10
|
+
export const storefrontIntakeConsentSchema = z.object({
|
|
11
|
+
marketing: z.boolean().default(false),
|
|
12
|
+
newsletter: z.boolean().default(false),
|
|
13
|
+
gdpr: z.boolean().default(false),
|
|
14
|
+
scope: z.string().trim().min(1).max(120).nullable().optional(),
|
|
15
|
+
acceptedAt: z.string().datetime().nullable().optional(),
|
|
16
|
+
});
|
|
17
|
+
export const storefrontLeadContactSchema = z
|
|
18
|
+
.object({
|
|
19
|
+
name: z.string().trim().min(1).max(240).optional(),
|
|
20
|
+
firstName: z.string().trim().min(1).max(120).optional(),
|
|
21
|
+
lastName: z.string().trim().min(1).max(120).optional(),
|
|
22
|
+
email: z.email().max(320).optional(),
|
|
23
|
+
phone: z.string().trim().min(3).max(64).optional(),
|
|
24
|
+
})
|
|
25
|
+
.refine((value) => Boolean(value.email || value.phone), {
|
|
26
|
+
message: "Either contact.email or contact.phone is required",
|
|
27
|
+
});
|
|
28
|
+
export const storefrontLeadIntakeInputSchema = z.object({
|
|
29
|
+
kind: customerSignalKindSchema.default("inquiry"),
|
|
30
|
+
source: customerSignalSourceSchema.default("website"),
|
|
31
|
+
contact: storefrontLeadContactSchema,
|
|
32
|
+
productId: z.string().trim().min(1).max(160).nullable().optional(),
|
|
33
|
+
optionUnitId: z.string().trim().min(1).max(160).nullable().optional(),
|
|
34
|
+
notes: z.string().trim().max(4000).nullable().optional(),
|
|
35
|
+
tags: storefrontIntakeTagsSchema,
|
|
36
|
+
sourceSubmissionId: z.string().trim().min(1).max(160).nullable().optional(),
|
|
37
|
+
sourceUrl: z.url().nullable().optional(),
|
|
38
|
+
locale: languageTagSchema.optional(),
|
|
39
|
+
payload: boundedRecordSchema.default({}),
|
|
40
|
+
consent: storefrontIntakeConsentSchema.default({
|
|
41
|
+
marketing: false,
|
|
42
|
+
newsletter: false,
|
|
43
|
+
gdpr: false,
|
|
44
|
+
}),
|
|
45
|
+
});
|
|
46
|
+
export const storefrontNewsletterSubscribeInputSchema = z.object({
|
|
47
|
+
email: z.email().max(320),
|
|
48
|
+
name: z.string().trim().min(1).max(240).optional(),
|
|
49
|
+
firstName: z.string().trim().min(1).max(120).optional(),
|
|
50
|
+
lastName: z.string().trim().min(1).max(120).optional(),
|
|
51
|
+
source: customerSignalSourceSchema.default("website"),
|
|
52
|
+
sourceSubmissionId: z.string().trim().min(1).max(160).nullable().optional(),
|
|
53
|
+
sourceUrl: z.url().nullable().optional(),
|
|
54
|
+
locale: languageTagSchema.optional(),
|
|
55
|
+
tags: storefrontIntakeTagsSchema,
|
|
56
|
+
payload: boundedRecordSchema.default({}),
|
|
57
|
+
consent: storefrontIntakeConsentSchema.extend({ newsletter: z.literal(true) }),
|
|
58
|
+
});
|
|
59
|
+
export const storefrontIntakeResponseSchema = z.object({
|
|
60
|
+
id: z.string(),
|
|
61
|
+
personId: z.string(),
|
|
62
|
+
kind: customerSignalKindSchema,
|
|
63
|
+
source: customerSignalSourceSchema,
|
|
64
|
+
status: customerSignalStatusSchema,
|
|
65
|
+
duplicate: z.boolean(),
|
|
66
|
+
});
|
|
67
|
+
export const storefrontNewsletterSubscribeResponseSchema = storefrontIntakeResponseSchema.extend({
|
|
68
|
+
doubleOptIn: z.enum(["not_configured", "requested"]),
|
|
69
|
+
});
|