@voyantjs/storefront 0.22.0 → 0.23.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/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/routes-public.d.ts +47 -0
- package/dist/routes-public.d.ts.map +1 -1
- package/dist/routes-public.js +18 -4
- package/dist/service-departures.d.ts +36 -1
- package/dist/service-departures.d.ts.map +1 -1
- package/dist/service-departures.js +134 -2
- package/dist/service.d.ts +111 -12
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +18 -3
- package/dist/validation.d.ts +172 -0
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +56 -0
- package/package.json +9 -9
package/dist/index.d.ts
CHANGED
|
@@ -3,10 +3,10 @@ import type { HonoModule } from "@voyantjs/hono/module";
|
|
|
3
3
|
import { createStorefrontPublicRoutes } from "./routes-public.js";
|
|
4
4
|
export type { StorefrontPublicRoutes } from "./routes-public.js";
|
|
5
5
|
export { createStorefrontPublicRoutes } from "./routes-public.js";
|
|
6
|
-
export type { StorefrontServiceOptions } from "./service.js";
|
|
6
|
+
export type { StorefrontOfferResolvers, StorefrontRequestContext, StorefrontServiceOptions, } from "./service.js";
|
|
7
7
|
export { createStorefrontService, resolveStorefrontSettings } from "./service.js";
|
|
8
|
-
export type { StorefrontDepartureListQuery, StorefrontFormField, StorefrontFormFieldInput, StorefrontPaymentMethod, StorefrontPaymentMethodCode, StorefrontPaymentMethodInput, StorefrontPromotionalOffer, StorefrontSettings, StorefrontSettingsInput, } from "./validation.js";
|
|
9
|
-
export { storefrontDepartureItinerarySchema, storefrontDepartureListQuerySchema, storefrontDepartureListResponseSchema, storefrontDeparturePricePreviewInputSchema, storefrontDeparturePricePreviewSchema, storefrontDepartureSchema, storefrontFormFieldInputSchema, storefrontFormFieldOptionSchema, storefrontFormFieldSchema, storefrontFormFieldTypeSchema, storefrontPaymentMethodCodeSchema, storefrontPaymentMethodInputSchema, storefrontPaymentMethodSchema, storefrontProductExtensionsQuerySchema, storefrontProductExtensionsResponseSchema, storefrontPromotionalOfferListQuerySchema, storefrontPromotionalOfferListResponseSchema, storefrontPromotionalOfferResponseSchema, storefrontPromotionalOfferSchema, storefrontSettingsInputSchema, storefrontSettingsSchema, } from "./validation.js";
|
|
8
|
+
export type { StorefrontDepartureListQuery, StorefrontFormField, StorefrontFormFieldInput, StorefrontPaymentMethod, StorefrontPaymentMethodCode, StorefrontPaymentMethodInput, StorefrontProductAvailabilitySummaryQuery, StorefrontPromotionalOffer, StorefrontSettings, StorefrontSettingsInput, } from "./validation.js";
|
|
9
|
+
export { storefrontDepartureItinerarySchema, storefrontDepartureListQuerySchema, storefrontDepartureListResponseSchema, storefrontDeparturePricePreviewInputSchema, storefrontDeparturePricePreviewSchema, storefrontDepartureSchema, storefrontFormFieldInputSchema, storefrontFormFieldOptionSchema, storefrontFormFieldSchema, storefrontFormFieldTypeSchema, storefrontPaymentMethodCodeSchema, storefrontPaymentMethodInputSchema, storefrontPaymentMethodSchema, storefrontProductAvailabilitySlotSchema, storefrontProductAvailabilityStateSchema, storefrontProductAvailabilitySummaryQuerySchema, storefrontProductAvailabilitySummaryResponseSchema, storefrontProductAvailabilitySummarySchema, storefrontProductExtensionsQuerySchema, storefrontProductExtensionsResponseSchema, storefrontPromotionalOfferListQuerySchema, storefrontPromotionalOfferListResponseSchema, storefrontPromotionalOfferResponseSchema, storefrontPromotionalOfferSchema, storefrontSettingsInputSchema, storefrontSettingsSchema, } from "./validation.js";
|
|
10
10
|
export declare const storefrontModule: Module;
|
|
11
11
|
export declare function createStorefrontHonoModule(options?: Parameters<typeof createStorefrontPublicRoutes>[0]): HonoModule;
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,O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A0C,EAC1C,sCAAsC,EACtC,yCAAyC,EACzC,yCAAyC,EACzC,4CAA4C,EAC5C,wCAAwC,EACxC,gCAAgC,EAChC,6BAA6B,EAC7B,wBAAwB,GACzB,MAAM,iBAAiB,CAAA;AAExB,eAAO,MAAM,gBAAgB,EAAE,MAE9B,CAAA;AAED,wBAAgB,0BAA0B,CACxC,OAAO,CAAC,EAAE,UAAU,CAAC,OAAO,4BAA4B,CAAC,CAAC,CAAC,CAAC,GAC3D,UAAU,CAMZ"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createStorefrontPublicRoutes } from "./routes-public.js";
|
|
2
2
|
export { createStorefrontPublicRoutes } from "./routes-public.js";
|
|
3
3
|
export { createStorefrontService, resolveStorefrontSettings } from "./service.js";
|
|
4
|
-
export { storefrontDepartureItinerarySchema, storefrontDepartureListQuerySchema, storefrontDepartureListResponseSchema, storefrontDeparturePricePreviewInputSchema, storefrontDeparturePricePreviewSchema, storefrontDepartureSchema, storefrontFormFieldInputSchema, storefrontFormFieldOptionSchema, storefrontFormFieldSchema, storefrontFormFieldTypeSchema, storefrontPaymentMethodCodeSchema, storefrontPaymentMethodInputSchema, storefrontPaymentMethodSchema, storefrontProductExtensionsQuerySchema, storefrontProductExtensionsResponseSchema, storefrontPromotionalOfferListQuerySchema, storefrontPromotionalOfferListResponseSchema, storefrontPromotionalOfferResponseSchema, storefrontPromotionalOfferSchema, storefrontSettingsInputSchema, storefrontSettingsSchema, } from "./validation.js";
|
|
4
|
+
export { storefrontDepartureItinerarySchema, storefrontDepartureListQuerySchema, storefrontDepartureListResponseSchema, storefrontDeparturePricePreviewInputSchema, storefrontDeparturePricePreviewSchema, storefrontDepartureSchema, storefrontFormFieldInputSchema, storefrontFormFieldOptionSchema, storefrontFormFieldSchema, storefrontFormFieldTypeSchema, storefrontPaymentMethodCodeSchema, storefrontPaymentMethodInputSchema, storefrontPaymentMethodSchema, storefrontProductAvailabilitySlotSchema, storefrontProductAvailabilityStateSchema, storefrontProductAvailabilitySummaryQuerySchema, storefrontProductAvailabilitySummaryResponseSchema, storefrontProductAvailabilitySummarySchema, storefrontProductExtensionsQuerySchema, storefrontProductExtensionsResponseSchema, storefrontPromotionalOfferListQuerySchema, storefrontPromotionalOfferListResponseSchema, storefrontPromotionalOfferResponseSchema, storefrontPromotionalOfferSchema, storefrontSettingsInputSchema, storefrontSettingsSchema, } from "./validation.js";
|
|
5
5
|
export const storefrontModule = {
|
|
6
6
|
name: "storefront",
|
|
7
7
|
};
|
package/dist/routes-public.d.ts
CHANGED
|
@@ -301,6 +301,53 @@ export declare function createStorefrontPublicRoutes(options?: StorefrontService
|
|
|
301
301
|
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
302
302
|
};
|
|
303
303
|
};
|
|
304
|
+
} & {
|
|
305
|
+
"/products/:productId/availability": {
|
|
306
|
+
$get: {
|
|
307
|
+
input: {
|
|
308
|
+
param: {
|
|
309
|
+
productId: string;
|
|
310
|
+
};
|
|
311
|
+
};
|
|
312
|
+
output: {
|
|
313
|
+
data: {
|
|
314
|
+
productId: string;
|
|
315
|
+
availabilityState: "closed" | "sold_out" | "cancelled" | "past_cutoff" | "too_early" | "unavailable" | "on_request" | "available";
|
|
316
|
+
counts: {
|
|
317
|
+
total: number;
|
|
318
|
+
open: number;
|
|
319
|
+
closed: number;
|
|
320
|
+
soldOut: number;
|
|
321
|
+
cancelled: number;
|
|
322
|
+
onRequest: number;
|
|
323
|
+
pastCutoff: number;
|
|
324
|
+
tooEarly: number;
|
|
325
|
+
available: number;
|
|
326
|
+
};
|
|
327
|
+
departures: {
|
|
328
|
+
id: string;
|
|
329
|
+
productId: string;
|
|
330
|
+
optionId: string | null;
|
|
331
|
+
dateLocal: string | null;
|
|
332
|
+
startAt: string | null;
|
|
333
|
+
endAt: string | null;
|
|
334
|
+
timezone: string;
|
|
335
|
+
status: "open" | "closed" | "sold_out" | "cancelled" | "on_request";
|
|
336
|
+
availabilityState: "closed" | "sold_out" | "cancelled" | "past_cutoff" | "too_early" | "unavailable" | "on_request" | "available";
|
|
337
|
+
capacity: number | null;
|
|
338
|
+
remaining: number | null;
|
|
339
|
+
pastCutoff: boolean;
|
|
340
|
+
tooEarly: boolean;
|
|
341
|
+
}[];
|
|
342
|
+
total: number;
|
|
343
|
+
limit: number;
|
|
344
|
+
offset: number;
|
|
345
|
+
};
|
|
346
|
+
};
|
|
347
|
+
outputFormat: "json";
|
|
348
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
349
|
+
};
|
|
350
|
+
};
|
|
304
351
|
} & {
|
|
305
352
|
"/products/:productId/departures/:departureId/itinerary": {
|
|
306
353
|
$get: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes-public.d.ts","sourceRoot":"","sources":["../src/routes-public.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"routes-public.d.ts","sourceRoot":"","sources":["../src/routes-public.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,wBAAwB,EAC9B,MAAM,cAAc,CAAA;AASrB,KAAK,GAAG,GAAG;IACT,SAAS,EAAE;QACT,EAAE,EAAE,OAAO,CAAA;KACZ,CAAA;CACF,CAAA;AAED,wBAAgB,4BAA4B,CAAC,OAAO,CAAC,EAAE,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAiG9E;AAED,MAAM,MAAM,sBAAsB,GAAG,UAAU,CAAC,OAAO,4BAA4B,CAAC,CAAA"}
|
package/dist/routes-public.js
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { parseJsonBody, parseQuery } from "@voyantjs/hono";
|
|
2
2
|
import { Hono } from "hono";
|
|
3
|
-
import { createStorefrontService } from "./service.js";
|
|
4
|
-
import { storefrontDepartureListQuerySchema, storefrontDeparturePricePreviewInputSchema, storefrontProductExtensionsQuerySchema, storefrontPromotionalOfferListQuerySchema, } from "./validation.js";
|
|
3
|
+
import { createStorefrontService, } from "./service.js";
|
|
4
|
+
import { storefrontDepartureListQuerySchema, storefrontDeparturePricePreviewInputSchema, storefrontProductAvailabilitySummaryQuerySchema, storefrontProductExtensionsQuerySchema, storefrontPromotionalOfferListQuerySchema, } from "./validation.js";
|
|
5
5
|
export function createStorefrontPublicRoutes(options) {
|
|
6
6
|
const storefrontService = createStorefrontService(options);
|
|
7
|
+
function getRequestContext(c) {
|
|
8
|
+
return {
|
|
9
|
+
db: c.get("db"),
|
|
10
|
+
env: c.env,
|
|
11
|
+
context: c,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
7
14
|
return new Hono()
|
|
8
|
-
.get("/settings", (c) => {
|
|
9
|
-
return c.json({ data: storefrontService.
|
|
15
|
+
.get("/settings", async (c) => {
|
|
16
|
+
return c.json({ data: await storefrontService.resolveSettings(getRequestContext(c)) });
|
|
10
17
|
})
|
|
11
18
|
.get("/departures/:departureId", async (c) => {
|
|
12
19
|
const departure = await storefrontService.getDeparture(c.get("db"), c.req.param("departureId"));
|
|
@@ -28,6 +35,11 @@ export function createStorefrontPublicRoutes(options) {
|
|
|
28
35
|
return c.json({
|
|
29
36
|
data: await storefrontService.getProductExtensions(c.get("db"), c.req.param("productId"), query.optionId),
|
|
30
37
|
});
|
|
38
|
+
})
|
|
39
|
+
.get("/products/:productId/availability", async (c) => {
|
|
40
|
+
return c.json({
|
|
41
|
+
data: await storefrontService.getProductAvailabilitySummary(c.get("db"), c.req.param("productId"), await parseQuery(c, storefrontProductAvailabilitySummaryQuerySchema)),
|
|
42
|
+
});
|
|
31
43
|
})
|
|
32
44
|
.get("/products/:productId/departures/:departureId/itinerary", async (c) => {
|
|
33
45
|
const itinerary = await storefrontService.getDepartureItinerary(c.get("db"), {
|
|
@@ -45,6 +57,7 @@ export function createStorefrontPublicRoutes(options) {
|
|
|
45
57
|
productId: c.req.param("productId"),
|
|
46
58
|
departureId: query.departureId,
|
|
47
59
|
locale: query.locale,
|
|
60
|
+
context: getRequestContext(c),
|
|
48
61
|
}),
|
|
49
62
|
});
|
|
50
63
|
})
|
|
@@ -53,6 +66,7 @@ export function createStorefrontPublicRoutes(options) {
|
|
|
53
66
|
const offer = await storefrontService.getOfferBySlug({
|
|
54
67
|
slug: c.req.param("slug"),
|
|
55
68
|
locale: query.locale,
|
|
69
|
+
context: getRequestContext(c),
|
|
56
70
|
});
|
|
57
71
|
return offer ? c.json({ data: offer }) : c.json({ error: "Storefront offer not found" }, 404);
|
|
58
72
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
|
|
2
|
-
import type { StorefrontDepartureListQuery, StorefrontDeparturePricePreviewInput } from "./validation.js";
|
|
2
|
+
import type { StorefrontDepartureListQuery, StorefrontDeparturePricePreviewInput, StorefrontProductAvailabilitySummaryQuery } from "./validation.js";
|
|
3
3
|
export declare function getStorefrontDeparture(db: PostgresJsDatabase, departureId: string): Promise<{
|
|
4
4
|
id: string;
|
|
5
5
|
productId: string;
|
|
@@ -95,6 +95,40 @@ export declare function listStorefrontProductDepartures(db: PostgresJsDatabase,
|
|
|
95
95
|
limit: number;
|
|
96
96
|
offset: number;
|
|
97
97
|
}>;
|
|
98
|
+
type StorefrontProductAvailabilityState = "available" | "sold_out" | "closed" | "cancelled" | "on_request" | "past_cutoff" | "too_early" | "unavailable";
|
|
99
|
+
export declare function getStorefrontProductAvailabilitySummary(db: PostgresJsDatabase, productId: string, query: StorefrontProductAvailabilitySummaryQuery): Promise<{
|
|
100
|
+
productId: string;
|
|
101
|
+
availabilityState: StorefrontProductAvailabilityState;
|
|
102
|
+
counts: {
|
|
103
|
+
total: number;
|
|
104
|
+
open: number;
|
|
105
|
+
closed: number;
|
|
106
|
+
soldOut: number;
|
|
107
|
+
cancelled: number;
|
|
108
|
+
onRequest: number;
|
|
109
|
+
pastCutoff: number;
|
|
110
|
+
tooEarly: number;
|
|
111
|
+
available: number;
|
|
112
|
+
};
|
|
113
|
+
departures: {
|
|
114
|
+
id: string;
|
|
115
|
+
productId: string;
|
|
116
|
+
optionId: string | null;
|
|
117
|
+
dateLocal: string | null;
|
|
118
|
+
startAt: string | null;
|
|
119
|
+
endAt: string | null;
|
|
120
|
+
timezone: string;
|
|
121
|
+
status: "open" | "closed" | "sold_out" | "cancelled" | "on_request";
|
|
122
|
+
availabilityState: StorefrontProductAvailabilityState;
|
|
123
|
+
capacity: number | null;
|
|
124
|
+
remaining: number | null;
|
|
125
|
+
pastCutoff: boolean;
|
|
126
|
+
tooEarly: boolean;
|
|
127
|
+
}[];
|
|
128
|
+
total: number;
|
|
129
|
+
limit: number;
|
|
130
|
+
offset: number;
|
|
131
|
+
}>;
|
|
98
132
|
export declare function previewStorefrontDeparturePrice(db: PostgresJsDatabase, departureId: string, input: StorefrontDeparturePricePreviewInput): Promise<{
|
|
99
133
|
departureId: string;
|
|
100
134
|
productId: string;
|
|
@@ -174,4 +208,5 @@ export declare function getStorefrontDepartureItinerary(db: PostgresJsDatabase,
|
|
|
174
208
|
}[];
|
|
175
209
|
}[];
|
|
176
210
|
} | null>;
|
|
211
|
+
export {};
|
|
177
212
|
//# sourceMappingURL=service-departures.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-departures.d.ts","sourceRoot":"","sources":["../src/service-departures.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAEjE,OAAO,KAAK,EACV,4BAA4B,EAC5B,oCAAoC,
|
|
1
|
+
{"version":3,"file":"service-departures.d.ts","sourceRoot":"","sources":["../src/service-departures.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAEjE,OAAO,KAAK,EACV,4BAA4B,EAC5B,oCAAoC,EACpC,yCAAyC,EAC1C,MAAM,iBAAiB,CAAA;AA40BxB,wBAAsB,sBAAsB,CAAC,EAAE,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAYvF;AAED,wBAAsB,+BAA+B,CACnD,EAAE,EAAE,kBAAkB,EACtB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BpC;AAED,KAAK,kCAAkC,GACnC,WAAW,GACX,UAAU,GACV,QAAQ,GACR,WAAW,GACX,YAAY,GACZ,aAAa,GACb,WAAW,GACX,aAAa,CAAA;AAuDjB,wBAAsB,uCAAuC,CAC3D,EAAE,EAAE,kBAAkB,EACtB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,yCAAyC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+FjD;AAED,wBAAsB,+BAA+B,CACnD,EAAE,EAAE,kBAAkB,EACtB,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,oCAAoC;;;;;;;;;;cAzUlB,MAAM;eAAS,MAAM;kBAAY,MAAM;mBAAa,MAAM;;UAwapF;AAED,wBAAsB,8BAA8B,CAClD,EAAE,EAAE,kBAAkB,EACtB,SAAS,EAAE,MAAM,EACjB,QAAQ,CAAC,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgGlB;AAED,wBAAsB,+BAA+B,CACnD,EAAE,EAAE,kBAAkB,EACtB,KAAK,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;;;;UAyFlD"}
|
|
@@ -125,7 +125,7 @@ async function listSlots(db, filters = {}) {
|
|
|
125
125
|
if (filters.status) {
|
|
126
126
|
conditions.push(eq(availabilitySlots.status, filters.status));
|
|
127
127
|
}
|
|
128
|
-
else {
|
|
128
|
+
else if (!filters.includeCancelled) {
|
|
129
129
|
conditions.push(ne(availabilitySlots.status, "cancelled"));
|
|
130
130
|
}
|
|
131
131
|
if (filters.dateFrom) {
|
|
@@ -184,7 +184,7 @@ async function countSlots(db, filters = {}) {
|
|
|
184
184
|
if (filters.status) {
|
|
185
185
|
conditions.push(eq(availabilitySlots.status, filters.status));
|
|
186
186
|
}
|
|
187
|
-
else {
|
|
187
|
+
else if (!filters.includeCancelled) {
|
|
188
188
|
conditions.push(ne(availabilitySlots.status, "cancelled"));
|
|
189
189
|
}
|
|
190
190
|
if (filters.dateFrom) {
|
|
@@ -572,6 +572,138 @@ export async function listStorefrontProductDepartures(db, productId, query) {
|
|
|
572
572
|
offset: query.offset,
|
|
573
573
|
};
|
|
574
574
|
}
|
|
575
|
+
function todayLocalDate() {
|
|
576
|
+
return new Date().toISOString().slice(0, 10);
|
|
577
|
+
}
|
|
578
|
+
function buildAvailabilityState(args) {
|
|
579
|
+
if (args.status === "cancelled")
|
|
580
|
+
return "cancelled";
|
|
581
|
+
if (args.status === "closed")
|
|
582
|
+
return "closed";
|
|
583
|
+
if (args.status === "sold_out")
|
|
584
|
+
return "sold_out";
|
|
585
|
+
if (args.status === "on_request")
|
|
586
|
+
return "on_request";
|
|
587
|
+
if (args.pastCutoff)
|
|
588
|
+
return "past_cutoff";
|
|
589
|
+
if (args.tooEarly)
|
|
590
|
+
return "too_early";
|
|
591
|
+
if (args.capacity != null && args.remaining === 0)
|
|
592
|
+
return "sold_out";
|
|
593
|
+
return "available";
|
|
594
|
+
}
|
|
595
|
+
function summarizeProductAvailability(departures) {
|
|
596
|
+
if (departures.some((departure) => departure.availabilityState === "available")) {
|
|
597
|
+
return "available";
|
|
598
|
+
}
|
|
599
|
+
if (departures.some((departure) => departure.availabilityState === "on_request")) {
|
|
600
|
+
return "on_request";
|
|
601
|
+
}
|
|
602
|
+
if (departures.some((departure) => departure.availabilityState === "too_early")) {
|
|
603
|
+
return "too_early";
|
|
604
|
+
}
|
|
605
|
+
if (departures.some((departure) => departure.availabilityState === "past_cutoff")) {
|
|
606
|
+
return "past_cutoff";
|
|
607
|
+
}
|
|
608
|
+
if (departures.some((departure) => departure.availabilityState === "sold_out")) {
|
|
609
|
+
return "sold_out";
|
|
610
|
+
}
|
|
611
|
+
if (departures.some((departure) => departure.availabilityState === "closed")) {
|
|
612
|
+
return "closed";
|
|
613
|
+
}
|
|
614
|
+
if (departures.some((departure) => departure.availabilityState === "cancelled")) {
|
|
615
|
+
return "cancelled";
|
|
616
|
+
}
|
|
617
|
+
return "unavailable";
|
|
618
|
+
}
|
|
619
|
+
export async function getStorefrontProductAvailabilitySummary(db, productId, query) {
|
|
620
|
+
const requestedStatus = query.status;
|
|
621
|
+
const persistedStatus = requestedStatus === "on_request" ? "open" : requestedStatus;
|
|
622
|
+
const filters = {
|
|
623
|
+
productId,
|
|
624
|
+
optionId: query.optionId,
|
|
625
|
+
status: persistedStatus,
|
|
626
|
+
dateFrom: query.dateFrom ?? todayLocalDate(),
|
|
627
|
+
dateTo: query.dateTo,
|
|
628
|
+
includeCancelled: true,
|
|
629
|
+
};
|
|
630
|
+
const [slots, total] = await Promise.all([
|
|
631
|
+
listSlots(db, {
|
|
632
|
+
...filters,
|
|
633
|
+
limit: query.limit,
|
|
634
|
+
offset: query.offset,
|
|
635
|
+
}),
|
|
636
|
+
countSlots(db, filters),
|
|
637
|
+
]);
|
|
638
|
+
const [meetingPointByProduct, defaultItineraryByProduct] = await Promise.all([
|
|
639
|
+
listMeetingPointsByProductIds(db, [productId]),
|
|
640
|
+
listDefaultItineraryIdsByProductIds(db, [productId]),
|
|
641
|
+
]);
|
|
642
|
+
const departures = (await Promise.all(slots.map(async (slot) => {
|
|
643
|
+
const departure = await buildDeparture(db, slot, defaultItineraryByProduct, meetingPointByProduct);
|
|
644
|
+
const availabilityState = buildAvailabilityState({
|
|
645
|
+
status: departure.departureStatus,
|
|
646
|
+
remaining: departure.remaining,
|
|
647
|
+
capacity: departure.capacity,
|
|
648
|
+
pastCutoff: slot.pastCutoff,
|
|
649
|
+
tooEarly: slot.tooEarly,
|
|
650
|
+
});
|
|
651
|
+
return {
|
|
652
|
+
id: departure.id,
|
|
653
|
+
productId: departure.productId,
|
|
654
|
+
optionId: departure.optionId,
|
|
655
|
+
dateLocal: departure.dateLocal,
|
|
656
|
+
startAt: departure.startAt,
|
|
657
|
+
endAt: departure.endAt,
|
|
658
|
+
timezone: departure.timezone,
|
|
659
|
+
status: departure.departureStatus,
|
|
660
|
+
availabilityState,
|
|
661
|
+
capacity: departure.capacity,
|
|
662
|
+
remaining: departure.remaining,
|
|
663
|
+
pastCutoff: slot.pastCutoff,
|
|
664
|
+
tooEarly: slot.tooEarly,
|
|
665
|
+
};
|
|
666
|
+
}))).filter((departure) => !requestedStatus || departure.status === requestedStatus);
|
|
667
|
+
const counts = departures.reduce((acc, departure) => {
|
|
668
|
+
acc.total += 1;
|
|
669
|
+
if (departure.status === "open")
|
|
670
|
+
acc.open += 1;
|
|
671
|
+
if (departure.status === "closed")
|
|
672
|
+
acc.closed += 1;
|
|
673
|
+
if (departure.status === "sold_out")
|
|
674
|
+
acc.soldOut += 1;
|
|
675
|
+
if (departure.status === "cancelled")
|
|
676
|
+
acc.cancelled += 1;
|
|
677
|
+
if (departure.status === "on_request")
|
|
678
|
+
acc.onRequest += 1;
|
|
679
|
+
if (departure.availabilityState === "past_cutoff")
|
|
680
|
+
acc.pastCutoff += 1;
|
|
681
|
+
if (departure.availabilityState === "too_early")
|
|
682
|
+
acc.tooEarly += 1;
|
|
683
|
+
if (departure.availabilityState === "available")
|
|
684
|
+
acc.available += 1;
|
|
685
|
+
return acc;
|
|
686
|
+
}, {
|
|
687
|
+
total: 0,
|
|
688
|
+
open: 0,
|
|
689
|
+
closed: 0,
|
|
690
|
+
soldOut: 0,
|
|
691
|
+
cancelled: 0,
|
|
692
|
+
onRequest: 0,
|
|
693
|
+
pastCutoff: 0,
|
|
694
|
+
tooEarly: 0,
|
|
695
|
+
available: 0,
|
|
696
|
+
});
|
|
697
|
+
return {
|
|
698
|
+
productId,
|
|
699
|
+
availabilityState: summarizeProductAvailability(departures),
|
|
700
|
+
counts,
|
|
701
|
+
departures,
|
|
702
|
+
total: requestedStatus === "on_request" ? departures.length : total,
|
|
703
|
+
limit: query.limit,
|
|
704
|
+
offset: query.offset,
|
|
705
|
+
};
|
|
706
|
+
}
|
|
575
707
|
export async function previewStorefrontDeparturePrice(db, departureId, input) {
|
|
576
708
|
const [slot] = await listSlots(db, { slotId: departureId, limit: 1 });
|
|
577
709
|
if (!slot) {
|
package/dist/service.d.ts
CHANGED
|
@@ -1,22 +1,86 @@
|
|
|
1
1
|
import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
|
|
2
|
-
import { type StorefrontDepartureListQuery, type StorefrontDeparturePricePreviewInput, type StorefrontPromotionalOffer, type StorefrontSettings, type StorefrontSettingsInput } from "./validation.js";
|
|
2
|
+
import { type StorefrontDepartureListQuery, type StorefrontDeparturePricePreviewInput, type StorefrontProductAvailabilitySummaryQuery, type StorefrontPromotionalOffer, type StorefrontSettings, type StorefrontSettingsInput } from "./validation.js";
|
|
3
3
|
export interface StorefrontServiceOptions {
|
|
4
4
|
settings?: StorefrontSettingsInput;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
resolveSettings?: (context: StorefrontRequestContext) => Promise<StorefrontSettingsInput> | StorefrontSettingsInput;
|
|
6
|
+
offers?: StorefrontOfferResolvers;
|
|
7
|
+
resolveOffers?: (context: StorefrontRequestContext) => Promise<StorefrontOfferResolvers | null | undefined> | StorefrontOfferResolvers | null | undefined;
|
|
8
|
+
}
|
|
9
|
+
export interface StorefrontRequestContext {
|
|
10
|
+
db?: PostgresJsDatabase;
|
|
11
|
+
env?: unknown;
|
|
12
|
+
context?: unknown;
|
|
13
|
+
}
|
|
14
|
+
export interface StorefrontOfferResolvers {
|
|
15
|
+
listApplicableOffers?: (input: {
|
|
16
|
+
productId: string;
|
|
17
|
+
departureId?: string;
|
|
18
|
+
locale?: string;
|
|
19
|
+
} & StorefrontRequestContext) => Promise<StorefrontPromotionalOffer[]> | StorefrontPromotionalOffer[];
|
|
20
|
+
getOfferBySlug?: (input: {
|
|
21
|
+
slug: string;
|
|
22
|
+
locale?: string;
|
|
23
|
+
} & StorefrontRequestContext) => Promise<StorefrontPromotionalOffer | null> | StorefrontPromotionalOffer | null;
|
|
16
24
|
}
|
|
17
25
|
export declare function resolveStorefrontSettings(input?: StorefrontSettingsInput): StorefrontSettings;
|
|
18
26
|
export declare function createStorefrontService(options?: StorefrontServiceOptions): {
|
|
19
27
|
getSettings(): StorefrontSettings;
|
|
28
|
+
resolveSettings: (context?: StorefrontRequestContext) => Promise<{
|
|
29
|
+
branding: {
|
|
30
|
+
logoUrl: string | null;
|
|
31
|
+
supportedLanguages: string[];
|
|
32
|
+
};
|
|
33
|
+
support: {
|
|
34
|
+
email: string | null;
|
|
35
|
+
phone: string | null;
|
|
36
|
+
};
|
|
37
|
+
legal: {
|
|
38
|
+
termsUrl: string | null;
|
|
39
|
+
privacyUrl: string | null;
|
|
40
|
+
defaultContractTemplateId: string | null;
|
|
41
|
+
};
|
|
42
|
+
forms: {
|
|
43
|
+
billing: {
|
|
44
|
+
fields: {
|
|
45
|
+
key: string;
|
|
46
|
+
label: string;
|
|
47
|
+
type: "date" | "select" | "email" | "text" | "country" | "tel" | "textarea" | "checkbox";
|
|
48
|
+
required: boolean;
|
|
49
|
+
placeholder: string | null;
|
|
50
|
+
description: string | null;
|
|
51
|
+
autocomplete: string | null;
|
|
52
|
+
options: {
|
|
53
|
+
value: string;
|
|
54
|
+
label: string;
|
|
55
|
+
}[];
|
|
56
|
+
}[];
|
|
57
|
+
};
|
|
58
|
+
travelers: {
|
|
59
|
+
fields: {
|
|
60
|
+
key: string;
|
|
61
|
+
label: string;
|
|
62
|
+
type: "date" | "select" | "email" | "text" | "country" | "tel" | "textarea" | "checkbox";
|
|
63
|
+
required: boolean;
|
|
64
|
+
placeholder: string | null;
|
|
65
|
+
description: string | null;
|
|
66
|
+
autocomplete: string | null;
|
|
67
|
+
options: {
|
|
68
|
+
value: string;
|
|
69
|
+
label: string;
|
|
70
|
+
}[];
|
|
71
|
+
}[];
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
payment: {
|
|
75
|
+
defaultMethod: "voucher" | "card" | "bank_transfer" | "cash" | "invoice" | null;
|
|
76
|
+
methods: {
|
|
77
|
+
code: "voucher" | "card" | "bank_transfer" | "cash" | "invoice";
|
|
78
|
+
label: string;
|
|
79
|
+
description: string | null;
|
|
80
|
+
enabled: boolean;
|
|
81
|
+
}[];
|
|
82
|
+
};
|
|
83
|
+
}>;
|
|
20
84
|
getDeparture(db: PostgresJsDatabase, departureId: string): Promise<{
|
|
21
85
|
id: string;
|
|
22
86
|
productId: string;
|
|
@@ -172,6 +236,39 @@ export declare function createStorefrontService(options?: StorefrontServiceOptio
|
|
|
172
236
|
};
|
|
173
237
|
currencyCode: string;
|
|
174
238
|
}>;
|
|
239
|
+
getProductAvailabilitySummary(db: PostgresJsDatabase, productId: string, query: StorefrontProductAvailabilitySummaryQuery): Promise<{
|
|
240
|
+
productId: string;
|
|
241
|
+
availabilityState: "closed" | "sold_out" | "cancelled" | "past_cutoff" | "too_early" | "unavailable" | "on_request" | "available";
|
|
242
|
+
counts: {
|
|
243
|
+
total: number;
|
|
244
|
+
open: number;
|
|
245
|
+
closed: number;
|
|
246
|
+
soldOut: number;
|
|
247
|
+
cancelled: number;
|
|
248
|
+
onRequest: number;
|
|
249
|
+
pastCutoff: number;
|
|
250
|
+
tooEarly: number;
|
|
251
|
+
available: number;
|
|
252
|
+
};
|
|
253
|
+
departures: {
|
|
254
|
+
id: string;
|
|
255
|
+
productId: string;
|
|
256
|
+
optionId: string | null;
|
|
257
|
+
dateLocal: string | null;
|
|
258
|
+
startAt: string | null;
|
|
259
|
+
endAt: string | null;
|
|
260
|
+
timezone: string;
|
|
261
|
+
status: "open" | "closed" | "sold_out" | "cancelled" | "on_request";
|
|
262
|
+
availabilityState: "closed" | "sold_out" | "cancelled" | "past_cutoff" | "too_early" | "unavailable" | "on_request" | "available";
|
|
263
|
+
capacity: number | null;
|
|
264
|
+
remaining: number | null;
|
|
265
|
+
pastCutoff: boolean;
|
|
266
|
+
tooEarly: boolean;
|
|
267
|
+
}[];
|
|
268
|
+
total: number;
|
|
269
|
+
limit: number;
|
|
270
|
+
offset: number;
|
|
271
|
+
}>;
|
|
175
272
|
getDepartureItinerary(db: PostgresJsDatabase, input: {
|
|
176
273
|
departureId: string;
|
|
177
274
|
productId: string;
|
|
@@ -195,10 +292,12 @@ export declare function createStorefrontService(options?: StorefrontServiceOptio
|
|
|
195
292
|
productId: string;
|
|
196
293
|
departureId?: string;
|
|
197
294
|
locale?: string;
|
|
295
|
+
context?: StorefrontRequestContext;
|
|
198
296
|
}): Promise<StorefrontPromotionalOffer[]>;
|
|
199
297
|
getOfferBySlug(input: {
|
|
200
298
|
slug: string;
|
|
201
299
|
locale?: string;
|
|
300
|
+
context?: StorefrontRequestContext;
|
|
202
301
|
}): Promise<StorefrontPromotionalOffer | null>;
|
|
203
302
|
};
|
|
204
303
|
//# sourceMappingURL=service.d.ts.map
|
package/dist/service.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAUjE,OAAO,EACL,KAAK,4BAA4B,EACjC,KAAK,oCAAoC,EAMzC,KAAK,yCAAyC,EAC9C,KAAK,0BAA0B,EAC/B,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAG7B,MAAM,iBAAiB,CAAA;AAExB,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,EAAE,uBAAuB,CAAA;IAClC,eAAe,CAAC,EAAE,CAChB,OAAO,EAAE,wBAAwB,KAC9B,OAAO,CAAC,uBAAuB,CAAC,GAAG,uBAAuB,CAAA;IAC/D,MAAM,CAAC,EAAE,wBAAwB,CAAA;IACjC,aAAa,CAAC,EAAE,CACd,OAAO,EAAE,wBAAwB,KAE/B,OAAO,CAAC,wBAAwB,GAAG,IAAI,GAAG,SAAS,CAAC,GACpD,wBAAwB,GACxB,IAAI,GACJ,SAAS,CAAA;CACd;AAED,MAAM,WAAW,wBAAwB;IACvC,EAAE,CAAC,EAAE,kBAAkB,CAAA;IACvB,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,MAAM,WAAW,wBAAwB;IACvC,oBAAoB,CAAC,EAAE,CACrB,KAAK,EAAE;QACL,SAAS,EAAE,MAAM,CAAA;QACjB,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,GAAG,wBAAwB,KACzB,OAAO,CAAC,0BAA0B,EAAE,CAAC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M,CAAC,EAAE,MAAM,CAAA;QACf,OAAO,CAAC,EAAE,wBAAwB,CAAA;KACnC,GAAG,OAAO,CAAC,0BAA0B,GAAG,IAAI,CAAC;EASjD"}
|
package/dist/service.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getStorefrontDeparture, getStorefrontDepartureItinerary, getStorefrontProductExtensions, listStorefrontProductDepartures, previewStorefrontDeparturePrice, } from "./service-departures.js";
|
|
1
|
+
import { getStorefrontDeparture, getStorefrontDepartureItinerary, getStorefrontProductAvailabilitySummary, getStorefrontProductExtensions, listStorefrontProductDepartures, previewStorefrontDeparturePrice, } from "./service-departures.js";
|
|
2
2
|
import { storefrontSettingsInputSchema, storefrontSettingsSchema, } from "./validation.js";
|
|
3
3
|
const defaultPaymentLabels = {
|
|
4
4
|
card: "Card",
|
|
@@ -59,10 +59,20 @@ export function resolveStorefrontSettings(input) {
|
|
|
59
59
|
}
|
|
60
60
|
export function createStorefrontService(options) {
|
|
61
61
|
const settings = resolveStorefrontSettings(options?.settings);
|
|
62
|
+
async function resolveSettings(context = {}) {
|
|
63
|
+
if (!options?.resolveSettings) {
|
|
64
|
+
return settings;
|
|
65
|
+
}
|
|
66
|
+
return resolveStorefrontSettings(await options.resolveSettings(context));
|
|
67
|
+
}
|
|
68
|
+
async function resolveOffers(context = {}) {
|
|
69
|
+
return (await options?.resolveOffers?.(context)) ?? options?.offers;
|
|
70
|
+
}
|
|
62
71
|
return {
|
|
63
72
|
getSettings() {
|
|
64
73
|
return settings;
|
|
65
74
|
},
|
|
75
|
+
resolveSettings,
|
|
66
76
|
getDeparture(db, departureId) {
|
|
67
77
|
return getStorefrontDeparture(db, departureId);
|
|
68
78
|
},
|
|
@@ -75,15 +85,20 @@ export function createStorefrontService(options) {
|
|
|
75
85
|
getProductExtensions(db, productId, optionId) {
|
|
76
86
|
return getStorefrontProductExtensions(db, productId, optionId);
|
|
77
87
|
},
|
|
88
|
+
getProductAvailabilitySummary(db, productId, query) {
|
|
89
|
+
return getStorefrontProductAvailabilitySummary(db, productId, query);
|
|
90
|
+
},
|
|
78
91
|
getDepartureItinerary(db, input) {
|
|
79
92
|
return getStorefrontDepartureItinerary(db, input);
|
|
80
93
|
},
|
|
81
94
|
async listApplicableOffers(input) {
|
|
82
|
-
const
|
|
95
|
+
const { context, ...offerInput } = input;
|
|
96
|
+
const offers = await resolveOffers(context)?.then((resolvers) => resolvers?.listApplicableOffers?.({ ...offerInput, ...(context ?? {}) }));
|
|
83
97
|
return offers ?? [];
|
|
84
98
|
},
|
|
85
99
|
async getOfferBySlug(input) {
|
|
86
|
-
|
|
100
|
+
const { context, ...offerInput } = input;
|
|
101
|
+
return ((await resolveOffers(context)?.then((resolvers) => resolvers?.getOfferBySlug?.({ ...offerInput, ...(context ?? {}) }))) ?? null);
|
|
87
102
|
},
|
|
88
103
|
};
|
|
89
104
|
}
|
package/dist/validation.d.ts
CHANGED
|
@@ -434,6 +434,177 @@ export declare const storefrontDepartureListResponseSchema: z.ZodObject<{
|
|
|
434
434
|
limit: z.ZodNumber;
|
|
435
435
|
offset: z.ZodNumber;
|
|
436
436
|
}, z.core.$strip>;
|
|
437
|
+
export declare const storefrontProductAvailabilityStateSchema: z.ZodEnum<{
|
|
438
|
+
closed: "closed";
|
|
439
|
+
sold_out: "sold_out";
|
|
440
|
+
cancelled: "cancelled";
|
|
441
|
+
past_cutoff: "past_cutoff";
|
|
442
|
+
too_early: "too_early";
|
|
443
|
+
unavailable: "unavailable";
|
|
444
|
+
on_request: "on_request";
|
|
445
|
+
available: "available";
|
|
446
|
+
}>;
|
|
447
|
+
export declare const storefrontProductAvailabilitySummaryQuerySchema: z.ZodObject<{
|
|
448
|
+
optionId: z.ZodOptional<z.ZodString>;
|
|
449
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
450
|
+
open: "open";
|
|
451
|
+
closed: "closed";
|
|
452
|
+
sold_out: "sold_out";
|
|
453
|
+
cancelled: "cancelled";
|
|
454
|
+
on_request: "on_request";
|
|
455
|
+
}>>;
|
|
456
|
+
dateFrom: z.ZodOptional<z.ZodString>;
|
|
457
|
+
dateTo: z.ZodOptional<z.ZodString>;
|
|
458
|
+
locale: z.ZodOptional<z.ZodString>;
|
|
459
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
460
|
+
offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
461
|
+
}, z.core.$strip>;
|
|
462
|
+
export declare const storefrontProductAvailabilitySlotSchema: z.ZodObject<{
|
|
463
|
+
id: z.ZodString;
|
|
464
|
+
productId: z.ZodString;
|
|
465
|
+
optionId: z.ZodNullable<z.ZodString>;
|
|
466
|
+
dateLocal: z.ZodNullable<z.ZodString>;
|
|
467
|
+
startAt: z.ZodNullable<z.ZodString>;
|
|
468
|
+
endAt: z.ZodNullable<z.ZodString>;
|
|
469
|
+
timezone: z.ZodString;
|
|
470
|
+
status: z.ZodEnum<{
|
|
471
|
+
open: "open";
|
|
472
|
+
closed: "closed";
|
|
473
|
+
sold_out: "sold_out";
|
|
474
|
+
cancelled: "cancelled";
|
|
475
|
+
on_request: "on_request";
|
|
476
|
+
}>;
|
|
477
|
+
availabilityState: z.ZodEnum<{
|
|
478
|
+
closed: "closed";
|
|
479
|
+
sold_out: "sold_out";
|
|
480
|
+
cancelled: "cancelled";
|
|
481
|
+
past_cutoff: "past_cutoff";
|
|
482
|
+
too_early: "too_early";
|
|
483
|
+
unavailable: "unavailable";
|
|
484
|
+
on_request: "on_request";
|
|
485
|
+
available: "available";
|
|
486
|
+
}>;
|
|
487
|
+
capacity: z.ZodNullable<z.ZodNumber>;
|
|
488
|
+
remaining: z.ZodNullable<z.ZodNumber>;
|
|
489
|
+
pastCutoff: z.ZodBoolean;
|
|
490
|
+
tooEarly: z.ZodBoolean;
|
|
491
|
+
}, z.core.$strip>;
|
|
492
|
+
export declare const storefrontProductAvailabilitySummarySchema: z.ZodObject<{
|
|
493
|
+
productId: z.ZodString;
|
|
494
|
+
availabilityState: z.ZodEnum<{
|
|
495
|
+
closed: "closed";
|
|
496
|
+
sold_out: "sold_out";
|
|
497
|
+
cancelled: "cancelled";
|
|
498
|
+
past_cutoff: "past_cutoff";
|
|
499
|
+
too_early: "too_early";
|
|
500
|
+
unavailable: "unavailable";
|
|
501
|
+
on_request: "on_request";
|
|
502
|
+
available: "available";
|
|
503
|
+
}>;
|
|
504
|
+
counts: z.ZodObject<{
|
|
505
|
+
total: z.ZodNumber;
|
|
506
|
+
open: z.ZodNumber;
|
|
507
|
+
closed: z.ZodNumber;
|
|
508
|
+
soldOut: z.ZodNumber;
|
|
509
|
+
cancelled: z.ZodNumber;
|
|
510
|
+
onRequest: z.ZodNumber;
|
|
511
|
+
pastCutoff: z.ZodNumber;
|
|
512
|
+
tooEarly: z.ZodNumber;
|
|
513
|
+
available: z.ZodNumber;
|
|
514
|
+
}, z.core.$strip>;
|
|
515
|
+
departures: z.ZodArray<z.ZodObject<{
|
|
516
|
+
id: z.ZodString;
|
|
517
|
+
productId: z.ZodString;
|
|
518
|
+
optionId: z.ZodNullable<z.ZodString>;
|
|
519
|
+
dateLocal: z.ZodNullable<z.ZodString>;
|
|
520
|
+
startAt: z.ZodNullable<z.ZodString>;
|
|
521
|
+
endAt: z.ZodNullable<z.ZodString>;
|
|
522
|
+
timezone: z.ZodString;
|
|
523
|
+
status: z.ZodEnum<{
|
|
524
|
+
open: "open";
|
|
525
|
+
closed: "closed";
|
|
526
|
+
sold_out: "sold_out";
|
|
527
|
+
cancelled: "cancelled";
|
|
528
|
+
on_request: "on_request";
|
|
529
|
+
}>;
|
|
530
|
+
availabilityState: z.ZodEnum<{
|
|
531
|
+
closed: "closed";
|
|
532
|
+
sold_out: "sold_out";
|
|
533
|
+
cancelled: "cancelled";
|
|
534
|
+
past_cutoff: "past_cutoff";
|
|
535
|
+
too_early: "too_early";
|
|
536
|
+
unavailable: "unavailable";
|
|
537
|
+
on_request: "on_request";
|
|
538
|
+
available: "available";
|
|
539
|
+
}>;
|
|
540
|
+
capacity: z.ZodNullable<z.ZodNumber>;
|
|
541
|
+
remaining: z.ZodNullable<z.ZodNumber>;
|
|
542
|
+
pastCutoff: z.ZodBoolean;
|
|
543
|
+
tooEarly: z.ZodBoolean;
|
|
544
|
+
}, z.core.$strip>>;
|
|
545
|
+
total: z.ZodNumber;
|
|
546
|
+
limit: z.ZodNumber;
|
|
547
|
+
offset: z.ZodNumber;
|
|
548
|
+
}, z.core.$strip>;
|
|
549
|
+
export declare const storefrontProductAvailabilitySummaryResponseSchema: z.ZodObject<{
|
|
550
|
+
data: z.ZodObject<{
|
|
551
|
+
productId: z.ZodString;
|
|
552
|
+
availabilityState: z.ZodEnum<{
|
|
553
|
+
closed: "closed";
|
|
554
|
+
sold_out: "sold_out";
|
|
555
|
+
cancelled: "cancelled";
|
|
556
|
+
past_cutoff: "past_cutoff";
|
|
557
|
+
too_early: "too_early";
|
|
558
|
+
unavailable: "unavailable";
|
|
559
|
+
on_request: "on_request";
|
|
560
|
+
available: "available";
|
|
561
|
+
}>;
|
|
562
|
+
counts: z.ZodObject<{
|
|
563
|
+
total: z.ZodNumber;
|
|
564
|
+
open: z.ZodNumber;
|
|
565
|
+
closed: z.ZodNumber;
|
|
566
|
+
soldOut: z.ZodNumber;
|
|
567
|
+
cancelled: z.ZodNumber;
|
|
568
|
+
onRequest: z.ZodNumber;
|
|
569
|
+
pastCutoff: z.ZodNumber;
|
|
570
|
+
tooEarly: z.ZodNumber;
|
|
571
|
+
available: z.ZodNumber;
|
|
572
|
+
}, z.core.$strip>;
|
|
573
|
+
departures: z.ZodArray<z.ZodObject<{
|
|
574
|
+
id: z.ZodString;
|
|
575
|
+
productId: z.ZodString;
|
|
576
|
+
optionId: z.ZodNullable<z.ZodString>;
|
|
577
|
+
dateLocal: z.ZodNullable<z.ZodString>;
|
|
578
|
+
startAt: z.ZodNullable<z.ZodString>;
|
|
579
|
+
endAt: z.ZodNullable<z.ZodString>;
|
|
580
|
+
timezone: z.ZodString;
|
|
581
|
+
status: z.ZodEnum<{
|
|
582
|
+
open: "open";
|
|
583
|
+
closed: "closed";
|
|
584
|
+
sold_out: "sold_out";
|
|
585
|
+
cancelled: "cancelled";
|
|
586
|
+
on_request: "on_request";
|
|
587
|
+
}>;
|
|
588
|
+
availabilityState: z.ZodEnum<{
|
|
589
|
+
closed: "closed";
|
|
590
|
+
sold_out: "sold_out";
|
|
591
|
+
cancelled: "cancelled";
|
|
592
|
+
past_cutoff: "past_cutoff";
|
|
593
|
+
too_early: "too_early";
|
|
594
|
+
unavailable: "unavailable";
|
|
595
|
+
on_request: "on_request";
|
|
596
|
+
available: "available";
|
|
597
|
+
}>;
|
|
598
|
+
capacity: z.ZodNullable<z.ZodNumber>;
|
|
599
|
+
remaining: z.ZodNullable<z.ZodNumber>;
|
|
600
|
+
pastCutoff: z.ZodBoolean;
|
|
601
|
+
tooEarly: z.ZodBoolean;
|
|
602
|
+
}, z.core.$strip>>;
|
|
603
|
+
total: z.ZodNumber;
|
|
604
|
+
limit: z.ZodNumber;
|
|
605
|
+
offset: z.ZodNumber;
|
|
606
|
+
}, z.core.$strip>;
|
|
607
|
+
}, z.core.$strip>;
|
|
437
608
|
export declare const storefrontDeparturePricePreviewInputSchema: z.ZodObject<{
|
|
438
609
|
pax: z.ZodDefault<z.ZodObject<{
|
|
439
610
|
adults: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
@@ -682,6 +853,7 @@ export type StorefrontPaymentMethodCode = z.infer<typeof storefrontPaymentMethod
|
|
|
682
853
|
export type StorefrontSettingsInput = z.infer<typeof storefrontSettingsInputSchema>;
|
|
683
854
|
export type StorefrontSettings = z.infer<typeof storefrontSettingsSchema>;
|
|
684
855
|
export type StorefrontDepartureListQuery = z.infer<typeof storefrontDepartureListQuerySchema>;
|
|
856
|
+
export type StorefrontProductAvailabilitySummaryQuery = z.infer<typeof storefrontProductAvailabilitySummaryQuerySchema>;
|
|
685
857
|
export type StorefrontDeparturePricePreviewInput = z.infer<typeof storefrontDeparturePricePreviewInputSchema>;
|
|
686
858
|
export type StorefrontPromotionalOffer = z.infer<typeof storefrontPromotionalOfferSchema>;
|
|
687
859
|
//# sourceMappingURL=validation.d.ts.map
|
package/dist/validation.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAQvB,eAAO,MAAM,iCAAiC;;;;;;EAM5C,CAAA;AAEF,eAAO,MAAM,6BAA6B;;;;;;;;;EASxC,CAAA;AAEF,eAAO,MAAM,+BAA+B;;;iBAG1C,CAAA;AAEF,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;iBASzC,CAAA;AAEF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;iBASpC,CAAA;AAEF,eAAO,MAAM,kCAAkC;;;;;;;;;;;iBAK7C,CAAA;AAEF,eAAO,MAAM,6BAA6B;;;;;;;;;;;iBAKxC,CAAA;AAEF,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAwCxC,CAAA;AAEF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA0BnC,CAAA;AAEF,eAAO,MAAM,+BAA+B;;;;;;EAM1C,CAAA;AAEF,eAAO,MAAM,sCAAsC;;;;iBAIjD,CAAA;AAEF,eAAO,MAAM,kCAAkC;;;;;;;;;;;;iBAQ7C,CAAA;AAEF,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;iBAY5C,CAAA;AAEF,eAAO,MAAM,kCAAkC;;;;;iBAK7C,CAAA;AAEF,eAAO,MAAM,yBAAyB;;;;;;;;;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AM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAA;AACnF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA;AACzE,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAA;AAC7F,MAAM,MAAM,yCAAyC,GAAG,CAAC,CAAC,KAAK,CAC7D,OAAO,+CAA+C,CACvD,CAAA;AACD,MAAM,MAAM,oCAAoC,GAAG,CAAC,CAAC,KAAK,CACxD,OAAO,0CAA0C,CAClD,CAAA;AACD,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAA"}
|
package/dist/validation.js
CHANGED
|
@@ -197,6 +197,62 @@ export const storefrontDepartureListResponseSchema = z.object({
|
|
|
197
197
|
limit: z.number().int(),
|
|
198
198
|
offset: z.number().int(),
|
|
199
199
|
});
|
|
200
|
+
export const storefrontProductAvailabilityStateSchema = z.enum([
|
|
201
|
+
"available",
|
|
202
|
+
"sold_out",
|
|
203
|
+
"closed",
|
|
204
|
+
"cancelled",
|
|
205
|
+
"on_request",
|
|
206
|
+
"past_cutoff",
|
|
207
|
+
"too_early",
|
|
208
|
+
"unavailable",
|
|
209
|
+
]);
|
|
210
|
+
export const storefrontProductAvailabilitySummaryQuerySchema = z.object({
|
|
211
|
+
optionId: z.string().optional(),
|
|
212
|
+
status: storefrontDepartureStatusSchema.optional(),
|
|
213
|
+
dateFrom: z.string().date().optional(),
|
|
214
|
+
dateTo: z.string().date().optional(),
|
|
215
|
+
locale: languageTagSchema.optional(),
|
|
216
|
+
limit: z.coerce.number().int().min(1).max(250).default(100),
|
|
217
|
+
offset: z.coerce.number().int().min(0).default(0),
|
|
218
|
+
});
|
|
219
|
+
export const storefrontProductAvailabilitySlotSchema = z.object({
|
|
220
|
+
id: z.string(),
|
|
221
|
+
productId: z.string(),
|
|
222
|
+
optionId: z.string().nullable(),
|
|
223
|
+
dateLocal: z.string().nullable(),
|
|
224
|
+
startAt: z.string().nullable(),
|
|
225
|
+
endAt: z.string().nullable(),
|
|
226
|
+
timezone: z.string(),
|
|
227
|
+
status: storefrontDepartureStatusSchema,
|
|
228
|
+
availabilityState: storefrontProductAvailabilityStateSchema,
|
|
229
|
+
capacity: z.number().int().nullable(),
|
|
230
|
+
remaining: z.number().int().nullable(),
|
|
231
|
+
pastCutoff: z.boolean(),
|
|
232
|
+
tooEarly: z.boolean(),
|
|
233
|
+
});
|
|
234
|
+
export const storefrontProductAvailabilitySummarySchema = z.object({
|
|
235
|
+
productId: z.string(),
|
|
236
|
+
availabilityState: storefrontProductAvailabilityStateSchema,
|
|
237
|
+
counts: z.object({
|
|
238
|
+
total: z.number().int(),
|
|
239
|
+
open: z.number().int(),
|
|
240
|
+
closed: z.number().int(),
|
|
241
|
+
soldOut: z.number().int(),
|
|
242
|
+
cancelled: z.number().int(),
|
|
243
|
+
onRequest: z.number().int(),
|
|
244
|
+
pastCutoff: z.number().int(),
|
|
245
|
+
tooEarly: z.number().int(),
|
|
246
|
+
available: z.number().int(),
|
|
247
|
+
}),
|
|
248
|
+
departures: z.array(storefrontProductAvailabilitySlotSchema),
|
|
249
|
+
total: z.number().int(),
|
|
250
|
+
limit: z.number().int(),
|
|
251
|
+
offset: z.number().int(),
|
|
252
|
+
});
|
|
253
|
+
export const storefrontProductAvailabilitySummaryResponseSchema = z.object({
|
|
254
|
+
data: storefrontProductAvailabilitySummarySchema,
|
|
255
|
+
});
|
|
200
256
|
export const storefrontDeparturePricePreviewInputSchema = z.object({
|
|
201
257
|
pax: z
|
|
202
258
|
.object({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voyantjs/storefront",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -29,18 +29,18 @@
|
|
|
29
29
|
"drizzle-orm": "^0.45.2",
|
|
30
30
|
"hono": "^4.12.10",
|
|
31
31
|
"zod": "^4.3.6",
|
|
32
|
-
"@voyantjs/availability": "0.
|
|
33
|
-
"@voyantjs/core": "0.
|
|
34
|
-
"@voyantjs/extras": "0.
|
|
35
|
-
"@voyantjs/hono": "0.
|
|
36
|
-
"@voyantjs/pricing": "0.
|
|
37
|
-
"@voyantjs/products": "0.
|
|
38
|
-
"@voyantjs/sellability": "0.
|
|
32
|
+
"@voyantjs/availability": "0.23.0",
|
|
33
|
+
"@voyantjs/core": "0.23.0",
|
|
34
|
+
"@voyantjs/extras": "0.23.0",
|
|
35
|
+
"@voyantjs/hono": "0.23.0",
|
|
36
|
+
"@voyantjs/pricing": "0.23.0",
|
|
37
|
+
"@voyantjs/products": "0.23.0",
|
|
38
|
+
"@voyantjs/sellability": "0.23.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"typescript": "^6.0.2",
|
|
42
42
|
"vitest": "^4.1.2",
|
|
43
|
-
"@voyantjs/db": "0.
|
|
43
|
+
"@voyantjs/db": "0.23.0",
|
|
44
44
|
"@voyantjs/voyant-typescript-config": "0.1.0"
|
|
45
45
|
},
|
|
46
46
|
"files": [
|