@voyantjs/storefront-sdk 0.34.0 → 0.37.0
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/README.md +24 -0
- package/dist/booking-engine.d.ts +420 -0
- package/dist/booking-engine.d.ts.map +1 -0
- package/dist/booking-engine.js +56 -0
- package/dist/client.d.ts +3 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +7 -1
- package/dist/errors.d.ts +41 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +50 -0
- package/dist/index.d.ts +413 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -0
- package/dist/operations.d.ts +2 -2
- package/dist/schemas.d.ts +2 -2
- package/package.json +17 -7
package/README.md
CHANGED
|
@@ -29,5 +29,29 @@ const session = await voyant.booking.createSession({
|
|
|
29
29
|
const state = voyant.booking.deriveState(session)
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
+
For custom booking engines, prefer the `bookingEngine` facade. It keeps the
|
|
33
|
+
route-shaped public booking and checkout calls behind flow-oriented methods and
|
|
34
|
+
returns a canonical engine snapshot alongside session reads and mutations.
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
const booking = await voyant.bookingEngine.reserve({
|
|
38
|
+
sellCurrency: "EUR",
|
|
39
|
+
items: [
|
|
40
|
+
{
|
|
41
|
+
title: "Danube tour",
|
|
42
|
+
availabilitySlotId: "slot_123",
|
|
43
|
+
quantity: 2,
|
|
44
|
+
totalSellAmountCents: 24000,
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
if (voyant.bookingEngine.canRunAction(booking.engine.state, "start_payment")) {
|
|
50
|
+
await voyant.bookingEngine.startPayment(booking.session.sessionId, {
|
|
51
|
+
method: "card",
|
|
52
|
+
})
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
32
56
|
React consumers should layer React Query hooks on top of this package rather
|
|
33
57
|
than reimplementing request paths directly.
|
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
import type { StorefrontRequestOptions, VoyantStorefrontClientOptions } from "./client.js";
|
|
2
|
+
import { type BookingEngineSnapshot } from "./engine-state.js";
|
|
3
|
+
import { repricePublicBookingSession } from "./operations.js";
|
|
4
|
+
import type { BootstrapCheckoutCollectionInput, InitiateCheckoutCollectionInput, PreviewCheckoutCollectionInput, PublicBookingOverviewLookupQuery, PublicBookingSessionMutationInput, PublicBookingSessionRecord, PublicBookingSessionRepriceInput, PublicCreateBookingSessionInput, PublicUpdateBookingSessionInput, PublicUpsertBookingSessionStateInput } from "./schemas.js";
|
|
5
|
+
type ResolvedClientOptions = Required<Pick<VoyantStorefrontClientOptions, "baseUrl" | "fetcher">> & Pick<VoyantStorefrontClientOptions, "headers">;
|
|
6
|
+
export interface BookingEngineSessionSnapshot {
|
|
7
|
+
session: PublicBookingSessionRecord;
|
|
8
|
+
engine: BookingEngineSnapshot;
|
|
9
|
+
}
|
|
10
|
+
export interface BookingEngineRepriceResult {
|
|
11
|
+
pricing: Awaited<ReturnType<typeof repricePublicBookingSession>>["pricing"];
|
|
12
|
+
session: BookingEngineSessionSnapshot | null;
|
|
13
|
+
}
|
|
14
|
+
export type BookingEngineTravelerUpdateInput = Pick<PublicUpdateBookingSessionInput, "travelers" | "removedTravelerIds" | "pax">;
|
|
15
|
+
export declare function createBookingEngineSessionSnapshot(session: PublicBookingSessionRecord): BookingEngineSessionSnapshot;
|
|
16
|
+
export declare function reserveBookingEngineSession(client: ResolvedClientOptions, input: PublicCreateBookingSessionInput, options?: StorefrontRequestOptions): Promise<BookingEngineSessionSnapshot>;
|
|
17
|
+
export declare function getBookingEngineSessionSnapshot(client: ResolvedClientOptions, sessionId: string): Promise<BookingEngineSessionSnapshot>;
|
|
18
|
+
export declare function updateBookingEngineSession(client: ResolvedClientOptions, sessionId: string, input: PublicUpdateBookingSessionInput, options?: StorefrontRequestOptions): Promise<BookingEngineSessionSnapshot>;
|
|
19
|
+
export declare function updateBookingEngineTravelers(client: ResolvedClientOptions, sessionId: string, input: BookingEngineTravelerUpdateInput, options?: StorefrontRequestOptions): Promise<BookingEngineSessionSnapshot>;
|
|
20
|
+
export declare function getBookingEngineProgress(client: ResolvedClientOptions, sessionId: string): Promise<{
|
|
21
|
+
sessionId: string;
|
|
22
|
+
stateKey: "wizard";
|
|
23
|
+
currentStep: string | null;
|
|
24
|
+
completedSteps: string[];
|
|
25
|
+
payload: Record<string, unknown>;
|
|
26
|
+
version: number;
|
|
27
|
+
createdAt: string;
|
|
28
|
+
updatedAt: string;
|
|
29
|
+
}>;
|
|
30
|
+
export declare function updateBookingEngineProgress(client: ResolvedClientOptions, sessionId: string, input: PublicUpsertBookingSessionStateInput, options?: StorefrontRequestOptions): Promise<{
|
|
31
|
+
sessionId: string;
|
|
32
|
+
stateKey: "wizard";
|
|
33
|
+
currentStep: string | null;
|
|
34
|
+
completedSteps: string[];
|
|
35
|
+
payload: Record<string, unknown>;
|
|
36
|
+
version: number;
|
|
37
|
+
createdAt: string;
|
|
38
|
+
updatedAt: string;
|
|
39
|
+
}>;
|
|
40
|
+
export declare function repriceBookingEngineSession(client: ResolvedClientOptions, sessionId: string, input: PublicBookingSessionRepriceInput, options?: StorefrontRequestOptions): Promise<BookingEngineRepriceResult>;
|
|
41
|
+
export declare function confirmBookingEngineSession(client: ResolvedClientOptions, sessionId: string, input?: PublicBookingSessionMutationInput, options?: StorefrontRequestOptions): Promise<BookingEngineSessionSnapshot>;
|
|
42
|
+
export declare function expireBookingEngineSession(client: ResolvedClientOptions, sessionId: string, input?: PublicBookingSessionMutationInput, options?: StorefrontRequestOptions): Promise<BookingEngineSessionSnapshot>;
|
|
43
|
+
export declare function getBookingEngineOverview(client: ResolvedClientOptions, query: PublicBookingOverviewLookupQuery): Promise<{
|
|
44
|
+
bookingId: string;
|
|
45
|
+
bookingNumber: string;
|
|
46
|
+
status: "draft" | "on_hold" | "awaiting_payment" | "confirmed" | "in_progress" | "completed" | "expired" | "cancelled";
|
|
47
|
+
sellCurrency: string;
|
|
48
|
+
sellAmountCents: number | null;
|
|
49
|
+
startDate: string | null;
|
|
50
|
+
endDate: string | null;
|
|
51
|
+
pax: number | null;
|
|
52
|
+
confirmedAt: string | null;
|
|
53
|
+
cancelledAt: string | null;
|
|
54
|
+
completedAt: string | null;
|
|
55
|
+
travelers: {
|
|
56
|
+
id: string;
|
|
57
|
+
participantType: "traveler" | "occupant" | "other";
|
|
58
|
+
firstName: string;
|
|
59
|
+
lastName: string;
|
|
60
|
+
isPrimary: boolean;
|
|
61
|
+
}[];
|
|
62
|
+
items: {
|
|
63
|
+
id: string;
|
|
64
|
+
title: string;
|
|
65
|
+
description: string | null;
|
|
66
|
+
itemType: "other" | "unit" | "extra" | "service" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
|
|
67
|
+
status: "draft" | "on_hold" | "confirmed" | "expired" | "cancelled" | "fulfilled";
|
|
68
|
+
serviceDate: string | null;
|
|
69
|
+
startsAt: string | null;
|
|
70
|
+
endsAt: string | null;
|
|
71
|
+
quantity: number;
|
|
72
|
+
sellCurrency: string;
|
|
73
|
+
unitSellAmountCents: number | null;
|
|
74
|
+
totalSellAmountCents: number | null;
|
|
75
|
+
costCurrency: string | null;
|
|
76
|
+
unitCostAmountCents: number | null;
|
|
77
|
+
totalCostAmountCents: number | null;
|
|
78
|
+
notes: string | null;
|
|
79
|
+
productId: string | null;
|
|
80
|
+
optionId: string | null;
|
|
81
|
+
optionUnitId: string | null;
|
|
82
|
+
pricingCategoryId: string | null;
|
|
83
|
+
travelerLinks: {
|
|
84
|
+
id: string;
|
|
85
|
+
travelerId: string;
|
|
86
|
+
role: "traveler" | "occupant" | "other" | "beneficiary";
|
|
87
|
+
isPrimary: boolean;
|
|
88
|
+
}[];
|
|
89
|
+
}[];
|
|
90
|
+
documents: {
|
|
91
|
+
id: string;
|
|
92
|
+
travelerId: string | null;
|
|
93
|
+
type: "other" | "visa" | "insurance" | "health" | "passport_copy";
|
|
94
|
+
fileName: string;
|
|
95
|
+
fileUrl: string;
|
|
96
|
+
}[];
|
|
97
|
+
fulfillments: {
|
|
98
|
+
id: string;
|
|
99
|
+
bookingItemId: string | null;
|
|
100
|
+
travelerId: string | null;
|
|
101
|
+
fulfillmentType: "other" | "voucher" | "ticket" | "pdf" | "qr_code" | "barcode" | "mobile";
|
|
102
|
+
deliveryChannel: "other" | "download" | "email" | "api" | "wallet";
|
|
103
|
+
status: "pending" | "issued" | "reissued" | "revoked" | "failed";
|
|
104
|
+
artifactUrl: string | null;
|
|
105
|
+
}[];
|
|
106
|
+
}>;
|
|
107
|
+
export declare function previewBookingEnginePayment(client: ResolvedClientOptions, bookingId: string, input: PreviewCheckoutCollectionInput, options?: StorefrontRequestOptions): Promise<{
|
|
108
|
+
bookingId: string;
|
|
109
|
+
method: "bank_transfer" | "card";
|
|
110
|
+
stage: "manual" | "initial" | "reminder";
|
|
111
|
+
paymentSessionTarget: "schedule" | "invoice" | null;
|
|
112
|
+
documentType: "invoice" | "proforma" | null;
|
|
113
|
+
willCreateDefaultPaymentPlan: boolean;
|
|
114
|
+
selectedSchedule: {
|
|
115
|
+
id: string;
|
|
116
|
+
bookingId: string;
|
|
117
|
+
bookingItemId: string | null;
|
|
118
|
+
scheduleType: string;
|
|
119
|
+
status: string;
|
|
120
|
+
dueDate: string;
|
|
121
|
+
currency: string;
|
|
122
|
+
amountCents: number;
|
|
123
|
+
notes: string | null;
|
|
124
|
+
} | null;
|
|
125
|
+
selectedInvoice: {
|
|
126
|
+
id: string;
|
|
127
|
+
invoiceNumber: string;
|
|
128
|
+
invoiceType: string;
|
|
129
|
+
bookingId: string;
|
|
130
|
+
personId: string | null;
|
|
131
|
+
organizationId: string | null;
|
|
132
|
+
status: string;
|
|
133
|
+
currency: string;
|
|
134
|
+
totalCents: number;
|
|
135
|
+
paidCents: number;
|
|
136
|
+
balanceDueCents: number;
|
|
137
|
+
issueDate: string;
|
|
138
|
+
dueDate: string;
|
|
139
|
+
notes: string | null;
|
|
140
|
+
createdAt: string;
|
|
141
|
+
updatedAt: string;
|
|
142
|
+
} | null;
|
|
143
|
+
amountCents: number;
|
|
144
|
+
currency: string;
|
|
145
|
+
recommendedAction: "none" | "create_bank_transfer_document" | "create_payment_session" | "create_invoice_then_payment_session";
|
|
146
|
+
}>;
|
|
147
|
+
export declare function startBookingEnginePayment(client: ResolvedClientOptions, bookingId: string, input: InitiateCheckoutCollectionInput, options?: StorefrontRequestOptions): Promise<{
|
|
148
|
+
plan: {
|
|
149
|
+
bookingId: string;
|
|
150
|
+
method: "bank_transfer" | "card";
|
|
151
|
+
stage: "manual" | "initial" | "reminder";
|
|
152
|
+
paymentSessionTarget: "schedule" | "invoice" | null;
|
|
153
|
+
documentType: "invoice" | "proforma" | null;
|
|
154
|
+
willCreateDefaultPaymentPlan: boolean;
|
|
155
|
+
selectedSchedule: {
|
|
156
|
+
id: string;
|
|
157
|
+
bookingId: string;
|
|
158
|
+
bookingItemId: string | null;
|
|
159
|
+
scheduleType: string;
|
|
160
|
+
status: string;
|
|
161
|
+
dueDate: string;
|
|
162
|
+
currency: string;
|
|
163
|
+
amountCents: number;
|
|
164
|
+
notes: string | null;
|
|
165
|
+
} | null;
|
|
166
|
+
selectedInvoice: {
|
|
167
|
+
id: string;
|
|
168
|
+
invoiceNumber: string;
|
|
169
|
+
invoiceType: string;
|
|
170
|
+
bookingId: string;
|
|
171
|
+
personId: string | null;
|
|
172
|
+
organizationId: string | null;
|
|
173
|
+
status: string;
|
|
174
|
+
currency: string;
|
|
175
|
+
totalCents: number;
|
|
176
|
+
paidCents: number;
|
|
177
|
+
balanceDueCents: number;
|
|
178
|
+
issueDate: string;
|
|
179
|
+
dueDate: string;
|
|
180
|
+
notes: string | null;
|
|
181
|
+
createdAt: string;
|
|
182
|
+
updatedAt: string;
|
|
183
|
+
} | null;
|
|
184
|
+
amountCents: number;
|
|
185
|
+
currency: string;
|
|
186
|
+
recommendedAction: "none" | "create_bank_transfer_document" | "create_payment_session" | "create_invoice_then_payment_session";
|
|
187
|
+
};
|
|
188
|
+
invoice: {
|
|
189
|
+
id: string;
|
|
190
|
+
invoiceNumber: string;
|
|
191
|
+
invoiceType: string;
|
|
192
|
+
bookingId: string;
|
|
193
|
+
personId: string | null;
|
|
194
|
+
organizationId: string | null;
|
|
195
|
+
status: string;
|
|
196
|
+
currency: string;
|
|
197
|
+
totalCents: number;
|
|
198
|
+
paidCents: number;
|
|
199
|
+
balanceDueCents: number;
|
|
200
|
+
issueDate: string;
|
|
201
|
+
dueDate: string;
|
|
202
|
+
notes: string | null;
|
|
203
|
+
createdAt: string;
|
|
204
|
+
updatedAt: string;
|
|
205
|
+
} | null;
|
|
206
|
+
paymentSession: {
|
|
207
|
+
id: string;
|
|
208
|
+
targetType: "other" | "booking" | "order" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "flight_order";
|
|
209
|
+
targetId: string | null;
|
|
210
|
+
bookingId: string | null;
|
|
211
|
+
invoiceId: string | null;
|
|
212
|
+
bookingPaymentScheduleId: string | null;
|
|
213
|
+
bookingGuaranteeId: string | null;
|
|
214
|
+
status: "expired" | "cancelled" | "pending" | "failed" | "paid" | "requires_redirect" | "processing" | "authorized";
|
|
215
|
+
provider: string | null;
|
|
216
|
+
providerSessionId: string | null;
|
|
217
|
+
providerPaymentId: string | null;
|
|
218
|
+
externalReference: string | null;
|
|
219
|
+
clientReference: string | null;
|
|
220
|
+
currency: string;
|
|
221
|
+
amountCents: number;
|
|
222
|
+
paymentMethod: "other" | "voucher" | "wallet" | "bank_transfer" | "credit_card" | "debit_card" | "cash" | "cheque" | "direct_bill" | null;
|
|
223
|
+
payerEmail: string | null;
|
|
224
|
+
payerName: string | null;
|
|
225
|
+
redirectUrl: string | null;
|
|
226
|
+
returnUrl: string | null;
|
|
227
|
+
cancelUrl: string | null;
|
|
228
|
+
expiresAt: string | null;
|
|
229
|
+
completedAt: string | null;
|
|
230
|
+
failureCode: string | null;
|
|
231
|
+
failureMessage: string | null;
|
|
232
|
+
notes: string | null;
|
|
233
|
+
} | null;
|
|
234
|
+
invoiceNotification: {
|
|
235
|
+
id: string;
|
|
236
|
+
templateSlug: string | null;
|
|
237
|
+
channel: "email" | "sms";
|
|
238
|
+
provider: string;
|
|
239
|
+
status: "cancelled" | "pending" | "failed" | "sent";
|
|
240
|
+
toAddress: string;
|
|
241
|
+
subject: string | null;
|
|
242
|
+
sentAt: string | null;
|
|
243
|
+
failedAt: string | null;
|
|
244
|
+
errorMessage: string | null;
|
|
245
|
+
} | null;
|
|
246
|
+
paymentSessionNotification: {
|
|
247
|
+
id: string;
|
|
248
|
+
templateSlug: string | null;
|
|
249
|
+
channel: "email" | "sms";
|
|
250
|
+
provider: string;
|
|
251
|
+
status: "cancelled" | "pending" | "failed" | "sent";
|
|
252
|
+
toAddress: string;
|
|
253
|
+
subject: string | null;
|
|
254
|
+
sentAt: string | null;
|
|
255
|
+
failedAt: string | null;
|
|
256
|
+
errorMessage: string | null;
|
|
257
|
+
} | null;
|
|
258
|
+
bankTransferInstructions: {
|
|
259
|
+
provider: string | null;
|
|
260
|
+
invoiceId: string;
|
|
261
|
+
invoiceNumber: string;
|
|
262
|
+
documentType: "invoice" | "proforma";
|
|
263
|
+
amountCents: number;
|
|
264
|
+
currency: string;
|
|
265
|
+
dueDate: string | null;
|
|
266
|
+
beneficiary: string;
|
|
267
|
+
iban: string;
|
|
268
|
+
bankName: string | null;
|
|
269
|
+
notes: string | null;
|
|
270
|
+
} | null;
|
|
271
|
+
providerStart: {
|
|
272
|
+
provider: string;
|
|
273
|
+
paymentSessionId: string;
|
|
274
|
+
redirectUrl: string | null;
|
|
275
|
+
externalReference: string | null;
|
|
276
|
+
providerSessionId: string | null;
|
|
277
|
+
providerPaymentId: string | null;
|
|
278
|
+
response: Record<string, unknown> | null;
|
|
279
|
+
} | null;
|
|
280
|
+
}>;
|
|
281
|
+
export declare function bootstrapBookingEnginePayment(client: ResolvedClientOptions, input: BootstrapCheckoutCollectionInput, options?: StorefrontRequestOptions): Promise<{
|
|
282
|
+
plan: {
|
|
283
|
+
bookingId: string;
|
|
284
|
+
method: "bank_transfer" | "card";
|
|
285
|
+
stage: "manual" | "initial" | "reminder";
|
|
286
|
+
paymentSessionTarget: "schedule" | "invoice" | null;
|
|
287
|
+
documentType: "invoice" | "proforma" | null;
|
|
288
|
+
willCreateDefaultPaymentPlan: boolean;
|
|
289
|
+
selectedSchedule: {
|
|
290
|
+
id: string;
|
|
291
|
+
bookingId: string;
|
|
292
|
+
bookingItemId: string | null;
|
|
293
|
+
scheduleType: string;
|
|
294
|
+
status: string;
|
|
295
|
+
dueDate: string;
|
|
296
|
+
currency: string;
|
|
297
|
+
amountCents: number;
|
|
298
|
+
notes: string | null;
|
|
299
|
+
} | null;
|
|
300
|
+
selectedInvoice: {
|
|
301
|
+
id: string;
|
|
302
|
+
invoiceNumber: string;
|
|
303
|
+
invoiceType: string;
|
|
304
|
+
bookingId: string;
|
|
305
|
+
personId: string | null;
|
|
306
|
+
organizationId: string | null;
|
|
307
|
+
status: string;
|
|
308
|
+
currency: string;
|
|
309
|
+
totalCents: number;
|
|
310
|
+
paidCents: number;
|
|
311
|
+
balanceDueCents: number;
|
|
312
|
+
issueDate: string;
|
|
313
|
+
dueDate: string;
|
|
314
|
+
notes: string | null;
|
|
315
|
+
createdAt: string;
|
|
316
|
+
updatedAt: string;
|
|
317
|
+
} | null;
|
|
318
|
+
amountCents: number;
|
|
319
|
+
currency: string;
|
|
320
|
+
recommendedAction: "none" | "create_bank_transfer_document" | "create_payment_session" | "create_invoice_then_payment_session";
|
|
321
|
+
};
|
|
322
|
+
invoice: {
|
|
323
|
+
id: string;
|
|
324
|
+
invoiceNumber: string;
|
|
325
|
+
invoiceType: string;
|
|
326
|
+
bookingId: string;
|
|
327
|
+
personId: string | null;
|
|
328
|
+
organizationId: string | null;
|
|
329
|
+
status: string;
|
|
330
|
+
currency: string;
|
|
331
|
+
totalCents: number;
|
|
332
|
+
paidCents: number;
|
|
333
|
+
balanceDueCents: number;
|
|
334
|
+
issueDate: string;
|
|
335
|
+
dueDate: string;
|
|
336
|
+
notes: string | null;
|
|
337
|
+
createdAt: string;
|
|
338
|
+
updatedAt: string;
|
|
339
|
+
} | null;
|
|
340
|
+
paymentSession: {
|
|
341
|
+
id: string;
|
|
342
|
+
targetType: "other" | "booking" | "order" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "flight_order";
|
|
343
|
+
targetId: string | null;
|
|
344
|
+
bookingId: string | null;
|
|
345
|
+
invoiceId: string | null;
|
|
346
|
+
bookingPaymentScheduleId: string | null;
|
|
347
|
+
bookingGuaranteeId: string | null;
|
|
348
|
+
status: "expired" | "cancelled" | "pending" | "failed" | "paid" | "requires_redirect" | "processing" | "authorized";
|
|
349
|
+
provider: string | null;
|
|
350
|
+
providerSessionId: string | null;
|
|
351
|
+
providerPaymentId: string | null;
|
|
352
|
+
externalReference: string | null;
|
|
353
|
+
clientReference: string | null;
|
|
354
|
+
currency: string;
|
|
355
|
+
amountCents: number;
|
|
356
|
+
paymentMethod: "other" | "voucher" | "wallet" | "bank_transfer" | "credit_card" | "debit_card" | "cash" | "cheque" | "direct_bill" | null;
|
|
357
|
+
payerEmail: string | null;
|
|
358
|
+
payerName: string | null;
|
|
359
|
+
redirectUrl: string | null;
|
|
360
|
+
returnUrl: string | null;
|
|
361
|
+
cancelUrl: string | null;
|
|
362
|
+
expiresAt: string | null;
|
|
363
|
+
completedAt: string | null;
|
|
364
|
+
failureCode: string | null;
|
|
365
|
+
failureMessage: string | null;
|
|
366
|
+
notes: string | null;
|
|
367
|
+
} | null;
|
|
368
|
+
invoiceNotification: {
|
|
369
|
+
id: string;
|
|
370
|
+
templateSlug: string | null;
|
|
371
|
+
channel: "email" | "sms";
|
|
372
|
+
provider: string;
|
|
373
|
+
status: "cancelled" | "pending" | "failed" | "sent";
|
|
374
|
+
toAddress: string;
|
|
375
|
+
subject: string | null;
|
|
376
|
+
sentAt: string | null;
|
|
377
|
+
failedAt: string | null;
|
|
378
|
+
errorMessage: string | null;
|
|
379
|
+
} | null;
|
|
380
|
+
paymentSessionNotification: {
|
|
381
|
+
id: string;
|
|
382
|
+
templateSlug: string | null;
|
|
383
|
+
channel: "email" | "sms";
|
|
384
|
+
provider: string;
|
|
385
|
+
status: "cancelled" | "pending" | "failed" | "sent";
|
|
386
|
+
toAddress: string;
|
|
387
|
+
subject: string | null;
|
|
388
|
+
sentAt: string | null;
|
|
389
|
+
failedAt: string | null;
|
|
390
|
+
errorMessage: string | null;
|
|
391
|
+
} | null;
|
|
392
|
+
bankTransferInstructions: {
|
|
393
|
+
provider: string | null;
|
|
394
|
+
invoiceId: string;
|
|
395
|
+
invoiceNumber: string;
|
|
396
|
+
documentType: "invoice" | "proforma";
|
|
397
|
+
amountCents: number;
|
|
398
|
+
currency: string;
|
|
399
|
+
dueDate: string | null;
|
|
400
|
+
beneficiary: string;
|
|
401
|
+
iban: string;
|
|
402
|
+
bankName: string | null;
|
|
403
|
+
notes: string | null;
|
|
404
|
+
} | null;
|
|
405
|
+
providerStart: {
|
|
406
|
+
provider: string;
|
|
407
|
+
paymentSessionId: string;
|
|
408
|
+
redirectUrl: string | null;
|
|
409
|
+
externalReference: string | null;
|
|
410
|
+
providerSessionId: string | null;
|
|
411
|
+
providerPaymentId: string | null;
|
|
412
|
+
response: Record<string, unknown> | null;
|
|
413
|
+
} | null;
|
|
414
|
+
bookingId: string;
|
|
415
|
+
sessionId: string;
|
|
416
|
+
sourceType: "session" | "booking";
|
|
417
|
+
intent: "custom" | "deposit" | "balance";
|
|
418
|
+
}>;
|
|
419
|
+
export {};
|
|
420
|
+
//# sourceMappingURL=booking-engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"booking-engine.d.ts","sourceRoot":"","sources":["../src/booking-engine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;AAC1F,OAAO,EAAE,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EAAE,MAAM,EACjB,KAAK,EAAE,+BAA+B,EACtC,OAAO,CAAC,EAAE,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAGnC;AAED,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,qBAAqB,EAC7B,KAAK,EAAE,gCAAgC,EACvC,OAAO,CAAC,EAAE,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAGnC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { createBookingEngineSnapshot } from "./engine-state.js";
|
|
2
|
+
import { bootstrapCheckoutCollection, confirmPublicBookingSession, createPublicBookingSession, expirePublicBookingSession, getPublicBookingOverview, getPublicBookingSession, getPublicBookingSessionState, initiateCheckoutCollection, previewCheckoutCollection, repricePublicBookingSession, updatePublicBookingSession, updatePublicBookingSessionState, } from "./operations.js";
|
|
3
|
+
export function createBookingEngineSessionSnapshot(session) {
|
|
4
|
+
return {
|
|
5
|
+
session,
|
|
6
|
+
engine: createBookingEngineSnapshot(session),
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export async function reserveBookingEngineSession(client, input, options) {
|
|
10
|
+
const session = await createPublicBookingSession(client, input, options);
|
|
11
|
+
return createBookingEngineSessionSnapshot(session);
|
|
12
|
+
}
|
|
13
|
+
export async function getBookingEngineSessionSnapshot(client, sessionId) {
|
|
14
|
+
const session = await getPublicBookingSession(client, sessionId);
|
|
15
|
+
return createBookingEngineSessionSnapshot(session);
|
|
16
|
+
}
|
|
17
|
+
export async function updateBookingEngineSession(client, sessionId, input, options) {
|
|
18
|
+
const session = await updatePublicBookingSession(client, sessionId, input, options);
|
|
19
|
+
return createBookingEngineSessionSnapshot(session);
|
|
20
|
+
}
|
|
21
|
+
export function updateBookingEngineTravelers(client, sessionId, input, options) {
|
|
22
|
+
return updateBookingEngineSession(client, sessionId, input, options);
|
|
23
|
+
}
|
|
24
|
+
export function getBookingEngineProgress(client, sessionId) {
|
|
25
|
+
return getPublicBookingSessionState(client, sessionId);
|
|
26
|
+
}
|
|
27
|
+
export function updateBookingEngineProgress(client, sessionId, input, options) {
|
|
28
|
+
return updatePublicBookingSessionState(client, sessionId, input, options);
|
|
29
|
+
}
|
|
30
|
+
export async function repriceBookingEngineSession(client, sessionId, input, options) {
|
|
31
|
+
const result = await repricePublicBookingSession(client, sessionId, input, options);
|
|
32
|
+
return {
|
|
33
|
+
pricing: result.pricing,
|
|
34
|
+
session: result.session ? createBookingEngineSessionSnapshot(result.session) : null,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export async function confirmBookingEngineSession(client, sessionId, input = {}, options) {
|
|
38
|
+
const session = await confirmPublicBookingSession(client, sessionId, input, options);
|
|
39
|
+
return createBookingEngineSessionSnapshot(session);
|
|
40
|
+
}
|
|
41
|
+
export async function expireBookingEngineSession(client, sessionId, input = {}, options) {
|
|
42
|
+
const session = await expirePublicBookingSession(client, sessionId, input, options);
|
|
43
|
+
return createBookingEngineSessionSnapshot(session);
|
|
44
|
+
}
|
|
45
|
+
export function getBookingEngineOverview(client, query) {
|
|
46
|
+
return getPublicBookingOverview(client, query);
|
|
47
|
+
}
|
|
48
|
+
export function previewBookingEnginePayment(client, bookingId, input, options) {
|
|
49
|
+
return previewCheckoutCollection(client, bookingId, input, options);
|
|
50
|
+
}
|
|
51
|
+
export function startBookingEnginePayment(client, bookingId, input, options) {
|
|
52
|
+
return initiateCheckoutCollection(client, bookingId, input, options);
|
|
53
|
+
}
|
|
54
|
+
export function bootstrapBookingEnginePayment(client, input, options) {
|
|
55
|
+
return bootstrapCheckoutCollection(client, input, options);
|
|
56
|
+
}
|
package/dist/client.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { z } from "zod";
|
|
2
|
+
import { type StorefrontApiErrorEnvelope } from "./errors.js";
|
|
2
3
|
export type VoyantStorefrontFetcher = (url: string, init?: RequestInit) => Promise<Response>;
|
|
3
4
|
export declare const defaultStorefrontFetcher: VoyantStorefrontFetcher;
|
|
4
5
|
export declare class VoyantStorefrontApiError extends Error {
|
|
5
6
|
readonly status: number;
|
|
6
7
|
readonly body: unknown;
|
|
7
|
-
|
|
8
|
+
readonly normalizedError: StorefrontApiErrorEnvelope | null;
|
|
9
|
+
constructor(message: string, status: number, body: unknown, normalizedError?: StorefrontApiErrorEnvelope | null);
|
|
8
10
|
}
|
|
9
11
|
export interface VoyantStorefrontClientOptions {
|
|
10
12
|
baseUrl: string;
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAE5B,MAAM,MAAM,uBAAuB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;AAE5F,eAAO,MAAM,wBAAwB,EAAE,uBACU,CAAA;AAEjD,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAE5B,OAAO,EAAmC,KAAK,0BAA0B,EAAE,MAAM,aAAa,CAAA;AAE9F,MAAM,MAAM,uBAAuB,GAAG,CAAC,GAAG,EAA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CAAC,OAAO,CAAC,EAAE,wBAAwB,GAAG,WAAW,GAAG,SAAS,CAU1F"}
|
package/dist/client.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
import { parseStorefrontApiErrorEnvelope } from "./errors.js";
|
|
1
2
|
export const defaultStorefrontFetcher = (url, init) => fetch(url, { credentials: "include", ...init });
|
|
2
3
|
export class VoyantStorefrontApiError extends Error {
|
|
3
4
|
status;
|
|
4
5
|
body;
|
|
5
|
-
|
|
6
|
+
normalizedError;
|
|
7
|
+
constructor(message, status, body, normalizedError = parseStorefrontApiErrorEnvelope(body)) {
|
|
6
8
|
super(message);
|
|
7
9
|
this.name = "VoyantStorefrontApiError";
|
|
8
10
|
this.status = status;
|
|
9
11
|
this.body = body;
|
|
12
|
+
this.normalizedError = normalizedError;
|
|
10
13
|
}
|
|
11
14
|
}
|
|
12
15
|
export function withStorefrontQueryParams(path, query) {
|
|
@@ -64,6 +67,9 @@ export function requestHeaders(options) {
|
|
|
64
67
|
return headers;
|
|
65
68
|
}
|
|
66
69
|
function extractErrorMessage(status, statusText, body) {
|
|
70
|
+
const normalizedError = parseStorefrontApiErrorEnvelope(body);
|
|
71
|
+
if (normalizedError)
|
|
72
|
+
return normalizedError.message;
|
|
67
73
|
if (typeof body === "object" && body !== null && "error" in body) {
|
|
68
74
|
const err = body.error;
|
|
69
75
|
if (typeof err === "string")
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const bookingEngineErrorCodes: readonly ["contract_template_missing", "reservation_expired", "departure_unavailable", "invalid_traveler_payload", "payment_provider_unavailable", "payment_url_missing", "payment_webhook_pending", "checkout_finalization_failed"];
|
|
3
|
+
export type BookingEngineErrorCode = (typeof bookingEngineErrorCodes)[number];
|
|
4
|
+
export declare const bookingEngineNextActions: readonly ["configure_contract_template", "restart_reservation", "choose_another_departure", "correct_traveler_payload", "choose_another_payment_method", "retry_payment_start", "poll_payment_status", "contact_operator"];
|
|
5
|
+
export type BookingEngineNextAction = (typeof bookingEngineNextActions)[number];
|
|
6
|
+
export declare const storefrontApiErrorEnvelopeSchema: z.ZodObject<{
|
|
7
|
+
code: z.ZodOptional<z.ZodString>;
|
|
8
|
+
message: z.ZodString;
|
|
9
|
+
recoverable: z.ZodOptional<z.ZodBoolean>;
|
|
10
|
+
nextAction: z.ZodOptional<z.ZodString>;
|
|
11
|
+
details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
export declare const bookingEngineErrorEnvelopeSchema: z.ZodObject<{
|
|
14
|
+
message: z.ZodString;
|
|
15
|
+
recoverable: z.ZodOptional<z.ZodBoolean>;
|
|
16
|
+
details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
17
|
+
code: z.ZodEnum<{
|
|
18
|
+
contract_template_missing: "contract_template_missing";
|
|
19
|
+
reservation_expired: "reservation_expired";
|
|
20
|
+
departure_unavailable: "departure_unavailable";
|
|
21
|
+
invalid_traveler_payload: "invalid_traveler_payload";
|
|
22
|
+
payment_provider_unavailable: "payment_provider_unavailable";
|
|
23
|
+
payment_url_missing: "payment_url_missing";
|
|
24
|
+
payment_webhook_pending: "payment_webhook_pending";
|
|
25
|
+
checkout_finalization_failed: "checkout_finalization_failed";
|
|
26
|
+
}>;
|
|
27
|
+
nextAction: z.ZodOptional<z.ZodEnum<{
|
|
28
|
+
configure_contract_template: "configure_contract_template";
|
|
29
|
+
restart_reservation: "restart_reservation";
|
|
30
|
+
choose_another_departure: "choose_another_departure";
|
|
31
|
+
correct_traveler_payload: "correct_traveler_payload";
|
|
32
|
+
choose_another_payment_method: "choose_another_payment_method";
|
|
33
|
+
retry_payment_start: "retry_payment_start";
|
|
34
|
+
poll_payment_status: "poll_payment_status";
|
|
35
|
+
contact_operator: "contact_operator";
|
|
36
|
+
}>>;
|
|
37
|
+
}, z.core.$strip>;
|
|
38
|
+
export type StorefrontApiErrorEnvelope = z.infer<typeof storefrontApiErrorEnvelopeSchema>;
|
|
39
|
+
export type BookingEngineErrorEnvelope = z.infer<typeof bookingEngineErrorEnvelopeSchema>;
|
|
40
|
+
export declare function parseStorefrontApiErrorEnvelope(body: unknown): StorefrontApiErrorEnvelope | null;
|
|
41
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,uBAAuB,sOAS1B,CAAA;AAEV,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE7E,eAAO,MAAM,wBAAwB,4NAS3B,CAAA;AAEV,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE/E,eAAO,MAAM,gCAAgC;;;;;;iBAM3C,CAAA;AAEF,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;iBAG3C,CAAA;AAEF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAA;AACzF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAA;AAEzF,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,OAAO,GAAG,0BAA0B,GAAG,IAAI,CAqBhG"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const bookingEngineErrorCodes = [
|
|
3
|
+
"contract_template_missing",
|
|
4
|
+
"reservation_expired",
|
|
5
|
+
"departure_unavailable",
|
|
6
|
+
"invalid_traveler_payload",
|
|
7
|
+
"payment_provider_unavailable",
|
|
8
|
+
"payment_url_missing",
|
|
9
|
+
"payment_webhook_pending",
|
|
10
|
+
"checkout_finalization_failed",
|
|
11
|
+
];
|
|
12
|
+
export const bookingEngineNextActions = [
|
|
13
|
+
"configure_contract_template",
|
|
14
|
+
"restart_reservation",
|
|
15
|
+
"choose_another_departure",
|
|
16
|
+
"correct_traveler_payload",
|
|
17
|
+
"choose_another_payment_method",
|
|
18
|
+
"retry_payment_start",
|
|
19
|
+
"poll_payment_status",
|
|
20
|
+
"contact_operator",
|
|
21
|
+
];
|
|
22
|
+
export const storefrontApiErrorEnvelopeSchema = z.object({
|
|
23
|
+
code: z.string().optional(),
|
|
24
|
+
message: z.string(),
|
|
25
|
+
recoverable: z.boolean().optional(),
|
|
26
|
+
nextAction: z.string().optional(),
|
|
27
|
+
details: z.record(z.string(), z.unknown()).optional(),
|
|
28
|
+
});
|
|
29
|
+
export const bookingEngineErrorEnvelopeSchema = storefrontApiErrorEnvelopeSchema.extend({
|
|
30
|
+
code: z.enum(bookingEngineErrorCodes),
|
|
31
|
+
nextAction: z.enum(bookingEngineNextActions).optional(),
|
|
32
|
+
});
|
|
33
|
+
export function parseStorefrontApiErrorEnvelope(body) {
|
|
34
|
+
const direct = storefrontApiErrorEnvelopeSchema.safeParse(body);
|
|
35
|
+
if (direct.success) {
|
|
36
|
+
return direct.data;
|
|
37
|
+
}
|
|
38
|
+
if (typeof body !== "object" || body === null || !("error" in body)) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
const error = body.error;
|
|
42
|
+
if (typeof error === "string") {
|
|
43
|
+
const code = typeof body.code === "string"
|
|
44
|
+
? body.code
|
|
45
|
+
: undefined;
|
|
46
|
+
return { code, message: error };
|
|
47
|
+
}
|
|
48
|
+
const nested = storefrontApiErrorEnvelopeSchema.safeParse(error);
|
|
49
|
+
return nested.success ? nested.data : null;
|
|
50
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import { bootstrapBookingEnginePayment, confirmBookingEngineSession, expireBookingEngineSession, getBookingEngineOverview, previewBookingEnginePayment, repriceBookingEngineSession, reserveBookingEngineSession, startBookingEnginePayment, updateBookingEngineProgress, updateBookingEngineSession, updateBookingEngineTravelers } from "./booking-engine.js";
|
|
1
2
|
import { type VoyantStorefrontClientOptions } from "./client.js";
|
|
2
3
|
import { canRunBookingEngineAction, createBookingEngineSnapshot, deriveBookingEngineState } from "./engine-state.js";
|
|
3
4
|
import { bootstrapCheckoutCollection, confirmPublicBookingSession, createPublicBookingSession, expirePublicBookingSession, getPublicBookingOverview, getStorefrontOfferBySlug, getStorefrontProductAvailability, initiateCheckoutCollection, listStorefrontProductDepartures, listStorefrontProductExtensions, listStorefrontProductOffers, previewCheckoutCollection, previewStorefrontDeparturePrice, repricePublicBookingSession, updatePublicBookingSession, updatePublicBookingSessionState } from "./operations.js";
|
|
5
|
+
export * from "./booking-engine.js";
|
|
4
6
|
export type { StorefrontQueryParamValue, StorefrontRequestOptions, VoyantStorefrontClientOptions, VoyantStorefrontFetcher, } from "./client.js";
|
|
5
7
|
export { defaultStorefrontFetcher, storefrontFetchWithValidation, VoyantStorefrontApiError, withStorefrontQueryParams, } from "./client.js";
|
|
6
8
|
export type { BookingEngineAction, BookingEngineSnapshot, BookingEngineState, } from "./engine-state.js";
|
|
7
9
|
export { bookingEngineActions, bookingEngineStates, canRunBookingEngineAction, createBookingEngineSnapshot, deriveBookingEngineState, getAllowedBookingEngineActions, } from "./engine-state.js";
|
|
10
|
+
export * from "./errors.js";
|
|
8
11
|
export * from "./operations.js";
|
|
9
12
|
export * from "./schemas.js";
|
|
10
13
|
export declare function createVoyantStorefrontClient(options: VoyantStorefrontClientOptions): {
|
|
@@ -28,7 +31,7 @@ export declare function createVoyantStorefrontClient(options: VoyantStorefrontCl
|
|
|
28
31
|
fields: {
|
|
29
32
|
key: string;
|
|
30
33
|
label: string;
|
|
31
|
-
type: "
|
|
34
|
+
type: "date" | "email" | "text" | "select" | "country" | "tel" | "textarea" | "checkbox";
|
|
32
35
|
required: boolean;
|
|
33
36
|
placeholder: string | null;
|
|
34
37
|
description: string | null;
|
|
@@ -43,7 +46,7 @@ export declare function createVoyantStorefrontClient(options: VoyantStorefrontCl
|
|
|
43
46
|
fields: {
|
|
44
47
|
key: string;
|
|
45
48
|
label: string;
|
|
46
|
-
type: "
|
|
49
|
+
type: "date" | "email" | "text" | "select" | "country" | "tel" | "textarea" | "checkbox";
|
|
47
50
|
required: boolean;
|
|
48
51
|
placeholder: string | null;
|
|
49
52
|
description: string | null;
|
|
@@ -991,6 +994,414 @@ export declare function createVoyantStorefrontClient(options: VoyantStorefrontCl
|
|
|
991
994
|
createSnapshot: typeof createBookingEngineSnapshot;
|
|
992
995
|
canRunAction: typeof canRunBookingEngineAction;
|
|
993
996
|
};
|
|
997
|
+
bookingEngine: {
|
|
998
|
+
reserve: (input: Parameters<typeof reserveBookingEngineSession>[1], requestOptions?: Parameters<typeof reserveBookingEngineSession>[2]) => Promise<import("./booking-engine.js").BookingEngineSessionSnapshot>;
|
|
999
|
+
getSnapshot: (sessionId: string) => Promise<import("./booking-engine.js").BookingEngineSessionSnapshot>;
|
|
1000
|
+
updateSession: (sessionId: string, input: Parameters<typeof updateBookingEngineSession>[2], requestOptions?: Parameters<typeof updateBookingEngineSession>[3]) => Promise<import("./booking-engine.js").BookingEngineSessionSnapshot>;
|
|
1001
|
+
updateTravelers: (sessionId: string, input: Parameters<typeof updateBookingEngineTravelers>[2], requestOptions?: Parameters<typeof updateBookingEngineTravelers>[3]) => Promise<import("./booking-engine.js").BookingEngineSessionSnapshot>;
|
|
1002
|
+
getProgress: (sessionId: string) => Promise<{
|
|
1003
|
+
sessionId: string;
|
|
1004
|
+
stateKey: "wizard";
|
|
1005
|
+
currentStep: string | null;
|
|
1006
|
+
completedSteps: string[];
|
|
1007
|
+
payload: Record<string, unknown>;
|
|
1008
|
+
version: number;
|
|
1009
|
+
createdAt: string;
|
|
1010
|
+
updatedAt: string;
|
|
1011
|
+
}>;
|
|
1012
|
+
updateProgress: (sessionId: string, input: Parameters<typeof updateBookingEngineProgress>[2], requestOptions?: Parameters<typeof updateBookingEngineProgress>[3]) => Promise<{
|
|
1013
|
+
sessionId: string;
|
|
1014
|
+
stateKey: "wizard";
|
|
1015
|
+
currentStep: string | null;
|
|
1016
|
+
completedSteps: string[];
|
|
1017
|
+
payload: Record<string, unknown>;
|
|
1018
|
+
version: number;
|
|
1019
|
+
createdAt: string;
|
|
1020
|
+
updatedAt: string;
|
|
1021
|
+
}>;
|
|
1022
|
+
reprice: (sessionId: string, input: Parameters<typeof repriceBookingEngineSession>[2], requestOptions?: Parameters<typeof repriceBookingEngineSession>[3]) => Promise<import("./booking-engine.js").BookingEngineRepriceResult>;
|
|
1023
|
+
confirm: (sessionId: string, input?: Parameters<typeof confirmBookingEngineSession>[2], requestOptions?: Parameters<typeof confirmBookingEngineSession>[3]) => Promise<import("./booking-engine.js").BookingEngineSessionSnapshot>;
|
|
1024
|
+
expire: (sessionId: string, input?: Parameters<typeof expireBookingEngineSession>[2], requestOptions?: Parameters<typeof expireBookingEngineSession>[3]) => Promise<import("./booking-engine.js").BookingEngineSessionSnapshot>;
|
|
1025
|
+
getOverview: (query: Parameters<typeof getBookingEngineOverview>[1]) => Promise<{
|
|
1026
|
+
bookingId: string;
|
|
1027
|
+
bookingNumber: string;
|
|
1028
|
+
status: "draft" | "on_hold" | "awaiting_payment" | "confirmed" | "in_progress" | "completed" | "expired" | "cancelled";
|
|
1029
|
+
sellCurrency: string;
|
|
1030
|
+
sellAmountCents: number | null;
|
|
1031
|
+
startDate: string | null;
|
|
1032
|
+
endDate: string | null;
|
|
1033
|
+
pax: number | null;
|
|
1034
|
+
confirmedAt: string | null;
|
|
1035
|
+
cancelledAt: string | null;
|
|
1036
|
+
completedAt: string | null;
|
|
1037
|
+
travelers: {
|
|
1038
|
+
id: string;
|
|
1039
|
+
participantType: "traveler" | "occupant" | "other";
|
|
1040
|
+
firstName: string;
|
|
1041
|
+
lastName: string;
|
|
1042
|
+
isPrimary: boolean;
|
|
1043
|
+
}[];
|
|
1044
|
+
items: {
|
|
1045
|
+
id: string;
|
|
1046
|
+
title: string;
|
|
1047
|
+
description: string | null;
|
|
1048
|
+
itemType: "other" | "unit" | "extra" | "service" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
|
|
1049
|
+
status: "draft" | "on_hold" | "confirmed" | "expired" | "cancelled" | "fulfilled";
|
|
1050
|
+
serviceDate: string | null;
|
|
1051
|
+
startsAt: string | null;
|
|
1052
|
+
endsAt: string | null;
|
|
1053
|
+
quantity: number;
|
|
1054
|
+
sellCurrency: string;
|
|
1055
|
+
unitSellAmountCents: number | null;
|
|
1056
|
+
totalSellAmountCents: number | null;
|
|
1057
|
+
costCurrency: string | null;
|
|
1058
|
+
unitCostAmountCents: number | null;
|
|
1059
|
+
totalCostAmountCents: number | null;
|
|
1060
|
+
notes: string | null;
|
|
1061
|
+
productId: string | null;
|
|
1062
|
+
optionId: string | null;
|
|
1063
|
+
optionUnitId: string | null;
|
|
1064
|
+
pricingCategoryId: string | null;
|
|
1065
|
+
travelerLinks: {
|
|
1066
|
+
id: string;
|
|
1067
|
+
travelerId: string;
|
|
1068
|
+
role: "traveler" | "occupant" | "other" | "beneficiary";
|
|
1069
|
+
isPrimary: boolean;
|
|
1070
|
+
}[];
|
|
1071
|
+
}[];
|
|
1072
|
+
documents: {
|
|
1073
|
+
id: string;
|
|
1074
|
+
travelerId: string | null;
|
|
1075
|
+
type: "other" | "visa" | "insurance" | "health" | "passport_copy";
|
|
1076
|
+
fileName: string;
|
|
1077
|
+
fileUrl: string;
|
|
1078
|
+
}[];
|
|
1079
|
+
fulfillments: {
|
|
1080
|
+
id: string;
|
|
1081
|
+
bookingItemId: string | null;
|
|
1082
|
+
travelerId: string | null;
|
|
1083
|
+
fulfillmentType: "other" | "voucher" | "ticket" | "pdf" | "qr_code" | "barcode" | "mobile";
|
|
1084
|
+
deliveryChannel: "other" | "download" | "email" | "api" | "wallet";
|
|
1085
|
+
status: "pending" | "issued" | "reissued" | "revoked" | "failed";
|
|
1086
|
+
artifactUrl: string | null;
|
|
1087
|
+
}[];
|
|
1088
|
+
}>;
|
|
1089
|
+
previewPayment: (bookingId: string, input: Parameters<typeof previewBookingEnginePayment>[2], requestOptions?: Parameters<typeof previewBookingEnginePayment>[3]) => Promise<{
|
|
1090
|
+
bookingId: string;
|
|
1091
|
+
method: "bank_transfer" | "card";
|
|
1092
|
+
stage: "manual" | "initial" | "reminder";
|
|
1093
|
+
paymentSessionTarget: "schedule" | "invoice" | null;
|
|
1094
|
+
documentType: "invoice" | "proforma" | null;
|
|
1095
|
+
willCreateDefaultPaymentPlan: boolean;
|
|
1096
|
+
selectedSchedule: {
|
|
1097
|
+
id: string;
|
|
1098
|
+
bookingId: string;
|
|
1099
|
+
bookingItemId: string | null;
|
|
1100
|
+
scheduleType: string;
|
|
1101
|
+
status: string;
|
|
1102
|
+
dueDate: string;
|
|
1103
|
+
currency: string;
|
|
1104
|
+
amountCents: number;
|
|
1105
|
+
notes: string | null;
|
|
1106
|
+
} | null;
|
|
1107
|
+
selectedInvoice: {
|
|
1108
|
+
id: string;
|
|
1109
|
+
invoiceNumber: string;
|
|
1110
|
+
invoiceType: string;
|
|
1111
|
+
bookingId: string;
|
|
1112
|
+
personId: string | null;
|
|
1113
|
+
organizationId: string | null;
|
|
1114
|
+
status: string;
|
|
1115
|
+
currency: string;
|
|
1116
|
+
totalCents: number;
|
|
1117
|
+
paidCents: number;
|
|
1118
|
+
balanceDueCents: number;
|
|
1119
|
+
issueDate: string;
|
|
1120
|
+
dueDate: string;
|
|
1121
|
+
notes: string | null;
|
|
1122
|
+
createdAt: string;
|
|
1123
|
+
updatedAt: string;
|
|
1124
|
+
} | null;
|
|
1125
|
+
amountCents: number;
|
|
1126
|
+
currency: string;
|
|
1127
|
+
recommendedAction: "none" | "create_bank_transfer_document" | "create_payment_session" | "create_invoice_then_payment_session";
|
|
1128
|
+
}>;
|
|
1129
|
+
startPayment: (bookingId: string, input: Parameters<typeof startBookingEnginePayment>[2], requestOptions?: Parameters<typeof startBookingEnginePayment>[3]) => Promise<{
|
|
1130
|
+
plan: {
|
|
1131
|
+
bookingId: string;
|
|
1132
|
+
method: "bank_transfer" | "card";
|
|
1133
|
+
stage: "manual" | "initial" | "reminder";
|
|
1134
|
+
paymentSessionTarget: "schedule" | "invoice" | null;
|
|
1135
|
+
documentType: "invoice" | "proforma" | null;
|
|
1136
|
+
willCreateDefaultPaymentPlan: boolean;
|
|
1137
|
+
selectedSchedule: {
|
|
1138
|
+
id: string;
|
|
1139
|
+
bookingId: string;
|
|
1140
|
+
bookingItemId: string | null;
|
|
1141
|
+
scheduleType: string;
|
|
1142
|
+
status: string;
|
|
1143
|
+
dueDate: string;
|
|
1144
|
+
currency: string;
|
|
1145
|
+
amountCents: number;
|
|
1146
|
+
notes: string | null;
|
|
1147
|
+
} | null;
|
|
1148
|
+
selectedInvoice: {
|
|
1149
|
+
id: string;
|
|
1150
|
+
invoiceNumber: string;
|
|
1151
|
+
invoiceType: string;
|
|
1152
|
+
bookingId: string;
|
|
1153
|
+
personId: string | null;
|
|
1154
|
+
organizationId: string | null;
|
|
1155
|
+
status: string;
|
|
1156
|
+
currency: string;
|
|
1157
|
+
totalCents: number;
|
|
1158
|
+
paidCents: number;
|
|
1159
|
+
balanceDueCents: number;
|
|
1160
|
+
issueDate: string;
|
|
1161
|
+
dueDate: string;
|
|
1162
|
+
notes: string | null;
|
|
1163
|
+
createdAt: string;
|
|
1164
|
+
updatedAt: string;
|
|
1165
|
+
} | null;
|
|
1166
|
+
amountCents: number;
|
|
1167
|
+
currency: string;
|
|
1168
|
+
recommendedAction: "none" | "create_bank_transfer_document" | "create_payment_session" | "create_invoice_then_payment_session";
|
|
1169
|
+
};
|
|
1170
|
+
invoice: {
|
|
1171
|
+
id: string;
|
|
1172
|
+
invoiceNumber: string;
|
|
1173
|
+
invoiceType: string;
|
|
1174
|
+
bookingId: string;
|
|
1175
|
+
personId: string | null;
|
|
1176
|
+
organizationId: string | null;
|
|
1177
|
+
status: string;
|
|
1178
|
+
currency: string;
|
|
1179
|
+
totalCents: number;
|
|
1180
|
+
paidCents: number;
|
|
1181
|
+
balanceDueCents: number;
|
|
1182
|
+
issueDate: string;
|
|
1183
|
+
dueDate: string;
|
|
1184
|
+
notes: string | null;
|
|
1185
|
+
createdAt: string;
|
|
1186
|
+
updatedAt: string;
|
|
1187
|
+
} | null;
|
|
1188
|
+
paymentSession: {
|
|
1189
|
+
id: string;
|
|
1190
|
+
targetType: "other" | "booking" | "order" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "flight_order";
|
|
1191
|
+
targetId: string | null;
|
|
1192
|
+
bookingId: string | null;
|
|
1193
|
+
invoiceId: string | null;
|
|
1194
|
+
bookingPaymentScheduleId: string | null;
|
|
1195
|
+
bookingGuaranteeId: string | null;
|
|
1196
|
+
status: "expired" | "cancelled" | "pending" | "failed" | "paid" | "requires_redirect" | "processing" | "authorized";
|
|
1197
|
+
provider: string | null;
|
|
1198
|
+
providerSessionId: string | null;
|
|
1199
|
+
providerPaymentId: string | null;
|
|
1200
|
+
externalReference: string | null;
|
|
1201
|
+
clientReference: string | null;
|
|
1202
|
+
currency: string;
|
|
1203
|
+
amountCents: number;
|
|
1204
|
+
paymentMethod: "other" | "voucher" | "wallet" | "bank_transfer" | "credit_card" | "debit_card" | "cash" | "cheque" | "direct_bill" | null;
|
|
1205
|
+
payerEmail: string | null;
|
|
1206
|
+
payerName: string | null;
|
|
1207
|
+
redirectUrl: string | null;
|
|
1208
|
+
returnUrl: string | null;
|
|
1209
|
+
cancelUrl: string | null;
|
|
1210
|
+
expiresAt: string | null;
|
|
1211
|
+
completedAt: string | null;
|
|
1212
|
+
failureCode: string | null;
|
|
1213
|
+
failureMessage: string | null;
|
|
1214
|
+
notes: string | null;
|
|
1215
|
+
} | null;
|
|
1216
|
+
invoiceNotification: {
|
|
1217
|
+
id: string;
|
|
1218
|
+
templateSlug: string | null;
|
|
1219
|
+
channel: "email" | "sms";
|
|
1220
|
+
provider: string;
|
|
1221
|
+
status: "cancelled" | "pending" | "failed" | "sent";
|
|
1222
|
+
toAddress: string;
|
|
1223
|
+
subject: string | null;
|
|
1224
|
+
sentAt: string | null;
|
|
1225
|
+
failedAt: string | null;
|
|
1226
|
+
errorMessage: string | null;
|
|
1227
|
+
} | null;
|
|
1228
|
+
paymentSessionNotification: {
|
|
1229
|
+
id: string;
|
|
1230
|
+
templateSlug: string | null;
|
|
1231
|
+
channel: "email" | "sms";
|
|
1232
|
+
provider: string;
|
|
1233
|
+
status: "cancelled" | "pending" | "failed" | "sent";
|
|
1234
|
+
toAddress: string;
|
|
1235
|
+
subject: string | null;
|
|
1236
|
+
sentAt: string | null;
|
|
1237
|
+
failedAt: string | null;
|
|
1238
|
+
errorMessage: string | null;
|
|
1239
|
+
} | null;
|
|
1240
|
+
bankTransferInstructions: {
|
|
1241
|
+
provider: string | null;
|
|
1242
|
+
invoiceId: string;
|
|
1243
|
+
invoiceNumber: string;
|
|
1244
|
+
documentType: "invoice" | "proforma";
|
|
1245
|
+
amountCents: number;
|
|
1246
|
+
currency: string;
|
|
1247
|
+
dueDate: string | null;
|
|
1248
|
+
beneficiary: string;
|
|
1249
|
+
iban: string;
|
|
1250
|
+
bankName: string | null;
|
|
1251
|
+
notes: string | null;
|
|
1252
|
+
} | null;
|
|
1253
|
+
providerStart: {
|
|
1254
|
+
provider: string;
|
|
1255
|
+
paymentSessionId: string;
|
|
1256
|
+
redirectUrl: string | null;
|
|
1257
|
+
externalReference: string | null;
|
|
1258
|
+
providerSessionId: string | null;
|
|
1259
|
+
providerPaymentId: string | null;
|
|
1260
|
+
response: Record<string, unknown> | null;
|
|
1261
|
+
} | null;
|
|
1262
|
+
}>;
|
|
1263
|
+
bootstrapPayment: (input: Parameters<typeof bootstrapBookingEnginePayment>[1], requestOptions?: Parameters<typeof bootstrapBookingEnginePayment>[2]) => Promise<{
|
|
1264
|
+
plan: {
|
|
1265
|
+
bookingId: string;
|
|
1266
|
+
method: "bank_transfer" | "card";
|
|
1267
|
+
stage: "manual" | "initial" | "reminder";
|
|
1268
|
+
paymentSessionTarget: "schedule" | "invoice" | null;
|
|
1269
|
+
documentType: "invoice" | "proforma" | null;
|
|
1270
|
+
willCreateDefaultPaymentPlan: boolean;
|
|
1271
|
+
selectedSchedule: {
|
|
1272
|
+
id: string;
|
|
1273
|
+
bookingId: string;
|
|
1274
|
+
bookingItemId: string | null;
|
|
1275
|
+
scheduleType: string;
|
|
1276
|
+
status: string;
|
|
1277
|
+
dueDate: string;
|
|
1278
|
+
currency: string;
|
|
1279
|
+
amountCents: number;
|
|
1280
|
+
notes: string | null;
|
|
1281
|
+
} | null;
|
|
1282
|
+
selectedInvoice: {
|
|
1283
|
+
id: string;
|
|
1284
|
+
invoiceNumber: string;
|
|
1285
|
+
invoiceType: string;
|
|
1286
|
+
bookingId: string;
|
|
1287
|
+
personId: string | null;
|
|
1288
|
+
organizationId: string | null;
|
|
1289
|
+
status: string;
|
|
1290
|
+
currency: string;
|
|
1291
|
+
totalCents: number;
|
|
1292
|
+
paidCents: number;
|
|
1293
|
+
balanceDueCents: number;
|
|
1294
|
+
issueDate: string;
|
|
1295
|
+
dueDate: string;
|
|
1296
|
+
notes: string | null;
|
|
1297
|
+
createdAt: string;
|
|
1298
|
+
updatedAt: string;
|
|
1299
|
+
} | null;
|
|
1300
|
+
amountCents: number;
|
|
1301
|
+
currency: string;
|
|
1302
|
+
recommendedAction: "none" | "create_bank_transfer_document" | "create_payment_session" | "create_invoice_then_payment_session";
|
|
1303
|
+
};
|
|
1304
|
+
invoice: {
|
|
1305
|
+
id: string;
|
|
1306
|
+
invoiceNumber: string;
|
|
1307
|
+
invoiceType: string;
|
|
1308
|
+
bookingId: string;
|
|
1309
|
+
personId: string | null;
|
|
1310
|
+
organizationId: string | null;
|
|
1311
|
+
status: string;
|
|
1312
|
+
currency: string;
|
|
1313
|
+
totalCents: number;
|
|
1314
|
+
paidCents: number;
|
|
1315
|
+
balanceDueCents: number;
|
|
1316
|
+
issueDate: string;
|
|
1317
|
+
dueDate: string;
|
|
1318
|
+
notes: string | null;
|
|
1319
|
+
createdAt: string;
|
|
1320
|
+
updatedAt: string;
|
|
1321
|
+
} | null;
|
|
1322
|
+
paymentSession: {
|
|
1323
|
+
id: string;
|
|
1324
|
+
targetType: "other" | "booking" | "order" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "flight_order";
|
|
1325
|
+
targetId: string | null;
|
|
1326
|
+
bookingId: string | null;
|
|
1327
|
+
invoiceId: string | null;
|
|
1328
|
+
bookingPaymentScheduleId: string | null;
|
|
1329
|
+
bookingGuaranteeId: string | null;
|
|
1330
|
+
status: "expired" | "cancelled" | "pending" | "failed" | "paid" | "requires_redirect" | "processing" | "authorized";
|
|
1331
|
+
provider: string | null;
|
|
1332
|
+
providerSessionId: string | null;
|
|
1333
|
+
providerPaymentId: string | null;
|
|
1334
|
+
externalReference: string | null;
|
|
1335
|
+
clientReference: string | null;
|
|
1336
|
+
currency: string;
|
|
1337
|
+
amountCents: number;
|
|
1338
|
+
paymentMethod: "other" | "voucher" | "wallet" | "bank_transfer" | "credit_card" | "debit_card" | "cash" | "cheque" | "direct_bill" | null;
|
|
1339
|
+
payerEmail: string | null;
|
|
1340
|
+
payerName: string | null;
|
|
1341
|
+
redirectUrl: string | null;
|
|
1342
|
+
returnUrl: string | null;
|
|
1343
|
+
cancelUrl: string | null;
|
|
1344
|
+
expiresAt: string | null;
|
|
1345
|
+
completedAt: string | null;
|
|
1346
|
+
failureCode: string | null;
|
|
1347
|
+
failureMessage: string | null;
|
|
1348
|
+
notes: string | null;
|
|
1349
|
+
} | null;
|
|
1350
|
+
invoiceNotification: {
|
|
1351
|
+
id: string;
|
|
1352
|
+
templateSlug: string | null;
|
|
1353
|
+
channel: "email" | "sms";
|
|
1354
|
+
provider: string;
|
|
1355
|
+
status: "cancelled" | "pending" | "failed" | "sent";
|
|
1356
|
+
toAddress: string;
|
|
1357
|
+
subject: string | null;
|
|
1358
|
+
sentAt: string | null;
|
|
1359
|
+
failedAt: string | null;
|
|
1360
|
+
errorMessage: string | null;
|
|
1361
|
+
} | null;
|
|
1362
|
+
paymentSessionNotification: {
|
|
1363
|
+
id: string;
|
|
1364
|
+
templateSlug: string | null;
|
|
1365
|
+
channel: "email" | "sms";
|
|
1366
|
+
provider: string;
|
|
1367
|
+
status: "cancelled" | "pending" | "failed" | "sent";
|
|
1368
|
+
toAddress: string;
|
|
1369
|
+
subject: string | null;
|
|
1370
|
+
sentAt: string | null;
|
|
1371
|
+
failedAt: string | null;
|
|
1372
|
+
errorMessage: string | null;
|
|
1373
|
+
} | null;
|
|
1374
|
+
bankTransferInstructions: {
|
|
1375
|
+
provider: string | null;
|
|
1376
|
+
invoiceId: string;
|
|
1377
|
+
invoiceNumber: string;
|
|
1378
|
+
documentType: "invoice" | "proforma";
|
|
1379
|
+
amountCents: number;
|
|
1380
|
+
currency: string;
|
|
1381
|
+
dueDate: string | null;
|
|
1382
|
+
beneficiary: string;
|
|
1383
|
+
iban: string;
|
|
1384
|
+
bankName: string | null;
|
|
1385
|
+
notes: string | null;
|
|
1386
|
+
} | null;
|
|
1387
|
+
providerStart: {
|
|
1388
|
+
provider: string;
|
|
1389
|
+
paymentSessionId: string;
|
|
1390
|
+
redirectUrl: string | null;
|
|
1391
|
+
externalReference: string | null;
|
|
1392
|
+
providerSessionId: string | null;
|
|
1393
|
+
providerPaymentId: string | null;
|
|
1394
|
+
response: Record<string, unknown> | null;
|
|
1395
|
+
} | null;
|
|
1396
|
+
bookingId: string;
|
|
1397
|
+
sessionId: string;
|
|
1398
|
+
sourceType: "session" | "booking";
|
|
1399
|
+
intent: "custom" | "deposit" | "balance";
|
|
1400
|
+
}>;
|
|
1401
|
+
deriveState: typeof deriveBookingEngineState;
|
|
1402
|
+
createSnapshot: typeof createBookingEngineSnapshot;
|
|
1403
|
+
canRunAction: typeof canRunBookingEngineAction;
|
|
1404
|
+
};
|
|
994
1405
|
checkout: {
|
|
995
1406
|
previewCollection: (bookingId: string, input: Parameters<typeof previewCheckoutCollection>[2], requestOptions?: Parameters<typeof previewCheckoutCollection>[3]) => Promise<{
|
|
996
1407
|
bookingId: string;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,6BAA6B,EAAE,MAAM,aAAa,CAAA;AAC1F,OAAO,EACL,yBAAyB,EACzB,2BAA2B,EAC3B,wBAAwB,EACzB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,0BAA0B,EAC1B,0BAA0B,EAC1B,wBAAwB,EAKxB,wBAAwB,EACxB,gCAAgC,EAEhC,0BAA0B,EAC1B,+BAA+B,EAC/B,+BAA+B,EAC/B,2BAA2B,EAC3B,yBAAyB,EACzB,+BAA+B,EAC/B,2BAA2B,EAC3B,0BAA0B,EAC1B,+BAA+B,EAChC,MAAM,iBAAiB,CAAA;AAExB,YAAY,EACV,yBAAyB,EACzB,wBAAwB,EACxB,6BAA6B,EAC7B,uBAAuB,GACxB,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,wBAAwB,EACxB,6BAA6B,EAC7B,wBAAwB,EACxB,yBAAyB,GAC1B,MAAM,aAAa,CAAA;AACpB,YAAY,EACV,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,yBAAyB,EACzB,2BAA2B,EAC3B,wBAAwB,EACxB,8BAA8B,GAC/B,MAAM,mBAAmB,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAE5B,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAU,CAAC,OAAO,2BAA2B,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIzE;AAED,MAAM,MAAM,sBAAsB,GAAG,UAAU,CAAC,OAAO,4BAA4B,CAAC,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { bootstrapBookingEnginePayment, confirmBookingEngineSession, expireBookingEngineSession, getBookingEngineOverview, getBookingEngineProgress, getBookingEngineSessionSnapshot, previewBookingEnginePayment, repriceBookingEngineSession, reserveBookingEngineSession, startBookingEnginePayment, updateBookingEngineProgress, updateBookingEngineSession, updateBookingEngineTravelers, } from "./booking-engine.js";
|
|
1
2
|
import { defaultStorefrontFetcher } from "./client.js";
|
|
2
3
|
import { canRunBookingEngineAction, createBookingEngineSnapshot, deriveBookingEngineState, } from "./engine-state.js";
|
|
3
4
|
import { bootstrapCheckoutCollection, confirmPublicBookingSession, createPublicBookingSession, expirePublicBookingSession, getPublicBookingOverview, getPublicBookingSession, getPublicBookingSessionState, getStorefrontDeparture, getStorefrontDepartureItinerary, getStorefrontOfferBySlug, getStorefrontProductAvailability, getStorefrontSettings, initiateCheckoutCollection, listStorefrontProductDepartures, listStorefrontProductExtensions, listStorefrontProductOffers, previewCheckoutCollection, previewStorefrontDeparturePrice, repricePublicBookingSession, updatePublicBookingSession, updatePublicBookingSessionState, } from "./operations.js";
|
|
5
|
+
export * from "./booking-engine.js";
|
|
4
6
|
export { defaultStorefrontFetcher, storefrontFetchWithValidation, VoyantStorefrontApiError, withStorefrontQueryParams, } from "./client.js";
|
|
5
7
|
export { bookingEngineActions, bookingEngineStates, canRunBookingEngineAction, createBookingEngineSnapshot, deriveBookingEngineState, getAllowedBookingEngineActions, } from "./engine-state.js";
|
|
8
|
+
export * from "./errors.js";
|
|
6
9
|
export * from "./operations.js";
|
|
7
10
|
export * from "./schemas.js";
|
|
8
11
|
export function createVoyantStorefrontClient(options) {
|
|
@@ -37,6 +40,24 @@ export function createVoyantStorefrontClient(options) {
|
|
|
37
40
|
createSnapshot: createBookingEngineSnapshot,
|
|
38
41
|
canRunAction: canRunBookingEngineAction,
|
|
39
42
|
},
|
|
43
|
+
bookingEngine: {
|
|
44
|
+
reserve: (input, requestOptions) => reserveBookingEngineSession(client, input, requestOptions),
|
|
45
|
+
getSnapshot: (sessionId) => getBookingEngineSessionSnapshot(client, sessionId),
|
|
46
|
+
updateSession: (sessionId, input, requestOptions) => updateBookingEngineSession(client, sessionId, input, requestOptions),
|
|
47
|
+
updateTravelers: (sessionId, input, requestOptions) => updateBookingEngineTravelers(client, sessionId, input, requestOptions),
|
|
48
|
+
getProgress: (sessionId) => getBookingEngineProgress(client, sessionId),
|
|
49
|
+
updateProgress: (sessionId, input, requestOptions) => updateBookingEngineProgress(client, sessionId, input, requestOptions),
|
|
50
|
+
reprice: (sessionId, input, requestOptions) => repriceBookingEngineSession(client, sessionId, input, requestOptions),
|
|
51
|
+
confirm: (sessionId, input, requestOptions) => confirmBookingEngineSession(client, sessionId, input, requestOptions),
|
|
52
|
+
expire: (sessionId, input, requestOptions) => expireBookingEngineSession(client, sessionId, input, requestOptions),
|
|
53
|
+
getOverview: (query) => getBookingEngineOverview(client, query),
|
|
54
|
+
previewPayment: (bookingId, input, requestOptions) => previewBookingEnginePayment(client, bookingId, input, requestOptions),
|
|
55
|
+
startPayment: (bookingId, input, requestOptions) => startBookingEnginePayment(client, bookingId, input, requestOptions),
|
|
56
|
+
bootstrapPayment: (input, requestOptions) => bootstrapBookingEnginePayment(client, input, requestOptions),
|
|
57
|
+
deriveState: deriveBookingEngineState,
|
|
58
|
+
createSnapshot: createBookingEngineSnapshot,
|
|
59
|
+
canRunAction: canRunBookingEngineAction,
|
|
60
|
+
},
|
|
40
61
|
checkout: {
|
|
41
62
|
previewCollection: (bookingId, input, requestOptions) => previewCheckoutCollection(client, bookingId, input, requestOptions),
|
|
42
63
|
initiateCollection: (bookingId, input, requestOptions) => initiateCheckoutCollection(client, bookingId, input, requestOptions),
|
package/dist/operations.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export declare function getStorefrontSettings(client: ResolvedClientOptions): Pr
|
|
|
20
20
|
fields: {
|
|
21
21
|
key: string;
|
|
22
22
|
label: string;
|
|
23
|
-
type: "
|
|
23
|
+
type: "date" | "email" | "text" | "select" | "country" | "tel" | "textarea" | "checkbox";
|
|
24
24
|
required: boolean;
|
|
25
25
|
placeholder: string | null;
|
|
26
26
|
description: string | null;
|
|
@@ -35,7 +35,7 @@ export declare function getStorefrontSettings(client: ResolvedClientOptions): Pr
|
|
|
35
35
|
fields: {
|
|
36
36
|
key: string;
|
|
37
37
|
label: string;
|
|
38
|
-
type: "
|
|
38
|
+
type: "date" | "email" | "text" | "select" | "country" | "tel" | "textarea" | "checkbox";
|
|
39
39
|
required: boolean;
|
|
40
40
|
placeholder: string | null;
|
|
41
41
|
description: string | null;
|
package/dist/schemas.d.ts
CHANGED
|
@@ -30,8 +30,8 @@ export declare const storefrontSettingsResponseSchema: z.ZodObject<{
|
|
|
30
30
|
key: z.ZodString;
|
|
31
31
|
label: z.ZodString;
|
|
32
32
|
type: z.ZodEnum<{
|
|
33
|
-
email: "email";
|
|
34
33
|
date: "date";
|
|
34
|
+
email: "email";
|
|
35
35
|
text: "text";
|
|
36
36
|
select: "select";
|
|
37
37
|
country: "country";
|
|
@@ -54,8 +54,8 @@ export declare const storefrontSettingsResponseSchema: z.ZodObject<{
|
|
|
54
54
|
key: z.ZodString;
|
|
55
55
|
label: z.ZodString;
|
|
56
56
|
type: z.ZodEnum<{
|
|
57
|
-
email: "email";
|
|
58
57
|
date: "date";
|
|
58
|
+
email: "email";
|
|
59
59
|
text: "text";
|
|
60
60
|
select: "select";
|
|
61
61
|
country: "country";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voyantjs/storefront-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -15,6 +15,11 @@
|
|
|
15
15
|
"import": "./dist/index.js",
|
|
16
16
|
"default": "./dist/index.js"
|
|
17
17
|
},
|
|
18
|
+
"./booking-engine": {
|
|
19
|
+
"types": "./dist/booking-engine.d.ts",
|
|
20
|
+
"import": "./dist/booking-engine.js",
|
|
21
|
+
"default": "./dist/booking-engine.js"
|
|
22
|
+
},
|
|
18
23
|
"./client": {
|
|
19
24
|
"types": "./dist/client.d.ts",
|
|
20
25
|
"import": "./dist/client.js",
|
|
@@ -25,6 +30,11 @@
|
|
|
25
30
|
"import": "./dist/engine-state.js",
|
|
26
31
|
"default": "./dist/engine-state.js"
|
|
27
32
|
},
|
|
33
|
+
"./errors": {
|
|
34
|
+
"types": "./dist/errors.d.ts",
|
|
35
|
+
"import": "./dist/errors.js",
|
|
36
|
+
"default": "./dist/errors.js"
|
|
37
|
+
},
|
|
28
38
|
"./operations": {
|
|
29
39
|
"types": "./dist/operations.d.ts",
|
|
30
40
|
"import": "./dist/operations.js",
|
|
@@ -38,17 +48,17 @@
|
|
|
38
48
|
},
|
|
39
49
|
"peerDependencies": {
|
|
40
50
|
"zod": "^4.0.0",
|
|
41
|
-
"@voyantjs/bookings": "0.
|
|
42
|
-
"@voyantjs/checkout": "0.
|
|
43
|
-
"@voyantjs/storefront": "0.
|
|
51
|
+
"@voyantjs/bookings": "0.37.0",
|
|
52
|
+
"@voyantjs/checkout": "0.37.0",
|
|
53
|
+
"@voyantjs/storefront": "0.37.0"
|
|
44
54
|
},
|
|
45
55
|
"devDependencies": {
|
|
46
56
|
"typescript": "^6.0.2",
|
|
47
57
|
"vitest": "^4.1.2",
|
|
48
58
|
"zod": "^4.3.6",
|
|
49
|
-
"@voyantjs/bookings": "0.
|
|
50
|
-
"@voyantjs/checkout": "0.
|
|
51
|
-
"@voyantjs/storefront": "0.
|
|
59
|
+
"@voyantjs/bookings": "0.37.0",
|
|
60
|
+
"@voyantjs/checkout": "0.37.0",
|
|
61
|
+
"@voyantjs/storefront": "0.37.0",
|
|
52
62
|
"@voyantjs/voyant-typescript-config": "0.1.0"
|
|
53
63
|
},
|
|
54
64
|
"files": [
|