@voyantjs/storefront 0.5.0 → 0.6.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAEvD,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAA;AAEjE,YAAY,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAChE,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAA;AACjE,YAAY,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAA;AAC5D,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAA;AACjF,YAAY,EACV,4BAA4B,EAC5B,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,EACvB,2BAA2B,EAC3B,4BAA4B,EAC5B,0BAA0B,EAC1B,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,kCAAkC,EAClC,kCAAkC,EAClC,qCAAqC,EACrC,0CAA0C,EAC1C,qCAAqC,EACrC,yBAAyB,EACzB,8BAA8B,EAC9B,+BAA+B,EAC/B,yBAAyB,EACzB,6BAA6B,EAC7B,iCAAiC,EACjC,kCAAkC,EAClC,6BAA6B,EAC7B,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,CAKZ"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAEvD,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAA;AAEjE,YAAY,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAChE,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAA;AACjE,YAAY,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAA;AAC5D,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAA;AACjF,YAAY,EACV,4BAA4B,EAC5B,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,EACvB,2BAA2B,EAC3B,4BAA4B,EAC5B,0BAA0B,EAC1B,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,kCAAkC,EAClC,kCAAkC,EAClC,qCAAqC,EACrC,0CAA0C,EAC1C,qCAAqC,EACrC,yBAAyB,EACzB,8BAA8B,EAC9B,+BAA+B,EAC/B,yBAAyB,EACzB,6BAA6B,EAC7B,iCAAiC,EACjC,kCAAkC,EAClC,6BAA6B,EAC7B,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
@@ -8,6 +8,7 @@ export const storefrontModule = {
8
8
  export function createStorefrontHonoModule(options) {
9
9
  return {
10
10
  module: storefrontModule,
11
+ publicPath: "/",
11
12
  publicRoutes: createStorefrontPublicRoutes(options),
12
13
  };
13
14
  }
@@ -28,7 +28,7 @@ export declare function createStorefrontPublicRoutes(options?: StorefrontService
28
28
  fields: {
29
29
  key: string;
30
30
  label: string;
31
- type: "date" | "select" | "email" | "country" | "text" | "tel" | "textarea" | "checkbox";
31
+ type: "date" | "select" | "email" | "text" | "country" | "tel" | "textarea" | "checkbox";
32
32
  required: boolean;
33
33
  placeholder: string | null;
34
34
  description: string | null;
@@ -43,7 +43,7 @@ export declare function createStorefrontPublicRoutes(options?: StorefrontService
43
43
  fields: {
44
44
  key: string;
45
45
  label: string;
46
- type: "date" | "select" | "email" | "country" | "text" | "tel" | "textarea" | "checkbox";
46
+ type: "date" | "select" | "email" | "text" | "country" | "tel" | "textarea" | "checkbox";
47
47
  required: boolean;
48
48
  placeholder: string | null;
49
49
  description: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"routes-public.d.ts","sourceRoot":"","sources":["../src/routes-public.ts"],"names":[],"mappings":"AAEA,OAAO,EAA2B,KAAK,wBAAwB,EAAE,MAAM,cAAc,CAAA;AAQrF,KAAK,GAAG,GAAG;IACT,SAAS,EAAE;QACT,EAAE,EAAE,OAAO,CAAA;KACZ,CAAA;CACF,CAAA;AAED,wBAAgB,4BAA4B,CAAC,OAAO,CAAC,EAAE,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAoF9E;AAED,MAAM,MAAM,sBAAsB,GAAG,UAAU,CAAC,OAAO,4BAA4B,CAAC,CAAA"}
1
+ {"version":3,"file":"routes-public.d.ts","sourceRoot":"","sources":["../src/routes-public.ts"],"names":[],"mappings":"AAGA,OAAO,EAA2B,KAAK,wBAAwB,EAAE,MAAM,cAAc,CAAA;AAQrF,KAAK,GAAG,GAAG;IACT,SAAS,EAAE;QACT,EAAE,EAAE,OAAO,CAAA;KACZ,CAAA;CACF,CAAA;AAED,wBAAgB,4BAA4B,CAAC,OAAO,CAAC,EAAE,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBA8E9E;AAED,MAAM,MAAM,sBAAsB,GAAG,UAAU,CAAC,OAAO,4BAA4B,CAAC,CAAA"}
@@ -1,3 +1,4 @@
1
+ import { parseJsonBody, parseQuery } from "@voyantjs/hono";
1
2
  import { Hono } from "hono";
2
3
  import { createStorefrontService } from "./service.js";
3
4
  import { storefrontDepartureListQuerySchema, storefrontDeparturePricePreviewInputSchema, storefrontProductExtensionsQuerySchema, storefrontPromotionalOfferListQuerySchema, } from "./validation.js";
@@ -14,17 +15,18 @@ export function createStorefrontPublicRoutes(options) {
14
15
  : c.json({ error: "Storefront departure not found" }, 404);
15
16
  })
16
17
  .get("/products/:productId/departures", async (c) => {
17
- return c.json(await storefrontService.listProductDepartures(c.get("db"), c.req.param("productId"), storefrontDepartureListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams))));
18
+ return c.json(await storefrontService.listProductDepartures(c.get("db"), c.req.param("productId"), await parseQuery(c, storefrontDepartureListQuerySchema)));
18
19
  })
19
20
  .post("/departures/:departureId/price", async (c) => {
20
- const preview = await storefrontService.previewDeparturePrice(c.get("db"), c.req.param("departureId"), storefrontDeparturePricePreviewInputSchema.parse(await c.req.json().catch(() => ({}))));
21
+ const preview = await storefrontService.previewDeparturePrice(c.get("db"), c.req.param("departureId"), await parseJsonBody(c, storefrontDeparturePricePreviewInputSchema));
21
22
  return preview
22
23
  ? c.json({ data: preview })
23
24
  : c.json({ error: "Storefront departure not found" }, 404);
24
25
  })
25
26
  .get("/products/:productId/extensions", async (c) => {
27
+ const query = await parseQuery(c, storefrontProductExtensionsQuerySchema);
26
28
  return c.json({
27
- data: await storefrontService.getProductExtensions(c.get("db"), c.req.param("productId"), storefrontProductExtensionsQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams)).optionId),
29
+ data: await storefrontService.getProductExtensions(c.get("db"), c.req.param("productId"), query.optionId),
28
30
  });
29
31
  })
30
32
  .get("/products/:productId/departures/:departureId/itinerary", async (c) => {
@@ -37,7 +39,7 @@ export function createStorefrontPublicRoutes(options) {
37
39
  : c.json({ error: "Storefront itinerary not found" }, 404);
38
40
  })
39
41
  .get("/products/:productId/offers", async (c) => {
40
- const query = storefrontPromotionalOfferListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
42
+ const query = await parseQuery(c, storefrontPromotionalOfferListQuerySchema);
41
43
  return c.json({
42
44
  data: await storefrontService.listApplicableOffers({
43
45
  productId: c.req.param("productId"),
@@ -47,7 +49,7 @@ export function createStorefrontPublicRoutes(options) {
47
49
  });
48
50
  })
49
51
  .get("/offers/:slug", async (c) => {
50
- const query = storefrontPromotionalOfferListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
52
+ const query = await parseQuery(c, storefrontPromotionalOfferListQuerySchema);
51
53
  const offer = await storefrontService.getOfferBySlug({
52
54
  slug: c.req.param("slug"),
53
55
  locale: query.locale,
@@ -10,8 +10,8 @@ export declare const storefrontFormFieldTypeSchema: z.ZodEnum<{
10
10
  date: "date";
11
11
  select: "select";
12
12
  email: "email";
13
- country: "country";
14
13
  text: "text";
14
+ country: "country";
15
15
  tel: "tel";
16
16
  textarea: "textarea";
17
17
  checkbox: "checkbox";
@@ -27,8 +27,8 @@ export declare const storefrontFormFieldInputSchema: z.ZodObject<{
27
27
  date: "date";
28
28
  select: "select";
29
29
  email: "email";
30
- country: "country";
31
30
  text: "text";
31
+ country: "country";
32
32
  tel: "tel";
33
33
  textarea: "textarea";
34
34
  checkbox: "checkbox";
@@ -49,8 +49,8 @@ export declare const storefrontFormFieldSchema: z.ZodObject<{
49
49
  date: "date";
50
50
  select: "select";
51
51
  email: "email";
52
- country: "country";
53
52
  text: "text";
53
+ country: "country";
54
54
  tel: "tel";
55
55
  textarea: "textarea";
56
56
  checkbox: "checkbox";
@@ -111,8 +111,8 @@ export declare const storefrontSettingsInputSchema: z.ZodObject<{
111
111
  date: "date";
112
112
  select: "select";
113
113
  email: "email";
114
- country: "country";
115
114
  text: "text";
115
+ country: "country";
116
116
  tel: "tel";
117
117
  textarea: "textarea";
118
118
  checkbox: "checkbox";
@@ -135,8 +135,8 @@ export declare const storefrontSettingsInputSchema: z.ZodObject<{
135
135
  date: "date";
136
136
  select: "select";
137
137
  email: "email";
138
- country: "country";
139
138
  text: "text";
139
+ country: "country";
140
140
  tel: "tel";
141
141
  textarea: "textarea";
142
142
  checkbox: "checkbox";
@@ -197,8 +197,8 @@ export declare const storefrontSettingsSchema: z.ZodObject<{
197
197
  date: "date";
198
198
  select: "select";
199
199
  email: "email";
200
- country: "country";
201
200
  text: "text";
201
+ country: "country";
202
202
  tel: "tel";
203
203
  textarea: "textarea";
204
204
  checkbox: "checkbox";
@@ -221,8 +221,8 @@ export declare const storefrontSettingsSchema: z.ZodObject<{
221
221
  date: "date";
222
222
  select: "select";
223
223
  email: "email";
224
- country: "country";
225
224
  text: "text";
225
+ country: "country";
226
226
  tel: "tel";
227
227
  textarea: "textarea";
228
228
  checkbox: "checkbox";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voyantjs/storefront",
3
- "version": "0.5.0",
3
+ "version": "0.6.2",
4
4
  "license": "FSL-1.1-Apache-2.0",
5
5
  "type": "module",
6
6
  "exports": {
@@ -25,18 +25,18 @@
25
25
  "drizzle-orm": "^0.45.2",
26
26
  "hono": "^4.12.10",
27
27
  "zod": "^4.3.6",
28
- "@voyantjs/availability": "0.5.0",
29
- "@voyantjs/core": "0.5.0",
30
- "@voyantjs/extras": "0.5.0",
31
- "@voyantjs/hono": "0.5.0",
32
- "@voyantjs/pricing": "0.5.0",
33
- "@voyantjs/products": "0.5.0",
34
- "@voyantjs/sellability": "0.5.0"
28
+ "@voyantjs/availability": "0.6.2",
29
+ "@voyantjs/core": "0.6.2",
30
+ "@voyantjs/extras": "0.6.2",
31
+ "@voyantjs/hono": "0.6.2",
32
+ "@voyantjs/pricing": "0.6.2",
33
+ "@voyantjs/products": "0.6.2",
34
+ "@voyantjs/sellability": "0.6.2"
35
35
  },
36
36
  "devDependencies": {
37
37
  "typescript": "^6.0.2",
38
38
  "vitest": "^4.1.2",
39
- "@voyantjs/db": "0.5.0",
39
+ "@voyantjs/db": "0.6.2",
40
40
  "@voyantjs/voyant-typescript-config": "0.1.0"
41
41
  },
42
42
  "files": [