@voyantjs/storefront 0.47.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 +75 -0
- package/dist/index.d.ts +8 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -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 +598 -10
- package/dist/routes-public.d.ts.map +1 -1
- package/dist/routes-public.js +104 -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-intake.d.ts +40 -0
- package/dist/service-intake.d.ts.map +1 -0
- package/dist/service-intake.js +231 -0
- package/dist/service.d.ts +634 -6
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +127 -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 +1458 -433
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +238 -124
- package/package.json +17 -9
package/dist/validation.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,YAAY,EACV,sBAAsB,EACtB,2BAA2B,EAC3B,yBAAyB,EACzB,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,EACvB,2BAA2B,EAC3B,4BAA4B,EAC5B,yBAAyB,EACzB,8BAA8B,EAC9B,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,iCAAiC,GAAG,CAAC,CAAC,KAAK,CACrD,OAAO,uCAAuC,CAC/C,CAAA;AACD,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAA;AACzF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAA;AACvF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAA;AACzF,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAA;AACjF,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mCAAmC,CAAC,CAAA"}
|
package/dist/validation.js
CHANGED
|
@@ -1,132 +1,77 @@
|
|
|
1
1
|
import { availabilitySlotStatusSchema } from "@voyantjs/availability/validation";
|
|
2
|
+
import { publicBookingSessionAllocationSchema, publicBookingSessionRepriceSummarySchema, publicBookingSessionSchema, publicCreateBookingSessionSchema, } from "@voyantjs/bookings/public-validation";
|
|
3
|
+
import { customerSignalKindSchema, customerSignalSourceSchema, customerSignalStatusSchema, } from "@voyantjs/crm/validation";
|
|
2
4
|
import { extraPricingModeSchema } from "@voyantjs/extras/validation";
|
|
5
|
+
import { publicBookingPaymentScheduleSchema } from "@voyantjs/finance/public-validation";
|
|
3
6
|
import { z } from "zod";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
});
|
|
30
|
-
export const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
description: z.string().trim().min(1).nullable(),
|
|
47
|
-
autocomplete: z.string().trim().min(1).nullable(),
|
|
48
|
-
options: z.array(storefrontFormFieldOptionSchema),
|
|
49
|
-
});
|
|
50
|
-
export const storefrontPaymentMethodInputSchema = z.object({
|
|
51
|
-
code: storefrontPaymentMethodCodeSchema,
|
|
52
|
-
label: z.string().trim().min(1).optional(),
|
|
53
|
-
description: z.string().trim().min(1).optional().nullable(),
|
|
54
|
-
enabled: z.boolean().default(true),
|
|
55
|
-
});
|
|
56
|
-
export const storefrontPaymentMethodSchema = z.object({
|
|
57
|
-
code: storefrontPaymentMethodCodeSchema,
|
|
58
|
-
label: z.string().trim().min(1),
|
|
59
|
-
description: z.string().trim().min(1).nullable(),
|
|
60
|
-
enabled: z.boolean(),
|
|
61
|
-
});
|
|
62
|
-
export const storefrontSettingsInputSchema = z.object({
|
|
63
|
-
branding: z
|
|
64
|
-
.object({
|
|
65
|
-
logoUrl: z.url().optional().nullable(),
|
|
66
|
-
supportedLanguages: z.array(languageTagSchema).optional(),
|
|
67
|
-
})
|
|
68
|
-
.optional(),
|
|
69
|
-
support: z
|
|
70
|
-
.object({
|
|
71
|
-
email: z.email().optional().nullable(),
|
|
72
|
-
phone: z.string().trim().min(1).optional().nullable(),
|
|
73
|
-
})
|
|
74
|
-
.optional(),
|
|
75
|
-
legal: z
|
|
76
|
-
.object({
|
|
77
|
-
termsUrl: z.url().optional().nullable(),
|
|
78
|
-
privacyUrl: z.url().optional().nullable(),
|
|
79
|
-
defaultContractTemplateId: z.string().trim().min(1).optional().nullable(),
|
|
80
|
-
})
|
|
81
|
-
.optional(),
|
|
82
|
-
forms: z
|
|
83
|
-
.object({
|
|
84
|
-
billing: z
|
|
85
|
-
.object({
|
|
86
|
-
fields: z.array(storefrontFormFieldInputSchema).default([]),
|
|
87
|
-
})
|
|
88
|
-
.optional(),
|
|
89
|
-
travelers: z
|
|
90
|
-
.object({
|
|
91
|
-
fields: z.array(storefrontFormFieldInputSchema).default([]),
|
|
92
|
-
})
|
|
93
|
-
.optional(),
|
|
94
|
-
})
|
|
95
|
-
.optional(),
|
|
96
|
-
payment: z
|
|
97
|
-
.object({
|
|
98
|
-
defaultMethod: storefrontPaymentMethodCodeSchema.optional().nullable(),
|
|
99
|
-
methods: z.array(storefrontPaymentMethodInputSchema).optional(),
|
|
100
|
-
})
|
|
101
|
-
.optional(),
|
|
102
|
-
});
|
|
103
|
-
export const storefrontSettingsSchema = z.object({
|
|
104
|
-
branding: z.object({
|
|
105
|
-
logoUrl: urlOrNullSchema,
|
|
106
|
-
supportedLanguages: z.array(languageTagSchema),
|
|
107
|
-
}),
|
|
108
|
-
support: z.object({
|
|
109
|
-
email: z.email().nullable(),
|
|
110
|
-
phone: z.string().trim().min(1).nullable(),
|
|
111
|
-
}),
|
|
112
|
-
legal: z.object({
|
|
113
|
-
termsUrl: urlOrNullSchema,
|
|
114
|
-
privacyUrl: urlOrNullSchema,
|
|
115
|
-
defaultContractTemplateId: z.string().trim().min(1).nullable(),
|
|
116
|
-
}),
|
|
117
|
-
forms: z.object({
|
|
118
|
-
billing: z.object({
|
|
119
|
-
fields: z.array(storefrontFormFieldSchema),
|
|
120
|
-
}),
|
|
121
|
-
travelers: z.object({
|
|
122
|
-
fields: z.array(storefrontFormFieldSchema),
|
|
123
|
-
}),
|
|
124
|
-
}),
|
|
125
|
-
payment: z.object({
|
|
126
|
-
defaultMethod: storefrontPaymentMethodCodeSchema.nullable(),
|
|
127
|
-
methods: z.array(storefrontPaymentMethodSchema),
|
|
7
|
+
import { languageTagSchema } from "./validation-settings.js";
|
|
8
|
+
export { storefrontBankTransferInputSchema, storefrontBankTransferSchema, storefrontCurrencyDisplaySchema, storefrontFormFieldInputSchema, storefrontFormFieldOptionSchema, storefrontFormFieldSchema, storefrontFormFieldTypeSchema, storefrontPaymentMethodCodeSchema, storefrontPaymentMethodInputSchema, storefrontPaymentMethodSchema, storefrontPaymentScheduleInputSchema, storefrontPaymentScheduleSchema, storefrontSettingsInputSchema, storefrontSettingsPatchSchema, storefrontSettingsSchema, storefrontSupportLinkInputSchema, storefrontSupportLinkSchema, } from "./validation-settings.js";
|
|
9
|
+
const boundedRecordSchema = z
|
|
10
|
+
.record(z.string(), z.unknown())
|
|
11
|
+
.refine((value) => JSON.stringify(value).length <= 8000, {
|
|
12
|
+
message: "Object payload must be 8KB or smaller",
|
|
13
|
+
});
|
|
14
|
+
const storefrontIntakeTagsSchema = z.array(z.string().trim().min(1).max(64)).max(20).default([]);
|
|
15
|
+
export const storefrontIntakeConsentSchema = z.object({
|
|
16
|
+
marketing: z.boolean().default(false),
|
|
17
|
+
newsletter: z.boolean().default(false),
|
|
18
|
+
gdpr: z.boolean().default(false),
|
|
19
|
+
scope: z.string().trim().min(1).max(120).nullable().optional(),
|
|
20
|
+
acceptedAt: z.string().datetime().nullable().optional(),
|
|
21
|
+
});
|
|
22
|
+
export const storefrontLeadContactSchema = z
|
|
23
|
+
.object({
|
|
24
|
+
name: z.string().trim().min(1).max(240).optional(),
|
|
25
|
+
firstName: z.string().trim().min(1).max(120).optional(),
|
|
26
|
+
lastName: z.string().trim().min(1).max(120).optional(),
|
|
27
|
+
email: z.email().max(320).optional(),
|
|
28
|
+
phone: z.string().trim().min(3).max(64).optional(),
|
|
29
|
+
})
|
|
30
|
+
.refine((value) => Boolean(value.email || value.phone), {
|
|
31
|
+
message: "Either contact.email or contact.phone is required",
|
|
32
|
+
});
|
|
33
|
+
export const storefrontLeadIntakeInputSchema = z.object({
|
|
34
|
+
kind: customerSignalKindSchema.default("inquiry"),
|
|
35
|
+
source: customerSignalSourceSchema.default("website"),
|
|
36
|
+
contact: storefrontLeadContactSchema,
|
|
37
|
+
productId: z.string().trim().min(1).max(160).nullable().optional(),
|
|
38
|
+
optionUnitId: z.string().trim().min(1).max(160).nullable().optional(),
|
|
39
|
+
notes: z.string().trim().max(4000).nullable().optional(),
|
|
40
|
+
tags: storefrontIntakeTagsSchema,
|
|
41
|
+
sourceSubmissionId: z.string().trim().min(1).max(160).nullable().optional(),
|
|
42
|
+
sourceUrl: z.url().nullable().optional(),
|
|
43
|
+
locale: languageTagSchema.optional(),
|
|
44
|
+
payload: boundedRecordSchema.default({}),
|
|
45
|
+
consent: storefrontIntakeConsentSchema.default({
|
|
46
|
+
marketing: false,
|
|
47
|
+
newsletter: false,
|
|
48
|
+
gdpr: false,
|
|
128
49
|
}),
|
|
129
50
|
});
|
|
51
|
+
export const storefrontNewsletterSubscribeInputSchema = z.object({
|
|
52
|
+
email: z.email().max(320),
|
|
53
|
+
name: z.string().trim().min(1).max(240).optional(),
|
|
54
|
+
firstName: z.string().trim().min(1).max(120).optional(),
|
|
55
|
+
lastName: z.string().trim().min(1).max(120).optional(),
|
|
56
|
+
source: customerSignalSourceSchema.default("website"),
|
|
57
|
+
sourceSubmissionId: z.string().trim().min(1).max(160).nullable().optional(),
|
|
58
|
+
sourceUrl: z.url().nullable().optional(),
|
|
59
|
+
locale: languageTagSchema.optional(),
|
|
60
|
+
tags: storefrontIntakeTagsSchema,
|
|
61
|
+
payload: boundedRecordSchema.default({}),
|
|
62
|
+
consent: storefrontIntakeConsentSchema.extend({ newsletter: z.literal(true) }),
|
|
63
|
+
});
|
|
64
|
+
export const storefrontIntakeResponseSchema = z.object({
|
|
65
|
+
id: z.string(),
|
|
66
|
+
personId: z.string(),
|
|
67
|
+
kind: customerSignalKindSchema,
|
|
68
|
+
source: customerSignalSourceSchema,
|
|
69
|
+
status: customerSignalStatusSchema,
|
|
70
|
+
duplicate: z.boolean(),
|
|
71
|
+
});
|
|
72
|
+
export const storefrontNewsletterSubscribeResponseSchema = storefrontIntakeResponseSchema.extend({
|
|
73
|
+
doubleOptIn: z.enum(["not_configured", "requested"]),
|
|
74
|
+
});
|
|
130
75
|
export const storefrontDepartureStatusSchema = z.enum([
|
|
131
76
|
"open",
|
|
132
77
|
"closed",
|
|
@@ -276,6 +221,14 @@ export const storefrontDeparturePricePreviewInputSchema = z.object({
|
|
|
276
221
|
quantity: z.coerce.number().int().min(1).default(1),
|
|
277
222
|
}))
|
|
278
223
|
.default([]),
|
|
224
|
+
offers: z
|
|
225
|
+
.array(z.object({
|
|
226
|
+
slug: z.string().trim().min(1).max(120),
|
|
227
|
+
}))
|
|
228
|
+
.default([]),
|
|
229
|
+
offerCode: z.string().trim().min(1).max(80).optional().nullable(),
|
|
230
|
+
locale: languageTagSchema.optional(),
|
|
231
|
+
market: z.string().trim().min(1).default("default"),
|
|
279
232
|
});
|
|
280
233
|
export const storefrontDeparturePriceLineItemSchema = z.object({
|
|
281
234
|
name: z.string(),
|
|
@@ -283,6 +236,103 @@ export const storefrontDeparturePriceLineItemSchema = z.object({
|
|
|
283
236
|
quantity: z.number().int().min(1),
|
|
284
237
|
unitPrice: z.number(),
|
|
285
238
|
});
|
|
239
|
+
export const storefrontDeparturePriceSlotSchema = z.object({
|
|
240
|
+
id: z.string(),
|
|
241
|
+
productId: z.string(),
|
|
242
|
+
optionId: z.string().nullable(),
|
|
243
|
+
dateLocal: z.string().nullable(),
|
|
244
|
+
startAt: z.string().nullable(),
|
|
245
|
+
endAt: z.string().nullable(),
|
|
246
|
+
timezone: z.string(),
|
|
247
|
+
status: storefrontDepartureStatusSchema,
|
|
248
|
+
availabilityState: storefrontProductAvailabilityStateSchema,
|
|
249
|
+
capacity: z.number().int().nullable(),
|
|
250
|
+
remaining: z.number().int().nullable(),
|
|
251
|
+
pastCutoff: z.boolean(),
|
|
252
|
+
tooEarly: z.boolean(),
|
|
253
|
+
});
|
|
254
|
+
export const storefrontDeparturePricePaxSchema = z.object({
|
|
255
|
+
adults: z.number().int().min(0),
|
|
256
|
+
children: z.number().int().min(0),
|
|
257
|
+
infants: z.number().int().min(0),
|
|
258
|
+
total: z.number().int().min(1),
|
|
259
|
+
});
|
|
260
|
+
export const storefrontDeparturePriceUnitRowSchema = z.object({
|
|
261
|
+
unitId: z.string().nullable(),
|
|
262
|
+
requestRef: z.string().nullable(),
|
|
263
|
+
name: z.string(),
|
|
264
|
+
unitType: z.string().nullable(),
|
|
265
|
+
quantity: z.number().int().min(1),
|
|
266
|
+
pricingMode: z.string().nullable(),
|
|
267
|
+
unitPrice: z.number(),
|
|
268
|
+
total: z.number(),
|
|
269
|
+
currencyCode: z.string(),
|
|
270
|
+
tierId: z.string().nullable(),
|
|
271
|
+
});
|
|
272
|
+
export const storefrontDeparturePriceRoomRowSchema = z.object({
|
|
273
|
+
unitId: z.string(),
|
|
274
|
+
name: z.string(),
|
|
275
|
+
occupancy: z.number().int().min(1),
|
|
276
|
+
quantity: z.number().int().min(1),
|
|
277
|
+
pax: z.number().int().min(1),
|
|
278
|
+
pricingMode: z.string().nullable(),
|
|
279
|
+
unitPrice: z.number(),
|
|
280
|
+
total: z.number(),
|
|
281
|
+
currencyCode: z.string(),
|
|
282
|
+
tierId: z.string().nullable(),
|
|
283
|
+
});
|
|
284
|
+
export const storefrontDeparturePriceAllocationSchema = z.object({
|
|
285
|
+
slot: storefrontDeparturePriceSlotSchema,
|
|
286
|
+
pax: storefrontDeparturePricePaxSchema,
|
|
287
|
+
requestedUnits: z.array(storefrontDeparturePriceUnitRowSchema),
|
|
288
|
+
rooms: z.array(storefrontDeparturePriceRoomRowSchema),
|
|
289
|
+
});
|
|
290
|
+
export const storefrontDeparturePriceExtraImpactSchema = z.object({
|
|
291
|
+
extraId: z.string(),
|
|
292
|
+
name: z.string(),
|
|
293
|
+
required: z.boolean(),
|
|
294
|
+
selectable: z.boolean(),
|
|
295
|
+
selected: z.boolean(),
|
|
296
|
+
pricingMode: z.lazy(() => extraPricingModeSchema),
|
|
297
|
+
quantity: z.number().int().min(0),
|
|
298
|
+
unitPrice: z.number(),
|
|
299
|
+
total: z.number(),
|
|
300
|
+
currencyCode: z.string(),
|
|
301
|
+
});
|
|
302
|
+
export const storefrontDeparturePriceOfferImpactSchema = z.object({
|
|
303
|
+
offer: z.lazy(() => storefrontPromotionalOfferSchema),
|
|
304
|
+
status: z.enum(["applied", "not_applicable", "conflict"]),
|
|
305
|
+
reason: z.enum(["min_pax", "currency", "no_discount", "conflict"]).nullable(),
|
|
306
|
+
selected: z.boolean(),
|
|
307
|
+
discountAppliedCents: z.number().int(),
|
|
308
|
+
discountedPriceCents: z.number().int(),
|
|
309
|
+
});
|
|
310
|
+
export const storefrontDeparturePriceRequestedOfferSchema = z.object({
|
|
311
|
+
kind: z.enum(["slug", "code"]),
|
|
312
|
+
value: z.string(),
|
|
313
|
+
result: z.lazy(() => storefrontOfferMutationResultSchema).nullable(),
|
|
314
|
+
});
|
|
315
|
+
export const storefrontDeparturePriceOffersSchema = z.object({
|
|
316
|
+
available: z.array(storefrontDeparturePriceOfferImpactSchema),
|
|
317
|
+
requested: z.array(storefrontDeparturePriceRequestedOfferSchema),
|
|
318
|
+
applied: z.array(z.lazy(() => storefrontAppliedOfferSchema)),
|
|
319
|
+
conflict: z.lazy(() => storefrontOfferConflictSchema).nullable(),
|
|
320
|
+
discountTotal: z.number(),
|
|
321
|
+
discountTotalCents: z.number().int(),
|
|
322
|
+
totalAfterDiscount: z.number(),
|
|
323
|
+
currencyCode: z.string(),
|
|
324
|
+
});
|
|
325
|
+
export const storefrontDeparturePriceTotalsSchema = z.object({
|
|
326
|
+
currencyCode: z.string(),
|
|
327
|
+
base: z.number(),
|
|
328
|
+
extras: z.number(),
|
|
329
|
+
subtotal: z.number(),
|
|
330
|
+
discount: z.number(),
|
|
331
|
+
tax: z.number(),
|
|
332
|
+
total: z.number(),
|
|
333
|
+
perPerson: z.number(),
|
|
334
|
+
perBooking: z.number(),
|
|
335
|
+
});
|
|
286
336
|
export const storefrontDeparturePricePreviewSchema = z.object({
|
|
287
337
|
departureId: z.string(),
|
|
288
338
|
productId: z.string(),
|
|
@@ -293,6 +343,70 @@ export const storefrontDeparturePricePreviewSchema = z.object({
|
|
|
293
343
|
total: z.number(),
|
|
294
344
|
notes: z.string().nullable(),
|
|
295
345
|
lineItems: z.array(storefrontDeparturePriceLineItemSchema),
|
|
346
|
+
allocation: storefrontDeparturePriceAllocationSchema,
|
|
347
|
+
units: z.array(storefrontDeparturePriceUnitRowSchema),
|
|
348
|
+
rooms: z.array(storefrontDeparturePriceRoomRowSchema),
|
|
349
|
+
extras: z.array(storefrontDeparturePriceExtraImpactSchema),
|
|
350
|
+
offers: storefrontDeparturePriceOffersSchema,
|
|
351
|
+
totals: storefrontDeparturePriceTotalsSchema,
|
|
352
|
+
});
|
|
353
|
+
export const storefrontBookingSessionQuoteSchema = z.object({
|
|
354
|
+
currencyCode: z.string().trim().min(3).max(3),
|
|
355
|
+
totalSellAmountCents: z.number().int().min(0),
|
|
356
|
+
quotedAt: z.string().datetime().optional().nullable(),
|
|
357
|
+
expiresAt: z.string().datetime().optional().nullable(),
|
|
358
|
+
});
|
|
359
|
+
export const storefrontBookingSessionBootstrapInputSchema = z
|
|
360
|
+
.object({
|
|
361
|
+
departureId: z.string().trim().min(1),
|
|
362
|
+
slotId: z.string().trim().min(1),
|
|
363
|
+
catalogId: z.string().trim().min(1).optional(),
|
|
364
|
+
quote: storefrontBookingSessionQuoteSchema,
|
|
365
|
+
session: publicCreateBookingSessionSchema,
|
|
366
|
+
})
|
|
367
|
+
.superRefine((value, ctx) => {
|
|
368
|
+
if (!value.session.items.some((item) => item.availabilitySlotId === value.slotId)) {
|
|
369
|
+
ctx.addIssue({
|
|
370
|
+
code: "custom",
|
|
371
|
+
path: ["session", "items"],
|
|
372
|
+
message: "At least one session item must reference slotId",
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
export const storefrontBookingSessionPaymentPlanSchema = z.object({
|
|
377
|
+
source: z.literal("storefront_default"),
|
|
378
|
+
depositKind: z.enum(["none", "percent", "fixed_cents"]),
|
|
379
|
+
depositPercent: z.number().nullable(),
|
|
380
|
+
depositAmountCents: z.number().int().nullable(),
|
|
381
|
+
requiresFullPayment: z.boolean(),
|
|
382
|
+
});
|
|
383
|
+
export const storefrontBookingSessionAvailabilitySnapshotSchema = z.object({
|
|
384
|
+
departureId: z.string(),
|
|
385
|
+
slotId: z.string(),
|
|
386
|
+
productId: z.string(),
|
|
387
|
+
optionId: z.string().nullable(),
|
|
388
|
+
dateLocal: z.string().nullable(),
|
|
389
|
+
startsAt: z.string().nullable(),
|
|
390
|
+
endsAt: z.string().nullable(),
|
|
391
|
+
timezone: z.string(),
|
|
392
|
+
status: storefrontDepartureStatusSchema,
|
|
393
|
+
capacity: z.number().int().nullable(),
|
|
394
|
+
remaining: z.number().int().nullable(),
|
|
395
|
+
});
|
|
396
|
+
export const storefrontBookingSessionRepricingSnapshotSchema = z.object({
|
|
397
|
+
originalQuote: storefrontBookingSessionQuoteSchema,
|
|
398
|
+
current: publicBookingSessionRepriceSummarySchema,
|
|
399
|
+
deltaAmountCents: z.number().int(),
|
|
400
|
+
staleQuote: z.boolean(),
|
|
401
|
+
});
|
|
402
|
+
export const storefrontBookingSessionBootstrapSchema = z.object({
|
|
403
|
+
session: publicBookingSessionSchema,
|
|
404
|
+
paymentPlan: storefrontBookingSessionPaymentPlanSchema,
|
|
405
|
+
paymentSchedule: z.array(publicBookingPaymentScheduleSchema),
|
|
406
|
+
repricing: storefrontBookingSessionRepricingSnapshotSchema,
|
|
407
|
+
availability: storefrontBookingSessionAvailabilitySnapshotSchema,
|
|
408
|
+
allocation: z.array(publicBookingSessionAllocationSchema),
|
|
409
|
+
currency: z.string(),
|
|
296
410
|
});
|
|
297
411
|
export const storefrontProductExtensionsQuerySchema = z.object({
|
|
298
412
|
optionId: z.string().optional(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voyantjs/storefront",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.50.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -9,6 +9,11 @@
|
|
|
9
9
|
"import": "./dist/index.js",
|
|
10
10
|
"default": "./dist/index.js"
|
|
11
11
|
},
|
|
12
|
+
"./admin-routes": {
|
|
13
|
+
"types": "./dist/routes-admin.d.ts",
|
|
14
|
+
"import": "./dist/routes-admin.js",
|
|
15
|
+
"default": "./dist/routes-admin.js"
|
|
16
|
+
},
|
|
12
17
|
"./public-routes": {
|
|
13
18
|
"types": "./dist/routes-public.d.ts",
|
|
14
19
|
"import": "./dist/routes-public.js",
|
|
@@ -34,18 +39,21 @@
|
|
|
34
39
|
"drizzle-orm": "^0.45.2",
|
|
35
40
|
"hono": "^4.12.10",
|
|
36
41
|
"zod": "^4.3.6",
|
|
37
|
-
"@voyantjs/availability": "0.
|
|
38
|
-
"@voyantjs/core": "0.
|
|
39
|
-
"@voyantjs/
|
|
40
|
-
"@voyantjs/
|
|
41
|
-
"@voyantjs/
|
|
42
|
-
"@voyantjs/
|
|
43
|
-
"@voyantjs/
|
|
42
|
+
"@voyantjs/availability": "0.50.0",
|
|
43
|
+
"@voyantjs/core": "0.50.0",
|
|
44
|
+
"@voyantjs/bookings": "0.50.0",
|
|
45
|
+
"@voyantjs/extras": "0.50.0",
|
|
46
|
+
"@voyantjs/crm": "0.50.0",
|
|
47
|
+
"@voyantjs/finance": "0.50.0",
|
|
48
|
+
"@voyantjs/hono": "0.50.0",
|
|
49
|
+
"@voyantjs/pricing": "0.50.0",
|
|
50
|
+
"@voyantjs/sellability": "0.50.0",
|
|
51
|
+
"@voyantjs/products": "0.50.0"
|
|
44
52
|
},
|
|
45
53
|
"devDependencies": {
|
|
46
54
|
"typescript": "^6.0.2",
|
|
47
55
|
"vitest": "^4.1.2",
|
|
48
|
-
"@voyantjs/db": "0.
|
|
56
|
+
"@voyantjs/db": "0.50.0",
|
|
49
57
|
"@voyantjs/voyant-typescript-config": "0.1.0"
|
|
50
58
|
},
|
|
51
59
|
"files": [
|