@voyant-travel/storefront-sdk 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 +66 -0
- package/dist/booking-engine.d.ts +498 -0
- package/dist/booking-engine.d.ts.map +1 -0
- package/dist/booking-engine.js +56 -0
- package/dist/client.d.ts +24 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +98 -0
- package/dist/engine-state.d.ts +21 -0
- package/dist/engine-state.d.ts.map +1 -0
- package/dist/engine-state.js +124 -0
- 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 +2311 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +70 -0
- package/dist/operations.d.ts +1805 -0
- package/dist/operations.d.ts.map +1 -0
- package/dist/operations.js +92 -0
- package/dist/schemas.d.ts +2509 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +28 -0
- package/package.json +79 -0
|
@@ -0,0 +1,498 @@
|
|
|
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" | "email" | "download" | "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: "card" | "bank_transfer";
|
|
110
|
+
stage: "initial" | "reminder" | "manual";
|
|
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: "card" | "bank_transfer";
|
|
151
|
+
stage: "initial" | "reminder" | "manual";
|
|
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
|
+
legacyOrderId: string | null;
|
|
208
|
+
target: {
|
|
209
|
+
type: "booking";
|
|
210
|
+
bookingId: string;
|
|
211
|
+
} | {
|
|
212
|
+
type: "invoice";
|
|
213
|
+
invoiceId: string;
|
|
214
|
+
} | {
|
|
215
|
+
type: "booking_payment_schedule";
|
|
216
|
+
bookingPaymentScheduleId: string;
|
|
217
|
+
} | {
|
|
218
|
+
type: "booking_guarantee";
|
|
219
|
+
bookingGuaranteeId: string;
|
|
220
|
+
} | {
|
|
221
|
+
type: "flight_order";
|
|
222
|
+
flightOrderId: string;
|
|
223
|
+
} | {
|
|
224
|
+
type: "program";
|
|
225
|
+
programId: string;
|
|
226
|
+
} | {
|
|
227
|
+
type: "supplier_settlement";
|
|
228
|
+
supplierSettlementId: string;
|
|
229
|
+
} | {
|
|
230
|
+
type: "channel_settlement";
|
|
231
|
+
channelSettlementId: string;
|
|
232
|
+
} | {
|
|
233
|
+
type: "provider_reference";
|
|
234
|
+
provider: string;
|
|
235
|
+
reference: string;
|
|
236
|
+
} | {
|
|
237
|
+
type: "legacy_order";
|
|
238
|
+
legacyOrderId: string;
|
|
239
|
+
} | null;
|
|
240
|
+
provenance: {
|
|
241
|
+
source: "other" | "operator" | "storefront" | "customer_portal" | "payment_provider" | "supplier_channel" | "migration";
|
|
242
|
+
provider?: string | null | undefined;
|
|
243
|
+
reference?: string | null | undefined;
|
|
244
|
+
idempotencyKey?: string | null | undefined;
|
|
245
|
+
} | null;
|
|
246
|
+
id: string;
|
|
247
|
+
targetType: "other" | "invoice" | "booking" | "booking_payment_schedule" | "booking_guarantee" | "flight_order" | "order";
|
|
248
|
+
targetId: string | null;
|
|
249
|
+
bookingId: string | null;
|
|
250
|
+
invoiceId: string | null;
|
|
251
|
+
bookingPaymentScheduleId: string | null;
|
|
252
|
+
bookingGuaranteeId: string | null;
|
|
253
|
+
status: "expired" | "cancelled" | "pending" | "failed" | "requires_redirect" | "processing" | "authorized" | "paid";
|
|
254
|
+
provider: string | null;
|
|
255
|
+
providerSessionId: string | null;
|
|
256
|
+
providerPaymentId: string | null;
|
|
257
|
+
externalReference: string | null;
|
|
258
|
+
clientReference: string | null;
|
|
259
|
+
currency: string;
|
|
260
|
+
amountCents: number;
|
|
261
|
+
paymentMethod: "other" | "voucher" | "wallet" | "bank_transfer" | "credit_card" | "debit_card" | "cash" | "cheque" | "direct_bill" | null;
|
|
262
|
+
payerEmail: string | null;
|
|
263
|
+
payerName: string | null;
|
|
264
|
+
redirectUrl: string | null;
|
|
265
|
+
returnUrl: string | null;
|
|
266
|
+
cancelUrl: string | null;
|
|
267
|
+
expiresAt: string | null;
|
|
268
|
+
completedAt: string | null;
|
|
269
|
+
failureCode: string | null;
|
|
270
|
+
failureMessage: string | null;
|
|
271
|
+
notes: string | null;
|
|
272
|
+
} | null;
|
|
273
|
+
invoiceNotification: {
|
|
274
|
+
id: string;
|
|
275
|
+
templateSlug: string | null;
|
|
276
|
+
channel: "email" | "sms";
|
|
277
|
+
provider: string;
|
|
278
|
+
status: "cancelled" | "pending" | "failed" | "sent";
|
|
279
|
+
toAddress: string;
|
|
280
|
+
subject: string | null;
|
|
281
|
+
sentAt: string | null;
|
|
282
|
+
failedAt: string | null;
|
|
283
|
+
errorMessage: string | null;
|
|
284
|
+
} | null;
|
|
285
|
+
paymentSessionNotification: {
|
|
286
|
+
id: string;
|
|
287
|
+
templateSlug: string | null;
|
|
288
|
+
channel: "email" | "sms";
|
|
289
|
+
provider: string;
|
|
290
|
+
status: "cancelled" | "pending" | "failed" | "sent";
|
|
291
|
+
toAddress: string;
|
|
292
|
+
subject: string | null;
|
|
293
|
+
sentAt: string | null;
|
|
294
|
+
failedAt: string | null;
|
|
295
|
+
errorMessage: string | null;
|
|
296
|
+
} | null;
|
|
297
|
+
bankTransferInstructions: {
|
|
298
|
+
provider: string | null;
|
|
299
|
+
invoiceId: string;
|
|
300
|
+
invoiceNumber: string;
|
|
301
|
+
documentType: "invoice" | "proforma";
|
|
302
|
+
amountCents: number;
|
|
303
|
+
currency: string;
|
|
304
|
+
dueDate: string | null;
|
|
305
|
+
beneficiary: string;
|
|
306
|
+
iban: string;
|
|
307
|
+
bankName: string | null;
|
|
308
|
+
notes: string | null;
|
|
309
|
+
} | null;
|
|
310
|
+
providerStart: {
|
|
311
|
+
provider: string;
|
|
312
|
+
paymentSessionId: string;
|
|
313
|
+
redirectUrl: string | null;
|
|
314
|
+
externalReference: string | null;
|
|
315
|
+
providerSessionId: string | null;
|
|
316
|
+
providerPaymentId: string | null;
|
|
317
|
+
response: Record<string, unknown> | null;
|
|
318
|
+
} | null;
|
|
319
|
+
}>;
|
|
320
|
+
export declare function bootstrapBookingEnginePayment(client: ResolvedClientOptions, input: BootstrapCheckoutCollectionInput, options?: StorefrontRequestOptions): Promise<{
|
|
321
|
+
plan: {
|
|
322
|
+
bookingId: string;
|
|
323
|
+
method: "card" | "bank_transfer";
|
|
324
|
+
stage: "initial" | "reminder" | "manual";
|
|
325
|
+
paymentSessionTarget: "schedule" | "invoice" | null;
|
|
326
|
+
documentType: "invoice" | "proforma" | null;
|
|
327
|
+
willCreateDefaultPaymentPlan: boolean;
|
|
328
|
+
selectedSchedule: {
|
|
329
|
+
id: string;
|
|
330
|
+
bookingId: string;
|
|
331
|
+
bookingItemId: string | null;
|
|
332
|
+
scheduleType: string;
|
|
333
|
+
status: string;
|
|
334
|
+
dueDate: string;
|
|
335
|
+
currency: string;
|
|
336
|
+
amountCents: number;
|
|
337
|
+
notes: string | null;
|
|
338
|
+
} | null;
|
|
339
|
+
selectedInvoice: {
|
|
340
|
+
id: string;
|
|
341
|
+
invoiceNumber: string;
|
|
342
|
+
invoiceType: string;
|
|
343
|
+
bookingId: string;
|
|
344
|
+
personId: string | null;
|
|
345
|
+
organizationId: string | null;
|
|
346
|
+
status: string;
|
|
347
|
+
currency: string;
|
|
348
|
+
totalCents: number;
|
|
349
|
+
paidCents: number;
|
|
350
|
+
balanceDueCents: number;
|
|
351
|
+
issueDate: string;
|
|
352
|
+
dueDate: string;
|
|
353
|
+
notes: string | null;
|
|
354
|
+
createdAt: string;
|
|
355
|
+
updatedAt: string;
|
|
356
|
+
} | null;
|
|
357
|
+
amountCents: number;
|
|
358
|
+
currency: string;
|
|
359
|
+
recommendedAction: "none" | "create_bank_transfer_document" | "create_payment_session" | "create_invoice_then_payment_session";
|
|
360
|
+
};
|
|
361
|
+
invoice: {
|
|
362
|
+
id: string;
|
|
363
|
+
invoiceNumber: string;
|
|
364
|
+
invoiceType: string;
|
|
365
|
+
bookingId: string;
|
|
366
|
+
personId: string | null;
|
|
367
|
+
organizationId: string | null;
|
|
368
|
+
status: string;
|
|
369
|
+
currency: string;
|
|
370
|
+
totalCents: number;
|
|
371
|
+
paidCents: number;
|
|
372
|
+
balanceDueCents: number;
|
|
373
|
+
issueDate: string;
|
|
374
|
+
dueDate: string;
|
|
375
|
+
notes: string | null;
|
|
376
|
+
createdAt: string;
|
|
377
|
+
updatedAt: string;
|
|
378
|
+
} | null;
|
|
379
|
+
paymentSession: {
|
|
380
|
+
legacyOrderId: string | null;
|
|
381
|
+
target: {
|
|
382
|
+
type: "booking";
|
|
383
|
+
bookingId: string;
|
|
384
|
+
} | {
|
|
385
|
+
type: "invoice";
|
|
386
|
+
invoiceId: string;
|
|
387
|
+
} | {
|
|
388
|
+
type: "booking_payment_schedule";
|
|
389
|
+
bookingPaymentScheduleId: string;
|
|
390
|
+
} | {
|
|
391
|
+
type: "booking_guarantee";
|
|
392
|
+
bookingGuaranteeId: string;
|
|
393
|
+
} | {
|
|
394
|
+
type: "flight_order";
|
|
395
|
+
flightOrderId: string;
|
|
396
|
+
} | {
|
|
397
|
+
type: "program";
|
|
398
|
+
programId: string;
|
|
399
|
+
} | {
|
|
400
|
+
type: "supplier_settlement";
|
|
401
|
+
supplierSettlementId: string;
|
|
402
|
+
} | {
|
|
403
|
+
type: "channel_settlement";
|
|
404
|
+
channelSettlementId: string;
|
|
405
|
+
} | {
|
|
406
|
+
type: "provider_reference";
|
|
407
|
+
provider: string;
|
|
408
|
+
reference: string;
|
|
409
|
+
} | {
|
|
410
|
+
type: "legacy_order";
|
|
411
|
+
legacyOrderId: string;
|
|
412
|
+
} | null;
|
|
413
|
+
provenance: {
|
|
414
|
+
source: "other" | "operator" | "storefront" | "customer_portal" | "payment_provider" | "supplier_channel" | "migration";
|
|
415
|
+
provider?: string | null | undefined;
|
|
416
|
+
reference?: string | null | undefined;
|
|
417
|
+
idempotencyKey?: string | null | undefined;
|
|
418
|
+
} | null;
|
|
419
|
+
id: string;
|
|
420
|
+
targetType: "other" | "invoice" | "booking" | "booking_payment_schedule" | "booking_guarantee" | "flight_order" | "order";
|
|
421
|
+
targetId: string | null;
|
|
422
|
+
bookingId: string | null;
|
|
423
|
+
invoiceId: string | null;
|
|
424
|
+
bookingPaymentScheduleId: string | null;
|
|
425
|
+
bookingGuaranteeId: string | null;
|
|
426
|
+
status: "expired" | "cancelled" | "pending" | "failed" | "requires_redirect" | "processing" | "authorized" | "paid";
|
|
427
|
+
provider: string | null;
|
|
428
|
+
providerSessionId: string | null;
|
|
429
|
+
providerPaymentId: string | null;
|
|
430
|
+
externalReference: string | null;
|
|
431
|
+
clientReference: string | null;
|
|
432
|
+
currency: string;
|
|
433
|
+
amountCents: number;
|
|
434
|
+
paymentMethod: "other" | "voucher" | "wallet" | "bank_transfer" | "credit_card" | "debit_card" | "cash" | "cheque" | "direct_bill" | null;
|
|
435
|
+
payerEmail: string | null;
|
|
436
|
+
payerName: string | null;
|
|
437
|
+
redirectUrl: string | null;
|
|
438
|
+
returnUrl: string | null;
|
|
439
|
+
cancelUrl: string | null;
|
|
440
|
+
expiresAt: string | null;
|
|
441
|
+
completedAt: string | null;
|
|
442
|
+
failureCode: string | null;
|
|
443
|
+
failureMessage: string | null;
|
|
444
|
+
notes: string | null;
|
|
445
|
+
} | null;
|
|
446
|
+
invoiceNotification: {
|
|
447
|
+
id: string;
|
|
448
|
+
templateSlug: string | null;
|
|
449
|
+
channel: "email" | "sms";
|
|
450
|
+
provider: string;
|
|
451
|
+
status: "cancelled" | "pending" | "failed" | "sent";
|
|
452
|
+
toAddress: string;
|
|
453
|
+
subject: string | null;
|
|
454
|
+
sentAt: string | null;
|
|
455
|
+
failedAt: string | null;
|
|
456
|
+
errorMessage: string | null;
|
|
457
|
+
} | null;
|
|
458
|
+
paymentSessionNotification: {
|
|
459
|
+
id: string;
|
|
460
|
+
templateSlug: string | null;
|
|
461
|
+
channel: "email" | "sms";
|
|
462
|
+
provider: string;
|
|
463
|
+
status: "cancelled" | "pending" | "failed" | "sent";
|
|
464
|
+
toAddress: string;
|
|
465
|
+
subject: string | null;
|
|
466
|
+
sentAt: string | null;
|
|
467
|
+
failedAt: string | null;
|
|
468
|
+
errorMessage: string | null;
|
|
469
|
+
} | null;
|
|
470
|
+
bankTransferInstructions: {
|
|
471
|
+
provider: string | null;
|
|
472
|
+
invoiceId: string;
|
|
473
|
+
invoiceNumber: string;
|
|
474
|
+
documentType: "invoice" | "proforma";
|
|
475
|
+
amountCents: number;
|
|
476
|
+
currency: string;
|
|
477
|
+
dueDate: string | null;
|
|
478
|
+
beneficiary: string;
|
|
479
|
+
iban: string;
|
|
480
|
+
bankName: string | null;
|
|
481
|
+
notes: string | null;
|
|
482
|
+
} | null;
|
|
483
|
+
providerStart: {
|
|
484
|
+
provider: string;
|
|
485
|
+
paymentSessionId: string;
|
|
486
|
+
redirectUrl: string | null;
|
|
487
|
+
externalReference: string | null;
|
|
488
|
+
providerSessionId: string | null;
|
|
489
|
+
providerPaymentId: string | null;
|
|
490
|
+
response: Record<string, unknown> | null;
|
|
491
|
+
} | null;
|
|
492
|
+
bookingId: string;
|
|
493
|
+
sessionId: string;
|
|
494
|
+
sourceType: "session" | "booking";
|
|
495
|
+
intent: "custom" | "deposit" | "balance";
|
|
496
|
+
}>;
|
|
497
|
+
export {};
|
|
498
|
+
//# 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,KAAK,qBAA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,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
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import { type StorefrontApiErrorEnvelope } from "./errors.js";
|
|
3
|
+
export type VoyantStorefrontFetcher = (url: string, init?: RequestInit) => Promise<Response>;
|
|
4
|
+
export declare const defaultStorefrontFetcher: VoyantStorefrontFetcher;
|
|
5
|
+
export declare class VoyantStorefrontApiError extends Error {
|
|
6
|
+
readonly status: number;
|
|
7
|
+
readonly body: unknown;
|
|
8
|
+
readonly normalizedError: StorefrontApiErrorEnvelope | null;
|
|
9
|
+
constructor(message: string, status: number, body: unknown, normalizedError?: StorefrontApiErrorEnvelope | null);
|
|
10
|
+
}
|
|
11
|
+
export interface VoyantStorefrontClientOptions {
|
|
12
|
+
baseUrl: string;
|
|
13
|
+
fetcher?: VoyantStorefrontFetcher;
|
|
14
|
+
headers?: HeadersInit;
|
|
15
|
+
}
|
|
16
|
+
export interface StorefrontRequestOptions {
|
|
17
|
+
headers?: HeadersInit;
|
|
18
|
+
idempotencyKey?: string;
|
|
19
|
+
}
|
|
20
|
+
export type StorefrontQueryParamValue = string | number | boolean | null | undefined | Array<string | number | boolean>;
|
|
21
|
+
export declare function withStorefrontQueryParams(path: string, query?: object): string;
|
|
22
|
+
export declare function storefrontFetchWithValidation<TOut>(path: string, schema: z.ZodType<TOut>, options: Required<Pick<VoyantStorefrontClientOptions, "baseUrl" | "fetcher">> & Pick<VoyantStorefrontClientOptions, "headers">, init?: RequestInit): Promise<TOut>;
|
|
23
|
+
export declare function requestHeaders(options?: StorefrontRequestOptions): HeadersInit | undefined;
|
|
24
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"m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