@voyantjs/storefront 0.49.0 → 0.50.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 +36 -0
- package/dist/index.d.ts +6 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/routes-admin.d.ts +192 -0
- package/dist/routes-admin.d.ts.map +1 -0
- package/dist/routes-admin.js +28 -0
- package/dist/routes-public.d.ts +550 -15
- package/dist/routes-public.d.ts.map +1 -1
- package/dist/routes-public.js +68 -3
- package/dist/service-booking-session-bootstrap.d.ts +227 -0
- package/dist/service-booking-session-bootstrap.d.ts.map +1 -0
- package/dist/service-booking-session-bootstrap.js +297 -0
- package/dist/service-departures.d.ts +301 -2
- package/dist/service-departures.d.ts.map +1 -1
- package/dist/service-departures.js +406 -42
- package/dist/service.d.ts +600 -9
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +113 -2
- package/dist/validation-settings.d.ts +489 -0
- package/dist/validation-settings.d.ts.map +1 -0
- package/dist/validation-settings.js +205 -0
- package/dist/validation.d.ts +1260 -380
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +173 -126
- package/package.json +17 -10
package/dist/service.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { EventBus } from "@voyantjs/core";
|
|
2
2
|
import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
|
|
3
|
+
import { type StorefrontBookingSessionBootstrapOptions } from "./service-booking-session-bootstrap.js";
|
|
3
4
|
import { type StorefrontIntakeGuard, type StorefrontIntakeOptions } from "./service-intake.js";
|
|
4
|
-
import { type StorefrontDepartureListQuery, type StorefrontDeparturePricePreviewInput, type StorefrontLeadIntakeInput, type StorefrontNewsletterSubscribeInput, type StorefrontOfferApplyInput, type StorefrontOfferMutationResult, type StorefrontOfferRedeemInput, type StorefrontProductAvailabilitySummaryQuery, type StorefrontPromotionalOffer, type StorefrontSettings, type StorefrontSettingsInput } from "./validation.js";
|
|
5
|
+
import { type StorefrontBookingSessionBootstrapInput, type StorefrontDepartureListQuery, type StorefrontDeparturePricePreviewInput, type StorefrontLeadIntakeInput, type StorefrontNewsletterSubscribeInput, type StorefrontOfferApplyInput, type StorefrontOfferMutationResult, type StorefrontOfferRedeemInput, type StorefrontProductAvailabilitySummaryQuery, type StorefrontPromotionalOffer, type StorefrontSettings, type StorefrontSettingsInput, type StorefrontSettingsPatchInput } from "./validation.js";
|
|
5
6
|
import type { StorefrontTransportEligibilityInput, StorefrontTransportEligibilityResult, StorefrontTransportEligibilityRuleInput } from "./validation-transport-eligibility.js";
|
|
6
7
|
export interface StorefrontServiceOptions {
|
|
7
8
|
settings?: StorefrontSettingsInput;
|
|
8
9
|
resolveSettings?: (context: StorefrontRequestContext) => Promise<StorefrontSettingsInput> | StorefrontSettingsInput;
|
|
10
|
+
updateSettings?: (input: StorefrontSettings, context: StorefrontRequestContext) => Promise<StorefrontSettingsInput | StorefrontSettings> | StorefrontSettingsInput | StorefrontSettings;
|
|
9
11
|
offers?: StorefrontOfferResolvers;
|
|
10
12
|
resolveOffers?: (context: StorefrontRequestContext) => Promise<StorefrontOfferResolvers | null | undefined> | StorefrontOfferResolvers | null | undefined;
|
|
11
13
|
transportEligibilityRules?: StorefrontTransportEligibilityRuleInput[];
|
|
@@ -16,6 +18,7 @@ export interface StorefrontServiceOptions {
|
|
|
16
18
|
travelEndsOn?: string | null;
|
|
17
19
|
} & StorefrontRequestContext) => Promise<StorefrontTransportEligibilityRuleInput[]> | StorefrontTransportEligibilityRuleInput[];
|
|
18
20
|
intake?: StorefrontIntakeOptions;
|
|
21
|
+
bookingSessionBootstrap?: StorefrontBookingSessionBootstrapOptions;
|
|
19
22
|
}
|
|
20
23
|
export interface StorefrontRequestContext {
|
|
21
24
|
db?: PostgresJsDatabase;
|
|
@@ -42,22 +45,36 @@ export interface StorefrontOfferResolvers {
|
|
|
42
45
|
} & StorefrontRequestContext) => Promise<StorefrontOfferMutationResult> | StorefrontOfferMutationResult;
|
|
43
46
|
}
|
|
44
47
|
export declare function resolveStorefrontSettings(input?: StorefrontSettingsInput): StorefrontSettings;
|
|
48
|
+
export declare function mergeStorefrontSettingsPatch(current: StorefrontSettings, patch: StorefrontSettingsPatchInput): StorefrontSettings;
|
|
45
49
|
export declare function createStorefrontService(options?: StorefrontServiceOptions): {
|
|
46
50
|
getSettings(): StorefrontSettings;
|
|
47
51
|
resolveSettings: (context?: StorefrontRequestContext) => Promise<{
|
|
48
52
|
branding: {
|
|
49
53
|
logoUrl: string | null;
|
|
54
|
+
faviconUrl: string | null;
|
|
55
|
+
brandMarkUrl: string | null;
|
|
56
|
+
primaryColor: string | null;
|
|
57
|
+
accentColor: string | null;
|
|
50
58
|
supportedLanguages: string[];
|
|
51
59
|
};
|
|
52
60
|
support: {
|
|
53
61
|
email: string | null;
|
|
54
62
|
phone: string | null;
|
|
63
|
+
links: {
|
|
64
|
+
label: string;
|
|
65
|
+
url: string;
|
|
66
|
+
}[];
|
|
55
67
|
};
|
|
56
68
|
legal: {
|
|
57
69
|
termsUrl: string | null;
|
|
58
70
|
privacyUrl: string | null;
|
|
71
|
+
cancellationUrl: string | null;
|
|
59
72
|
defaultContractTemplateId: string | null;
|
|
60
73
|
};
|
|
74
|
+
localization: {
|
|
75
|
+
defaultLocale: string | null;
|
|
76
|
+
currencyDisplay: "symbol" | "name" | "code";
|
|
77
|
+
};
|
|
61
78
|
forms: {
|
|
62
79
|
billing: {
|
|
63
80
|
fields: {
|
|
@@ -91,15 +108,108 @@ export declare function createStorefrontService(options?: StorefrontServiceOptio
|
|
|
91
108
|
};
|
|
92
109
|
};
|
|
93
110
|
payment: {
|
|
94
|
-
defaultMethod: "voucher" | "bank_transfer" | "
|
|
111
|
+
defaultMethod: "voucher" | "bank_transfer" | "cash" | "invoice" | "card" | null;
|
|
95
112
|
methods: {
|
|
96
|
-
code: "voucher" | "bank_transfer" | "
|
|
113
|
+
code: "voucher" | "bank_transfer" | "cash" | "invoice" | "card";
|
|
97
114
|
label: string;
|
|
98
115
|
description: string | null;
|
|
99
116
|
enabled: boolean;
|
|
100
117
|
}[];
|
|
118
|
+
defaultSchedule: {
|
|
119
|
+
depositPercent: number | null;
|
|
120
|
+
balanceDueDaysBeforeDeparture: number | null;
|
|
121
|
+
} | null;
|
|
122
|
+
bankTransfer: {
|
|
123
|
+
accountHolder: string | null;
|
|
124
|
+
bankName: string | null;
|
|
125
|
+
iban: string | null;
|
|
126
|
+
bic: string | null;
|
|
127
|
+
paymentReference: string | null;
|
|
128
|
+
instructions: string | null;
|
|
129
|
+
} | null;
|
|
101
130
|
};
|
|
102
131
|
}>;
|
|
132
|
+
updateSettings: (patch: StorefrontSettingsPatchInput, context?: StorefrontRequestContext) => Promise<{
|
|
133
|
+
branding: {
|
|
134
|
+
logoUrl: string | null;
|
|
135
|
+
faviconUrl: string | null;
|
|
136
|
+
brandMarkUrl: string | null;
|
|
137
|
+
primaryColor: string | null;
|
|
138
|
+
accentColor: string | null;
|
|
139
|
+
supportedLanguages: string[];
|
|
140
|
+
};
|
|
141
|
+
support: {
|
|
142
|
+
email: string | null;
|
|
143
|
+
phone: string | null;
|
|
144
|
+
links: {
|
|
145
|
+
label: string;
|
|
146
|
+
url: string;
|
|
147
|
+
}[];
|
|
148
|
+
};
|
|
149
|
+
legal: {
|
|
150
|
+
termsUrl: string | null;
|
|
151
|
+
privacyUrl: string | null;
|
|
152
|
+
cancellationUrl: string | null;
|
|
153
|
+
defaultContractTemplateId: string | null;
|
|
154
|
+
};
|
|
155
|
+
localization: {
|
|
156
|
+
defaultLocale: string | null;
|
|
157
|
+
currencyDisplay: "symbol" | "name" | "code";
|
|
158
|
+
};
|
|
159
|
+
forms: {
|
|
160
|
+
billing: {
|
|
161
|
+
fields: {
|
|
162
|
+
key: string;
|
|
163
|
+
label: string;
|
|
164
|
+
type: "text" | "date" | "select" | "email" | "country" | "tel" | "textarea" | "checkbox";
|
|
165
|
+
required: boolean;
|
|
166
|
+
placeholder: string | null;
|
|
167
|
+
description: string | null;
|
|
168
|
+
autocomplete: string | null;
|
|
169
|
+
options: {
|
|
170
|
+
value: string;
|
|
171
|
+
label: string;
|
|
172
|
+
}[];
|
|
173
|
+
}[];
|
|
174
|
+
};
|
|
175
|
+
travelers: {
|
|
176
|
+
fields: {
|
|
177
|
+
key: string;
|
|
178
|
+
label: string;
|
|
179
|
+
type: "text" | "date" | "select" | "email" | "country" | "tel" | "textarea" | "checkbox";
|
|
180
|
+
required: boolean;
|
|
181
|
+
placeholder: string | null;
|
|
182
|
+
description: string | null;
|
|
183
|
+
autocomplete: string | null;
|
|
184
|
+
options: {
|
|
185
|
+
value: string;
|
|
186
|
+
label: string;
|
|
187
|
+
}[];
|
|
188
|
+
}[];
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
payment: {
|
|
192
|
+
defaultMethod: "voucher" | "bank_transfer" | "cash" | "invoice" | "card" | null;
|
|
193
|
+
methods: {
|
|
194
|
+
code: "voucher" | "bank_transfer" | "cash" | "invoice" | "card";
|
|
195
|
+
label: string;
|
|
196
|
+
description: string | null;
|
|
197
|
+
enabled: boolean;
|
|
198
|
+
}[];
|
|
199
|
+
defaultSchedule: {
|
|
200
|
+
depositPercent: number | null;
|
|
201
|
+
balanceDueDaysBeforeDeparture: number | null;
|
|
202
|
+
} | null;
|
|
203
|
+
bankTransfer: {
|
|
204
|
+
accountHolder: string | null;
|
|
205
|
+
bankName: string | null;
|
|
206
|
+
iban: string | null;
|
|
207
|
+
bic: string | null;
|
|
208
|
+
paymentReference: string | null;
|
|
209
|
+
instructions: string | null;
|
|
210
|
+
} | null;
|
|
211
|
+
};
|
|
212
|
+
} | null>;
|
|
103
213
|
getDeparture(db: PostgresJsDatabase, departureId: string): Promise<{
|
|
104
214
|
id: string;
|
|
105
215
|
productId: string;
|
|
@@ -195,7 +305,7 @@ export declare function createStorefrontService(options?: StorefrontServiceOptio
|
|
|
195
305
|
limit: number;
|
|
196
306
|
offset: number;
|
|
197
307
|
}>;
|
|
198
|
-
previewDeparturePrice(db: PostgresJsDatabase, departureId: string, input: StorefrontDeparturePricePreviewInput): Promise<{
|
|
308
|
+
previewDeparturePrice(db: PostgresJsDatabase, departureId: string, input: StorefrontDeparturePricePreviewInput, context?: StorefrontRequestContext): Promise<{
|
|
199
309
|
departureId: string;
|
|
200
310
|
productId: string;
|
|
201
311
|
optionId: string | null;
|
|
@@ -210,6 +320,272 @@ export declare function createStorefrontService(options?: StorefrontServiceOptio
|
|
|
210
320
|
quantity: number;
|
|
211
321
|
unitPrice: number;
|
|
212
322
|
}[];
|
|
323
|
+
allocation: {
|
|
324
|
+
slot: {
|
|
325
|
+
id: string;
|
|
326
|
+
productId: string;
|
|
327
|
+
optionId: string | null;
|
|
328
|
+
dateLocal: string | null;
|
|
329
|
+
startAt: string | null;
|
|
330
|
+
endAt: string | null;
|
|
331
|
+
timezone: string;
|
|
332
|
+
status: "cancelled" | "open" | "closed" | "sold_out" | "on_request";
|
|
333
|
+
availabilityState: "cancelled" | "closed" | "sold_out" | "past_cutoff" | "too_early" | "on_request" | "unavailable" | "available";
|
|
334
|
+
capacity: number | null;
|
|
335
|
+
remaining: number | null;
|
|
336
|
+
pastCutoff: boolean;
|
|
337
|
+
tooEarly: boolean;
|
|
338
|
+
};
|
|
339
|
+
pax: {
|
|
340
|
+
adults: number;
|
|
341
|
+
children: number;
|
|
342
|
+
infants: number;
|
|
343
|
+
total: number;
|
|
344
|
+
};
|
|
345
|
+
requestedUnits: {
|
|
346
|
+
unitId: string | null;
|
|
347
|
+
requestRef: string | null;
|
|
348
|
+
name: string;
|
|
349
|
+
unitType: string | null;
|
|
350
|
+
quantity: number;
|
|
351
|
+
pricingMode: string | null;
|
|
352
|
+
unitPrice: number;
|
|
353
|
+
total: number;
|
|
354
|
+
currencyCode: string;
|
|
355
|
+
tierId: string | null;
|
|
356
|
+
}[];
|
|
357
|
+
rooms: {
|
|
358
|
+
unitId: string;
|
|
359
|
+
name: string;
|
|
360
|
+
occupancy: number;
|
|
361
|
+
quantity: number;
|
|
362
|
+
pax: number;
|
|
363
|
+
pricingMode: string | null;
|
|
364
|
+
unitPrice: number;
|
|
365
|
+
total: number;
|
|
366
|
+
currencyCode: string;
|
|
367
|
+
tierId: string | null;
|
|
368
|
+
}[];
|
|
369
|
+
};
|
|
370
|
+
units: {
|
|
371
|
+
unitId: string | null;
|
|
372
|
+
requestRef: string | null;
|
|
373
|
+
name: string;
|
|
374
|
+
unitType: string | null;
|
|
375
|
+
quantity: number;
|
|
376
|
+
pricingMode: string | null;
|
|
377
|
+
unitPrice: number;
|
|
378
|
+
total: number;
|
|
379
|
+
currencyCode: string;
|
|
380
|
+
tierId: string | null;
|
|
381
|
+
}[];
|
|
382
|
+
rooms: {
|
|
383
|
+
unitId: string;
|
|
384
|
+
name: string;
|
|
385
|
+
occupancy: number;
|
|
386
|
+
quantity: number;
|
|
387
|
+
pax: number;
|
|
388
|
+
pricingMode: string | null;
|
|
389
|
+
unitPrice: number;
|
|
390
|
+
total: number;
|
|
391
|
+
currencyCode: string;
|
|
392
|
+
tierId: string | null;
|
|
393
|
+
}[];
|
|
394
|
+
extras: {
|
|
395
|
+
extraId: string;
|
|
396
|
+
name: string;
|
|
397
|
+
required: boolean;
|
|
398
|
+
selectable: boolean;
|
|
399
|
+
selected: boolean;
|
|
400
|
+
pricingMode: string;
|
|
401
|
+
quantity: number;
|
|
402
|
+
unitPrice: number;
|
|
403
|
+
total: number;
|
|
404
|
+
currencyCode: string;
|
|
405
|
+
}[];
|
|
406
|
+
offers: {
|
|
407
|
+
available: {
|
|
408
|
+
offer: {
|
|
409
|
+
id: string;
|
|
410
|
+
name: string;
|
|
411
|
+
slug: string | null;
|
|
412
|
+
description: string | null;
|
|
413
|
+
discountType: "percentage" | "fixed_amount";
|
|
414
|
+
discountValue: string;
|
|
415
|
+
currency: string | null;
|
|
416
|
+
applicableProductIds: string[];
|
|
417
|
+
applicableDepartureIds: string[];
|
|
418
|
+
validFrom: string | null;
|
|
419
|
+
validTo: string | null;
|
|
420
|
+
minTravelers: number | null;
|
|
421
|
+
imageMobileUrl: string | null;
|
|
422
|
+
imageDesktopUrl: string | null;
|
|
423
|
+
stackable: boolean;
|
|
424
|
+
createdAt: string;
|
|
425
|
+
updatedAt: string;
|
|
426
|
+
};
|
|
427
|
+
status: string;
|
|
428
|
+
reason: string | null;
|
|
429
|
+
selected: boolean;
|
|
430
|
+
discountAppliedCents: number;
|
|
431
|
+
discountedPriceCents: number;
|
|
432
|
+
}[];
|
|
433
|
+
requested: ({
|
|
434
|
+
kind: "slug";
|
|
435
|
+
value: string;
|
|
436
|
+
result: {
|
|
437
|
+
status: "applied" | "not_applicable" | "conflict" | "invalid";
|
|
438
|
+
reason: "scope" | "currency" | "booking_mismatch" | "conflict" | "min_pax" | "no_discount" | "offer_not_found" | "offer_expired" | "offer_not_yet_valid" | "code_not_found" | "code_required" | "code_expired" | "code_not_yet_valid" | "session_mismatch" | null;
|
|
439
|
+
offer: {
|
|
440
|
+
id: string;
|
|
441
|
+
name: string;
|
|
442
|
+
slug: string | null;
|
|
443
|
+
description: string | null;
|
|
444
|
+
discountType: "percentage" | "fixed_amount";
|
|
445
|
+
discountValue: string;
|
|
446
|
+
currency: string | null;
|
|
447
|
+
applicableProductIds: string[];
|
|
448
|
+
applicableDepartureIds: string[];
|
|
449
|
+
validFrom: string | null;
|
|
450
|
+
validTo: string | null;
|
|
451
|
+
minTravelers: number | null;
|
|
452
|
+
imageMobileUrl: string | null;
|
|
453
|
+
imageDesktopUrl: string | null;
|
|
454
|
+
stackable: boolean;
|
|
455
|
+
createdAt: string;
|
|
456
|
+
updatedAt: string;
|
|
457
|
+
} | null;
|
|
458
|
+
target: {
|
|
459
|
+
bookingId: string | null;
|
|
460
|
+
sessionId: string | null;
|
|
461
|
+
productId: string;
|
|
462
|
+
departureId: string | null;
|
|
463
|
+
};
|
|
464
|
+
pricing: {
|
|
465
|
+
basePriceCents: number;
|
|
466
|
+
currency: string;
|
|
467
|
+
discountAppliedCents: number;
|
|
468
|
+
discountedPriceCents: number;
|
|
469
|
+
};
|
|
470
|
+
appliedOffers: {
|
|
471
|
+
offerId: string;
|
|
472
|
+
offerName: string;
|
|
473
|
+
discountAppliedCents: number;
|
|
474
|
+
discountedPriceCents: number;
|
|
475
|
+
currency: string;
|
|
476
|
+
discountKind: "percentage" | "fixed_amount";
|
|
477
|
+
discountPercent: number | null;
|
|
478
|
+
discountAmountCents: number | null;
|
|
479
|
+
appliedCode: string | null;
|
|
480
|
+
stackable: boolean;
|
|
481
|
+
}[];
|
|
482
|
+
conflict: {
|
|
483
|
+
policy: "best_discount_wins" | "stackable_compose";
|
|
484
|
+
autoAppliedOfferIds: string[];
|
|
485
|
+
manualOfferId: string | null;
|
|
486
|
+
selectedOfferIds: string[];
|
|
487
|
+
message: string;
|
|
488
|
+
} | null;
|
|
489
|
+
} | null;
|
|
490
|
+
} | {
|
|
491
|
+
kind: "code";
|
|
492
|
+
value: string;
|
|
493
|
+
result: {
|
|
494
|
+
status: "applied" | "not_applicable" | "conflict" | "invalid";
|
|
495
|
+
reason: "scope" | "currency" | "booking_mismatch" | "conflict" | "min_pax" | "no_discount" | "offer_not_found" | "offer_expired" | "offer_not_yet_valid" | "code_not_found" | "code_required" | "code_expired" | "code_not_yet_valid" | "session_mismatch" | null;
|
|
496
|
+
offer: {
|
|
497
|
+
id: string;
|
|
498
|
+
name: string;
|
|
499
|
+
slug: string | null;
|
|
500
|
+
description: string | null;
|
|
501
|
+
discountType: "percentage" | "fixed_amount";
|
|
502
|
+
discountValue: string;
|
|
503
|
+
currency: string | null;
|
|
504
|
+
applicableProductIds: string[];
|
|
505
|
+
applicableDepartureIds: string[];
|
|
506
|
+
validFrom: string | null;
|
|
507
|
+
validTo: string | null;
|
|
508
|
+
minTravelers: number | null;
|
|
509
|
+
imageMobileUrl: string | null;
|
|
510
|
+
imageDesktopUrl: string | null;
|
|
511
|
+
stackable: boolean;
|
|
512
|
+
createdAt: string;
|
|
513
|
+
updatedAt: string;
|
|
514
|
+
} | null;
|
|
515
|
+
target: {
|
|
516
|
+
bookingId: string | null;
|
|
517
|
+
sessionId: string | null;
|
|
518
|
+
productId: string;
|
|
519
|
+
departureId: string | null;
|
|
520
|
+
};
|
|
521
|
+
pricing: {
|
|
522
|
+
basePriceCents: number;
|
|
523
|
+
currency: string;
|
|
524
|
+
discountAppliedCents: number;
|
|
525
|
+
discountedPriceCents: number;
|
|
526
|
+
};
|
|
527
|
+
appliedOffers: {
|
|
528
|
+
offerId: string;
|
|
529
|
+
offerName: string;
|
|
530
|
+
discountAppliedCents: number;
|
|
531
|
+
discountedPriceCents: number;
|
|
532
|
+
currency: string;
|
|
533
|
+
discountKind: "percentage" | "fixed_amount";
|
|
534
|
+
discountPercent: number | null;
|
|
535
|
+
discountAmountCents: number | null;
|
|
536
|
+
appliedCode: string | null;
|
|
537
|
+
stackable: boolean;
|
|
538
|
+
}[];
|
|
539
|
+
conflict: {
|
|
540
|
+
policy: "best_discount_wins" | "stackable_compose";
|
|
541
|
+
autoAppliedOfferIds: string[];
|
|
542
|
+
manualOfferId: string | null;
|
|
543
|
+
selectedOfferIds: string[];
|
|
544
|
+
message: string;
|
|
545
|
+
} | null;
|
|
546
|
+
} | null;
|
|
547
|
+
})[];
|
|
548
|
+
applied: {
|
|
549
|
+
offerId: string;
|
|
550
|
+
offerName: string;
|
|
551
|
+
discountAppliedCents: number;
|
|
552
|
+
discountedPriceCents: number;
|
|
553
|
+
currency: string;
|
|
554
|
+
discountKind: "percentage" | "fixed_amount";
|
|
555
|
+
discountPercent: number | null;
|
|
556
|
+
discountAmountCents: number | null;
|
|
557
|
+
appliedCode: string | null;
|
|
558
|
+
stackable: boolean;
|
|
559
|
+
}[];
|
|
560
|
+
conflict: {
|
|
561
|
+
policy: "best_discount_wins" | "stackable_compose";
|
|
562
|
+
autoAppliedOfferIds: string[];
|
|
563
|
+
manualOfferId: string | null;
|
|
564
|
+
selectedOfferIds: string[];
|
|
565
|
+
message: string;
|
|
566
|
+
} | {
|
|
567
|
+
policy: string;
|
|
568
|
+
autoAppliedOfferIds: string[];
|
|
569
|
+
manualOfferId: null;
|
|
570
|
+
selectedOfferIds: string[];
|
|
571
|
+
message: string;
|
|
572
|
+
} | null;
|
|
573
|
+
discountTotal: number;
|
|
574
|
+
discountTotalCents: number;
|
|
575
|
+
totalAfterDiscount: number;
|
|
576
|
+
currencyCode: string;
|
|
577
|
+
};
|
|
578
|
+
totals: {
|
|
579
|
+
currencyCode: string;
|
|
580
|
+
base: number;
|
|
581
|
+
extras: number;
|
|
582
|
+
subtotal: number;
|
|
583
|
+
discount: number;
|
|
584
|
+
tax: number;
|
|
585
|
+
total: number;
|
|
586
|
+
perPerson: number;
|
|
587
|
+
perBooking: number;
|
|
588
|
+
};
|
|
213
589
|
} | null>;
|
|
214
590
|
getProductExtensions(db: PostgresJsDatabase, productId: string, optionId?: string): Promise<{
|
|
215
591
|
extensions: {
|
|
@@ -257,7 +633,7 @@ export declare function createStorefrontService(options?: StorefrontServiceOptio
|
|
|
257
633
|
}>;
|
|
258
634
|
getProductAvailabilitySummary(db: PostgresJsDatabase, productId: string, query: StorefrontProductAvailabilitySummaryQuery): Promise<{
|
|
259
635
|
productId: string;
|
|
260
|
-
availabilityState: "cancelled" | "closed" | "sold_out" | "past_cutoff" | "too_early" | "
|
|
636
|
+
availabilityState: "cancelled" | "closed" | "sold_out" | "past_cutoff" | "too_early" | "on_request" | "unavailable" | "available";
|
|
261
637
|
counts: {
|
|
262
638
|
total: number;
|
|
263
639
|
open: number;
|
|
@@ -278,7 +654,7 @@ export declare function createStorefrontService(options?: StorefrontServiceOptio
|
|
|
278
654
|
endAt: string | null;
|
|
279
655
|
timezone: string;
|
|
280
656
|
status: "cancelled" | "open" | "closed" | "sold_out" | "on_request";
|
|
281
|
-
availabilityState: "cancelled" | "closed" | "sold_out" | "past_cutoff" | "too_early" | "
|
|
657
|
+
availabilityState: "cancelled" | "closed" | "sold_out" | "past_cutoff" | "too_early" | "on_request" | "unavailable" | "available";
|
|
282
658
|
capacity: number | null;
|
|
283
659
|
remaining: number | null;
|
|
284
660
|
pastCutoff: boolean;
|
|
@@ -314,6 +690,221 @@ export declare function createStorefrontService(options?: StorefrontServiceOptio
|
|
|
314
690
|
body: StorefrontTransportEligibilityInput;
|
|
315
691
|
context?: StorefrontRequestContext;
|
|
316
692
|
}): Promise<StorefrontTransportEligibilityResult>;
|
|
693
|
+
bootstrapBookingSession(context: StorefrontRequestContext & {
|
|
694
|
+
db: PostgresJsDatabase;
|
|
695
|
+
}, input: StorefrontBookingSessionBootstrapInput, userId?: string): Promise<{
|
|
696
|
+
status: Exclude<string, "ok">;
|
|
697
|
+
} | {
|
|
698
|
+
status: "stale_quote";
|
|
699
|
+
repricing: {
|
|
700
|
+
originalQuote: {
|
|
701
|
+
currencyCode: string;
|
|
702
|
+
totalSellAmountCents: number;
|
|
703
|
+
quotedAt?: string | null | undefined;
|
|
704
|
+
expiresAt?: string | null | undefined;
|
|
705
|
+
};
|
|
706
|
+
current: {
|
|
707
|
+
sessionId: string;
|
|
708
|
+
catalogId: string | null;
|
|
709
|
+
currencyCode: string;
|
|
710
|
+
totalSellAmountCents: number;
|
|
711
|
+
items: {
|
|
712
|
+
inputIndex: number;
|
|
713
|
+
itemId: string;
|
|
714
|
+
title: string;
|
|
715
|
+
productId: string | null;
|
|
716
|
+
optionId: string | null;
|
|
717
|
+
optionUnitId: string | null;
|
|
718
|
+
optionUnitName: string | null;
|
|
719
|
+
optionUnitType: string | null;
|
|
720
|
+
pricingCategoryId: string | null;
|
|
721
|
+
quantity: number;
|
|
722
|
+
pricingMode: string;
|
|
723
|
+
unitSellAmountCents: number | null;
|
|
724
|
+
totalSellAmountCents: number | null;
|
|
725
|
+
warnings: string[];
|
|
726
|
+
}[];
|
|
727
|
+
warnings: never[];
|
|
728
|
+
appliedToSession: boolean;
|
|
729
|
+
};
|
|
730
|
+
deltaAmountCents: number;
|
|
731
|
+
staleQuote: boolean;
|
|
732
|
+
};
|
|
733
|
+
bootstrap?: undefined;
|
|
734
|
+
} | {
|
|
735
|
+
status: "ok";
|
|
736
|
+
bootstrap: {
|
|
737
|
+
session: {
|
|
738
|
+
sessionId: string;
|
|
739
|
+
bookingNumber: string;
|
|
740
|
+
status: "completed" | "cancelled" | "draft" | "on_hold" | "awaiting_payment" | "confirmed" | "in_progress" | "expired";
|
|
741
|
+
externalBookingRef: string | null;
|
|
742
|
+
communicationLanguage: string | null;
|
|
743
|
+
sellCurrency: string;
|
|
744
|
+
sellAmountCents: number | null;
|
|
745
|
+
startDate: string | null;
|
|
746
|
+
endDate: string | null;
|
|
747
|
+
pax: number | null;
|
|
748
|
+
holdExpiresAt: string | null;
|
|
749
|
+
confirmedAt: string | null;
|
|
750
|
+
expiredAt: string | null;
|
|
751
|
+
cancelledAt: string | null;
|
|
752
|
+
completedAt: string | null;
|
|
753
|
+
travelers: {
|
|
754
|
+
id: string;
|
|
755
|
+
participantType: "other" | "traveler" | "occupant";
|
|
756
|
+
travelerCategory: "child" | "other" | "adult" | "infant" | "senior" | null;
|
|
757
|
+
firstName: string;
|
|
758
|
+
lastName: string;
|
|
759
|
+
email: string | null;
|
|
760
|
+
phone: string | null;
|
|
761
|
+
preferredLanguage: string | null;
|
|
762
|
+
specialRequests: string | null;
|
|
763
|
+
isPrimary: boolean;
|
|
764
|
+
notes: string | null;
|
|
765
|
+
}[];
|
|
766
|
+
items: {
|
|
767
|
+
id: string;
|
|
768
|
+
title: string;
|
|
769
|
+
description: string | null;
|
|
770
|
+
itemType: "service" | "other" | "unit" | "extra" | "fee" | "tax" | "discount" | "adjustment" | "accommodation" | "transport";
|
|
771
|
+
status: "cancelled" | "draft" | "on_hold" | "confirmed" | "expired" | "fulfilled";
|
|
772
|
+
serviceDate: string | null;
|
|
773
|
+
startsAt: string | null;
|
|
774
|
+
endsAt: string | null;
|
|
775
|
+
quantity: number;
|
|
776
|
+
sellCurrency: string;
|
|
777
|
+
unitSellAmountCents: number | null;
|
|
778
|
+
totalSellAmountCents: number | null;
|
|
779
|
+
costCurrency: string | null;
|
|
780
|
+
unitCostAmountCents: number | null;
|
|
781
|
+
totalCostAmountCents: number | null;
|
|
782
|
+
notes: string | null;
|
|
783
|
+
productId: string | null;
|
|
784
|
+
optionId: string | null;
|
|
785
|
+
optionUnitId: string | null;
|
|
786
|
+
pricingCategoryId: string | null;
|
|
787
|
+
travelerLinks: {
|
|
788
|
+
id: string;
|
|
789
|
+
travelerId: string;
|
|
790
|
+
role: string;
|
|
791
|
+
isPrimary: boolean;
|
|
792
|
+
}[];
|
|
793
|
+
}[];
|
|
794
|
+
allocations: {
|
|
795
|
+
id: string;
|
|
796
|
+
bookingItemId: string;
|
|
797
|
+
productId: string | null;
|
|
798
|
+
optionId: string | null;
|
|
799
|
+
optionUnitId: string | null;
|
|
800
|
+
pricingCategoryId: string | null;
|
|
801
|
+
availabilitySlotId: string | null;
|
|
802
|
+
quantity: number;
|
|
803
|
+
allocationType: "resource" | "pickup" | "unit";
|
|
804
|
+
status: "cancelled" | "confirmed" | "expired" | "fulfilled" | "held" | "released";
|
|
805
|
+
holdExpiresAt: string | null;
|
|
806
|
+
confirmedAt: string | null;
|
|
807
|
+
releasedAt: string | null;
|
|
808
|
+
}[];
|
|
809
|
+
checklist: {
|
|
810
|
+
hasTravelers: boolean;
|
|
811
|
+
hasPrimaryTraveler: boolean;
|
|
812
|
+
hasItems: boolean;
|
|
813
|
+
hasAllocations: boolean;
|
|
814
|
+
readyForConfirmation: boolean;
|
|
815
|
+
};
|
|
816
|
+
state: {
|
|
817
|
+
sessionId: string;
|
|
818
|
+
stateKey: "wizard";
|
|
819
|
+
currentStep: string | null;
|
|
820
|
+
completedSteps: string[];
|
|
821
|
+
payload: Record<string, unknown>;
|
|
822
|
+
version: number;
|
|
823
|
+
createdAt: string;
|
|
824
|
+
updatedAt: string;
|
|
825
|
+
} | null;
|
|
826
|
+
};
|
|
827
|
+
paymentPlan: {
|
|
828
|
+
source: "storefront_default";
|
|
829
|
+
depositKind: import("@voyantjs/finance").DepositKind;
|
|
830
|
+
depositPercent: number | null;
|
|
831
|
+
depositAmountCents: number | null;
|
|
832
|
+
requiresFullPayment: boolean;
|
|
833
|
+
};
|
|
834
|
+
paymentSchedule: {
|
|
835
|
+
id: string;
|
|
836
|
+
scheduleType: "other" | "deposit" | "installment" | "balance" | "hold";
|
|
837
|
+
status: "pending" | "cancelled" | "expired" | "paid" | "due" | "waived";
|
|
838
|
+
dueDate: string;
|
|
839
|
+
currency: string;
|
|
840
|
+
amountCents: number;
|
|
841
|
+
notes: string | null;
|
|
842
|
+
}[];
|
|
843
|
+
repricing: {
|
|
844
|
+
originalQuote: {
|
|
845
|
+
currencyCode: string;
|
|
846
|
+
totalSellAmountCents: number;
|
|
847
|
+
quotedAt?: string | null | undefined;
|
|
848
|
+
expiresAt?: string | null | undefined;
|
|
849
|
+
};
|
|
850
|
+
current: {
|
|
851
|
+
sessionId: string;
|
|
852
|
+
items: {
|
|
853
|
+
itemId: string;
|
|
854
|
+
title: string;
|
|
855
|
+
productId: string | null;
|
|
856
|
+
optionId: string | null;
|
|
857
|
+
optionUnitId: string | null;
|
|
858
|
+
optionUnitName: string | null;
|
|
859
|
+
optionUnitType: string | null;
|
|
860
|
+
pricingCategoryId: string | null;
|
|
861
|
+
quantity: number;
|
|
862
|
+
pricingMode: string;
|
|
863
|
+
unitSellAmountCents: number | null;
|
|
864
|
+
totalSellAmountCents: number | null;
|
|
865
|
+
warnings: string[];
|
|
866
|
+
}[];
|
|
867
|
+
catalogId: string | null;
|
|
868
|
+
currencyCode: string;
|
|
869
|
+
totalSellAmountCents: number;
|
|
870
|
+
warnings: never[];
|
|
871
|
+
appliedToSession: boolean;
|
|
872
|
+
};
|
|
873
|
+
deltaAmountCents: number;
|
|
874
|
+
staleQuote: boolean;
|
|
875
|
+
};
|
|
876
|
+
availability: {
|
|
877
|
+
departureId: string;
|
|
878
|
+
slotId: string;
|
|
879
|
+
productId: string;
|
|
880
|
+
optionId: string | null;
|
|
881
|
+
dateLocal: string;
|
|
882
|
+
startsAt: string | null;
|
|
883
|
+
endsAt: string | null;
|
|
884
|
+
timezone: string;
|
|
885
|
+
status: "cancelled" | "open" | "closed" | "sold_out";
|
|
886
|
+
capacity: number | null;
|
|
887
|
+
remaining: number | null;
|
|
888
|
+
};
|
|
889
|
+
allocation: {
|
|
890
|
+
id: string;
|
|
891
|
+
bookingItemId: string;
|
|
892
|
+
productId: string | null;
|
|
893
|
+
optionId: string | null;
|
|
894
|
+
optionUnitId: string | null;
|
|
895
|
+
pricingCategoryId: string | null;
|
|
896
|
+
availabilitySlotId: string | null;
|
|
897
|
+
quantity: number;
|
|
898
|
+
allocationType: "resource" | "pickup" | "unit";
|
|
899
|
+
status: "cancelled" | "confirmed" | "expired" | "fulfilled" | "held" | "released";
|
|
900
|
+
holdExpiresAt: string | null;
|
|
901
|
+
confirmedAt: string | null;
|
|
902
|
+
releasedAt: string | null;
|
|
903
|
+
}[];
|
|
904
|
+
currency: string;
|
|
905
|
+
};
|
|
906
|
+
repricing?: undefined;
|
|
907
|
+
}>;
|
|
317
908
|
listApplicableOffers(input: {
|
|
318
909
|
productId: string;
|
|
319
910
|
departureId?: string;
|
|
@@ -350,7 +941,7 @@ export declare function createStorefrontService(options?: StorefrontServiceOptio
|
|
|
350
941
|
id: string;
|
|
351
942
|
personId: string;
|
|
352
943
|
kind: "wishlist" | "notify" | "inquiry" | "request_offer" | "referral";
|
|
353
|
-
source: "admin" | "form" | "phone" | "
|
|
944
|
+
source: "admin" | "form" | "phone" | "booking" | "website" | "abandoned_cart";
|
|
354
945
|
status: "expired" | "converted" | "lost" | "new" | "contacted" | "qualified";
|
|
355
946
|
duplicate: boolean;
|
|
356
947
|
}>;
|
|
@@ -361,10 +952,10 @@ export declare function createStorefrontService(options?: StorefrontServiceOptio
|
|
|
361
952
|
id: string;
|
|
362
953
|
personId: string;
|
|
363
954
|
kind: "wishlist" | "notify" | "inquiry" | "request_offer" | "referral";
|
|
364
|
-
source: "admin" | "form" | "phone" | "
|
|
955
|
+
source: "admin" | "form" | "phone" | "booking" | "website" | "abandoned_cart";
|
|
365
956
|
status: "expired" | "converted" | "lost" | "new" | "contacted" | "qualified";
|
|
366
957
|
duplicate: boolean;
|
|
367
|
-
doubleOptIn: "
|
|
958
|
+
doubleOptIn: "requested" | "not_configured";
|
|
368
959
|
}>;
|
|
369
960
|
};
|
|
370
961
|
export type { StorefrontIntakeGuard, StorefrontIntakeOptions };
|