@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 CHANGED
@@ -3,6 +3,42 @@
3
3
  Public storefront routes and service helpers for checkout-adjacent product, departure,
4
4
  offer, and eligibility flows.
5
5
 
6
+ ## Composite Price Preview
7
+
8
+ `POST /departures/:departureId/price` preserves the original quote fields
9
+ (`basePrice`, `taxAmount`, `total`, `notes`, and `lineItems`) and now also
10
+ returns the context needed to render a checkout price card in one request:
11
+
12
+ - `allocation` describes the resolved public departure slot, capacity state,
13
+ requested traveler mix, requested units, and selected rooms.
14
+ - `units` and `rooms` expose customer-facing pricing rows for per-person,
15
+ per-unit, or room-based products.
16
+ - `extras` lists active product extensions with selection/applicability,
17
+ quantity, unit price, and price impact.
18
+ - `offers` lists applicable public offers, selected/applied discounts,
19
+ requested manual offer/code results, and conflict policy.
20
+ - `totals` carries base, extras, subtotal, discount, tax, final total,
21
+ per-person, and per-booking amounts in the selected currency.
22
+
23
+ Request bodies remain compatible with simple price preview calls:
24
+
25
+ ```json
26
+ {
27
+ "pax": { "adults": 2, "children": 0, "infants": 0 },
28
+ "rooms": [{ "unitId": "ount_room", "occupancy": 2, "quantity": 1 }],
29
+ "extras": [{ "extraId": "pext_transfer", "quantity": 1 }],
30
+ "offers": [{ "slug": "early-booking" }],
31
+ "offerCode": "SPRING25",
32
+ "locale": "en",
33
+ "market": "default"
34
+ }
35
+ ```
36
+
37
+ Offer resolution is optional and host-owned. Wire the storefront module with
38
+ `offers` or `resolveOffers` resolvers to populate offer applicability and manual
39
+ offer/code impacts. Without resolvers, the route still returns allocation,
40
+ units, rooms, extras, and final totals with an empty `offers` block.
41
+
6
42
  ## Public Intake
7
43
 
8
44
  Storefront can accept public CRM intake at the public root:
package/dist/index.d.ts CHANGED
@@ -1,15 +1,18 @@
1
1
  import type { Module } from "@voyantjs/core";
2
2
  import type { HonoModule } from "@voyantjs/hono/module";
3
3
  import { createStorefrontPublicRoutes } from "./routes-public.js";
4
+ export type { StorefrontAdminRoutes } from "./routes-admin.js";
5
+ export { createStorefrontAdminRoutes } from "./routes-admin.js";
4
6
  export type { StorefrontPublicRoutes } from "./routes-public.js";
5
7
  export { createStorefrontPublicRoutes } from "./routes-public.js";
6
8
  export type { StorefrontOfferResolvers, StorefrontRequestContext, StorefrontServiceOptions, } from "./service.js";
7
- export { createStorefrontService, resolveStorefrontSettings } from "./service.js";
9
+ export { createStorefrontService, mergeStorefrontSettingsPatch, resolveStorefrontSettings, } from "./service.js";
10
+ export type { StorefrontBookingSessionBootstrapOptions } from "./service-booking-session-bootstrap.js";
8
11
  export type { StorefrontIntakeGuard, StorefrontIntakeGuardDecision, StorefrontIntakeOptions, StorefrontNewsletterDoubleOptInHook, } from "./service-intake.js";
9
12
  export { CUSTOMER_SIGNAL_CREATED_EVENT } from "./service-intake.js";
10
13
  export { evaluateStorefrontTransportEligibility } from "./service-transport-eligibility.js";
11
- export type { StorefrontAppliedOffer, StorefrontDepartureListQuery, StorefrontFormField, StorefrontFormFieldInput, StorefrontIntakeConsent, StorefrontIntakeResponse, StorefrontLeadContact, StorefrontLeadIntakeInput, StorefrontNewsletterSubscribeInput, StorefrontNewsletterSubscribeResponse, StorefrontOfferApplyInput, StorefrontOfferMutationResult, StorefrontOfferRedeemInput, StorefrontPaymentMethod, StorefrontPaymentMethodCode, StorefrontPaymentMethodInput, StorefrontProductAvailabilitySummaryQuery, StorefrontPromotionalOffer, StorefrontSettings, StorefrontSettingsInput, } from "./validation.js";
12
- export { storefrontAppliedOfferSchema, storefrontDepartureItinerarySchema, storefrontDepartureListQuerySchema, storefrontDepartureListResponseSchema, storefrontDeparturePricePreviewInputSchema, storefrontDeparturePricePreviewSchema, storefrontDepartureSchema, storefrontFormFieldInputSchema, storefrontFormFieldOptionSchema, storefrontFormFieldSchema, storefrontFormFieldTypeSchema, storefrontIntakeConsentSchema, storefrontIntakeResponseSchema, storefrontLeadContactSchema, storefrontLeadIntakeInputSchema, storefrontNewsletterSubscribeInputSchema, storefrontNewsletterSubscribeResponseSchema, storefrontOfferApplyInputSchema, storefrontOfferAudienceSchema, storefrontOfferConflictSchema, storefrontOfferMutationReasonSchema, storefrontOfferMutationResponseSchema, storefrontOfferMutationResultSchema, storefrontOfferMutationStatusSchema, storefrontOfferRedeemInputSchema, storefrontPaymentMethodCodeSchema, storefrontPaymentMethodInputSchema, storefrontPaymentMethodSchema, storefrontProductAvailabilitySlotSchema, storefrontProductAvailabilityStateSchema, storefrontProductAvailabilitySummaryQuerySchema, storefrontProductAvailabilitySummaryResponseSchema, storefrontProductAvailabilitySummarySchema, storefrontProductExtensionsQuerySchema, storefrontProductExtensionsResponseSchema, storefrontPromotionalOfferListQuerySchema, storefrontPromotionalOfferListResponseSchema, storefrontPromotionalOfferResponseSchema, storefrontPromotionalOfferSchema, storefrontSettingsInputSchema, storefrontSettingsSchema, } from "./validation.js";
14
+ export type { StorefrontAppliedOffer, StorefrontBankTransfer, StorefrontBankTransferInput, StorefrontBookingSessionBootstrap, StorefrontBookingSessionBootstrapInput, StorefrontCurrencyDisplay, StorefrontDepartureListQuery, StorefrontDeparturePricePreview, StorefrontFormField, StorefrontFormFieldInput, StorefrontIntakeConsent, StorefrontIntakeResponse, StorefrontLeadContact, StorefrontLeadIntakeInput, StorefrontNewsletterSubscribeInput, StorefrontNewsletterSubscribeResponse, StorefrontOfferApplyInput, StorefrontOfferMutationResult, StorefrontOfferRedeemInput, StorefrontPaymentMethod, StorefrontPaymentMethodCode, StorefrontPaymentMethodInput, StorefrontPaymentSchedule, StorefrontPaymentScheduleInput, StorefrontProductAvailabilitySummaryQuery, StorefrontPromotionalOffer, StorefrontSettings, StorefrontSettingsInput, StorefrontSettingsPatchInput, StorefrontSupportLink, StorefrontSupportLinkInput, } from "./validation.js";
15
+ export { storefrontAppliedOfferSchema, storefrontBankTransferInputSchema, storefrontBankTransferSchema, storefrontBookingSessionAvailabilitySnapshotSchema, storefrontBookingSessionBootstrapInputSchema, storefrontBookingSessionBootstrapSchema, storefrontBookingSessionPaymentPlanSchema, storefrontBookingSessionQuoteSchema, storefrontBookingSessionRepricingSnapshotSchema, storefrontCurrencyDisplaySchema, storefrontDepartureItinerarySchema, storefrontDepartureListQuerySchema, storefrontDepartureListResponseSchema, storefrontDeparturePriceAllocationSchema, storefrontDeparturePriceExtraImpactSchema, storefrontDeparturePriceLineItemSchema, storefrontDeparturePriceOfferImpactSchema, storefrontDeparturePriceOffersSchema, storefrontDeparturePricePaxSchema, storefrontDeparturePricePreviewInputSchema, storefrontDeparturePricePreviewSchema, storefrontDeparturePriceRequestedOfferSchema, storefrontDeparturePriceRoomRowSchema, storefrontDeparturePriceSlotSchema, storefrontDeparturePriceTotalsSchema, storefrontDeparturePriceUnitRowSchema, storefrontDepartureSchema, storefrontFormFieldInputSchema, storefrontFormFieldOptionSchema, storefrontFormFieldSchema, storefrontFormFieldTypeSchema, storefrontIntakeConsentSchema, storefrontIntakeResponseSchema, storefrontLeadContactSchema, storefrontLeadIntakeInputSchema, storefrontNewsletterSubscribeInputSchema, storefrontNewsletterSubscribeResponseSchema, storefrontOfferApplyInputSchema, storefrontOfferAudienceSchema, storefrontOfferConflictSchema, storefrontOfferMutationReasonSchema, storefrontOfferMutationResponseSchema, storefrontOfferMutationResultSchema, storefrontOfferMutationStatusSchema, storefrontOfferRedeemInputSchema, storefrontPaymentMethodCodeSchema, storefrontPaymentMethodInputSchema, storefrontPaymentMethodSchema, storefrontPaymentScheduleInputSchema, storefrontPaymentScheduleSchema, storefrontProductAvailabilitySlotSchema, storefrontProductAvailabilityStateSchema, storefrontProductAvailabilitySummaryQuerySchema, storefrontProductAvailabilitySummaryResponseSchema, storefrontProductAvailabilitySummarySchema, storefrontProductExtensionsQuerySchema, storefrontProductExtensionsResponseSchema, storefrontPromotionalOfferListQuerySchema, storefrontPromotionalOfferListResponseSchema, storefrontPromotionalOfferResponseSchema, storefrontPromotionalOfferSchema, storefrontSettingsInputSchema, storefrontSettingsPatchSchema, storefrontSettingsSchema, storefrontSupportLinkInputSchema, storefrontSupportLinkSchema, } from "./validation.js";
13
16
  export type { StorefrontTransportEligibilityInput, StorefrontTransportEligibilityIssue, StorefrontTransportEligibilityResult, StorefrontTransportEligibilityRule, StorefrontTransportEligibilityRuleInput, } from "./validation-transport-eligibility.js";
14
17
  export { storefrontRequiredDocumentTypeSchema, storefrontTransportEligibilityDocumentInputSchema, storefrontTransportEligibilityInputSchema, storefrontTransportEligibilityIssueCodeSchema, storefrontTransportEligibilityIssueSchema, storefrontTransportEligibilityResultSchema, storefrontTransportEligibilityRuleSchema, storefrontTransportEligibilitySeveritySchema, storefrontTransportEligibilityTravelerInputSchema, storefrontTransportEligibilityTravelerResultSchema, storefrontTravelDocumentTypeSchema, } from "./validation-transport-eligibility.js";
15
18
  export declare const storefrontModule: Module;
@@ -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,EACV,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAA;AACjF,YAAY,EACV,qBAAqB,EACrB,6BAA6B,EAC7B,uBAAuB,EACvB,mCAAmC,GACpC,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAA;AACnE,OAAO,EAAE,sCAAsC,EAAE,MAAM,oCAAoC,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,yCAAyC,EACzC,4CAA4C,EAC5C,wCAAwC,EACxC,gCAAgC,EAChC,6BAA6B,EAC7B,6BAA6B,EAC7B,wBAAwB,EACxB,gCAAgC,EAChC,2BAA2B,GAC5B,MAAM,iBAAiB,CAAA;AACxB,YAAY,EACV,mCAAmC,EACnC,mCAAmC,EACnC,oCAAoC,EACpC,kCAAkC,EAClC,uCAAuC,GACxC,MAAM,uCAAuC,CAAA;AAC9C,OAAO,EACL,oCAAoC,EACpC,iDAAiD,EACjD,yCAAyC,EACzC,6CAA6C,EAC7C,yCAAyC,EACzC,0CAA0C,EAC1C,wCAAwC,EACxC,4CAA4C,EAC5C,iDAAiD,EACjD,kDAAkD,EAClD,kCAAkC,GACnC,MAAM,uCAAuC,CAAA;AAE9C,eAAO,MAAM,gBAAgB,EAAE,MAE9B,CAAA;AAED,wBAAgB,0BAA0B,CACxC,OAAO,CAAC,EAAE,UAAU,CAAC,OAAO,4BAA4B,CAAC,CAAC,CAAC,CAAC,GAC3D,UAAU,CAOZ"}
package/dist/index.js CHANGED
@@ -1,9 +1,11 @@
1
+ import { createStorefrontAdminRoutes } from "./routes-admin.js";
1
2
  import { createStorefrontPublicRoutes } from "./routes-public.js";
3
+ export { createStorefrontAdminRoutes } from "./routes-admin.js";
2
4
  export { createStorefrontPublicRoutes } from "./routes-public.js";
3
- export { createStorefrontService, resolveStorefrontSettings } from "./service.js";
5
+ export { createStorefrontService, mergeStorefrontSettingsPatch, resolveStorefrontSettings, } from "./service.js";
4
6
  export { CUSTOMER_SIGNAL_CREATED_EVENT } from "./service-intake.js";
5
7
  export { evaluateStorefrontTransportEligibility } from "./service-transport-eligibility.js";
6
- export { storefrontAppliedOfferSchema, storefrontDepartureItinerarySchema, storefrontDepartureListQuerySchema, storefrontDepartureListResponseSchema, storefrontDeparturePricePreviewInputSchema, storefrontDeparturePricePreviewSchema, storefrontDepartureSchema, storefrontFormFieldInputSchema, storefrontFormFieldOptionSchema, storefrontFormFieldSchema, storefrontFormFieldTypeSchema, storefrontIntakeConsentSchema, storefrontIntakeResponseSchema, storefrontLeadContactSchema, storefrontLeadIntakeInputSchema, storefrontNewsletterSubscribeInputSchema, storefrontNewsletterSubscribeResponseSchema, storefrontOfferApplyInputSchema, storefrontOfferAudienceSchema, storefrontOfferConflictSchema, storefrontOfferMutationReasonSchema, storefrontOfferMutationResponseSchema, storefrontOfferMutationResultSchema, storefrontOfferMutationStatusSchema, storefrontOfferRedeemInputSchema, storefrontPaymentMethodCodeSchema, storefrontPaymentMethodInputSchema, storefrontPaymentMethodSchema, storefrontProductAvailabilitySlotSchema, storefrontProductAvailabilityStateSchema, storefrontProductAvailabilitySummaryQuerySchema, storefrontProductAvailabilitySummaryResponseSchema, storefrontProductAvailabilitySummarySchema, storefrontProductExtensionsQuerySchema, storefrontProductExtensionsResponseSchema, storefrontPromotionalOfferListQuerySchema, storefrontPromotionalOfferListResponseSchema, storefrontPromotionalOfferResponseSchema, storefrontPromotionalOfferSchema, storefrontSettingsInputSchema, storefrontSettingsSchema, } from "./validation.js";
8
+ export { storefrontAppliedOfferSchema, storefrontBankTransferInputSchema, storefrontBankTransferSchema, storefrontBookingSessionAvailabilitySnapshotSchema, storefrontBookingSessionBootstrapInputSchema, storefrontBookingSessionBootstrapSchema, storefrontBookingSessionPaymentPlanSchema, storefrontBookingSessionQuoteSchema, storefrontBookingSessionRepricingSnapshotSchema, storefrontCurrencyDisplaySchema, storefrontDepartureItinerarySchema, storefrontDepartureListQuerySchema, storefrontDepartureListResponseSchema, storefrontDeparturePriceAllocationSchema, storefrontDeparturePriceExtraImpactSchema, storefrontDeparturePriceLineItemSchema, storefrontDeparturePriceOfferImpactSchema, storefrontDeparturePriceOffersSchema, storefrontDeparturePricePaxSchema, storefrontDeparturePricePreviewInputSchema, storefrontDeparturePricePreviewSchema, storefrontDeparturePriceRequestedOfferSchema, storefrontDeparturePriceRoomRowSchema, storefrontDeparturePriceSlotSchema, storefrontDeparturePriceTotalsSchema, storefrontDeparturePriceUnitRowSchema, storefrontDepartureSchema, storefrontFormFieldInputSchema, storefrontFormFieldOptionSchema, storefrontFormFieldSchema, storefrontFormFieldTypeSchema, storefrontIntakeConsentSchema, storefrontIntakeResponseSchema, storefrontLeadContactSchema, storefrontLeadIntakeInputSchema, storefrontNewsletterSubscribeInputSchema, storefrontNewsletterSubscribeResponseSchema, storefrontOfferApplyInputSchema, storefrontOfferAudienceSchema, storefrontOfferConflictSchema, storefrontOfferMutationReasonSchema, storefrontOfferMutationResponseSchema, storefrontOfferMutationResultSchema, storefrontOfferMutationStatusSchema, storefrontOfferRedeemInputSchema, storefrontPaymentMethodCodeSchema, storefrontPaymentMethodInputSchema, storefrontPaymentMethodSchema, storefrontPaymentScheduleInputSchema, storefrontPaymentScheduleSchema, storefrontProductAvailabilitySlotSchema, storefrontProductAvailabilityStateSchema, storefrontProductAvailabilitySummaryQuerySchema, storefrontProductAvailabilitySummaryResponseSchema, storefrontProductAvailabilitySummarySchema, storefrontProductExtensionsQuerySchema, storefrontProductExtensionsResponseSchema, storefrontPromotionalOfferListQuerySchema, storefrontPromotionalOfferListResponseSchema, storefrontPromotionalOfferResponseSchema, storefrontPromotionalOfferSchema, storefrontSettingsInputSchema, storefrontSettingsPatchSchema, storefrontSettingsSchema, storefrontSupportLinkInputSchema, storefrontSupportLinkSchema, } from "./validation.js";
7
9
  export { storefrontRequiredDocumentTypeSchema, storefrontTransportEligibilityDocumentInputSchema, storefrontTransportEligibilityInputSchema, storefrontTransportEligibilityIssueCodeSchema, storefrontTransportEligibilityIssueSchema, storefrontTransportEligibilityResultSchema, storefrontTransportEligibilityRuleSchema, storefrontTransportEligibilitySeveritySchema, storefrontTransportEligibilityTravelerInputSchema, storefrontTransportEligibilityTravelerResultSchema, storefrontTravelDocumentTypeSchema, } from "./validation-transport-eligibility.js";
8
10
  export const storefrontModule = {
9
11
  name: "storefront",
@@ -11,6 +13,7 @@ export const storefrontModule = {
11
13
  export function createStorefrontHonoModule(options) {
12
14
  return {
13
15
  module: storefrontModule,
16
+ adminRoutes: createStorefrontAdminRoutes(options),
14
17
  publicPath: "/",
15
18
  publicRoutes: createStorefrontPublicRoutes(options),
16
19
  };
@@ -0,0 +1,192 @@
1
+ import { type StorefrontServiceOptions } from "./service.js";
2
+ type Env = {
3
+ Variables: {
4
+ db: unknown;
5
+ };
6
+ };
7
+ export declare function createStorefrontAdminRoutes(options?: StorefrontServiceOptions): import("hono/hono-base").HonoBase<Env, {
8
+ "/settings": {
9
+ $get: {
10
+ input: {};
11
+ output: {
12
+ data: {
13
+ branding: {
14
+ logoUrl: string | null;
15
+ faviconUrl: string | null;
16
+ brandMarkUrl: string | null;
17
+ primaryColor: string | null;
18
+ accentColor: string | null;
19
+ supportedLanguages: string[];
20
+ };
21
+ support: {
22
+ email: string | null;
23
+ phone: string | null;
24
+ links: {
25
+ label: string;
26
+ url: string;
27
+ }[];
28
+ };
29
+ legal: {
30
+ termsUrl: string | null;
31
+ privacyUrl: string | null;
32
+ cancellationUrl: string | null;
33
+ defaultContractTemplateId: string | null;
34
+ };
35
+ localization: {
36
+ defaultLocale: string | null;
37
+ currencyDisplay: "symbol" | "name" | "code";
38
+ };
39
+ forms: {
40
+ billing: {
41
+ fields: {
42
+ key: string;
43
+ label: string;
44
+ type: "text" | "date" | "select" | "email" | "country" | "tel" | "textarea" | "checkbox";
45
+ required: boolean;
46
+ placeholder: string | null;
47
+ description: string | null;
48
+ autocomplete: string | null;
49
+ options: {
50
+ value: string;
51
+ label: string;
52
+ }[];
53
+ }[];
54
+ };
55
+ travelers: {
56
+ fields: {
57
+ key: string;
58
+ label: string;
59
+ type: "text" | "date" | "select" | "email" | "country" | "tel" | "textarea" | "checkbox";
60
+ required: boolean;
61
+ placeholder: string | null;
62
+ description: string | null;
63
+ autocomplete: string | null;
64
+ options: {
65
+ value: string;
66
+ label: string;
67
+ }[];
68
+ }[];
69
+ };
70
+ };
71
+ payment: {
72
+ defaultMethod: "voucher" | "bank_transfer" | "cash" | "invoice" | "card" | null;
73
+ methods: {
74
+ code: "voucher" | "bank_transfer" | "cash" | "invoice" | "card";
75
+ label: string;
76
+ description: string | null;
77
+ enabled: boolean;
78
+ }[];
79
+ defaultSchedule: {
80
+ depositPercent: number | null;
81
+ balanceDueDaysBeforeDeparture: number | null;
82
+ } | null;
83
+ bankTransfer: {
84
+ accountHolder: string | null;
85
+ bankName: string | null;
86
+ iban: string | null;
87
+ bic: string | null;
88
+ paymentReference: string | null;
89
+ instructions: string | null;
90
+ } | null;
91
+ };
92
+ };
93
+ };
94
+ outputFormat: "json";
95
+ status: import("hono/utils/http-status").ContentfulStatusCode;
96
+ };
97
+ };
98
+ } & {
99
+ "/settings": {
100
+ $patch: {
101
+ input: {};
102
+ output: {
103
+ data: {
104
+ branding: {
105
+ logoUrl: string | null;
106
+ faviconUrl: string | null;
107
+ brandMarkUrl: string | null;
108
+ primaryColor: string | null;
109
+ accentColor: string | null;
110
+ supportedLanguages: string[];
111
+ };
112
+ support: {
113
+ email: string | null;
114
+ phone: string | null;
115
+ links: {
116
+ label: string;
117
+ url: string;
118
+ }[];
119
+ };
120
+ legal: {
121
+ termsUrl: string | null;
122
+ privacyUrl: string | null;
123
+ cancellationUrl: string | null;
124
+ defaultContractTemplateId: string | null;
125
+ };
126
+ localization: {
127
+ defaultLocale: string | null;
128
+ currencyDisplay: "symbol" | "name" | "code";
129
+ };
130
+ forms: {
131
+ billing: {
132
+ fields: {
133
+ key: string;
134
+ label: string;
135
+ type: "text" | "date" | "select" | "email" | "country" | "tel" | "textarea" | "checkbox";
136
+ required: boolean;
137
+ placeholder: string | null;
138
+ description: string | null;
139
+ autocomplete: string | null;
140
+ options: {
141
+ value: string;
142
+ label: string;
143
+ }[];
144
+ }[];
145
+ };
146
+ travelers: {
147
+ fields: {
148
+ key: string;
149
+ label: string;
150
+ type: "text" | "date" | "select" | "email" | "country" | "tel" | "textarea" | "checkbox";
151
+ required: boolean;
152
+ placeholder: string | null;
153
+ description: string | null;
154
+ autocomplete: string | null;
155
+ options: {
156
+ value: string;
157
+ label: string;
158
+ }[];
159
+ }[];
160
+ };
161
+ };
162
+ payment: {
163
+ defaultMethod: "voucher" | "bank_transfer" | "cash" | "invoice" | "card" | null;
164
+ methods: {
165
+ code: "voucher" | "bank_transfer" | "cash" | "invoice" | "card";
166
+ label: string;
167
+ description: string | null;
168
+ enabled: boolean;
169
+ }[];
170
+ defaultSchedule: {
171
+ depositPercent: number | null;
172
+ balanceDueDaysBeforeDeparture: number | null;
173
+ } | null;
174
+ bankTransfer: {
175
+ accountHolder: string | null;
176
+ bankName: string | null;
177
+ iban: string | null;
178
+ bic: string | null;
179
+ paymentReference: string | null;
180
+ instructions: string | null;
181
+ } | null;
182
+ };
183
+ };
184
+ };
185
+ outputFormat: "json";
186
+ status: import("hono/utils/http-status").ContentfulStatusCode;
187
+ };
188
+ };
189
+ }, "/", "/settings">;
190
+ export type StorefrontAdminRoutes = ReturnType<typeof createStorefrontAdminRoutes>;
191
+ export {};
192
+ //# sourceMappingURL=routes-admin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes-admin.d.ts","sourceRoot":"","sources":["../src/routes-admin.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,wBAAwB,EAC9B,MAAM,cAAc,CAAA;AAGrB,KAAK,GAAG,GAAG;IACT,SAAS,EAAE;QACT,EAAE,EAAE,OAAO,CAAA;KACZ,CAAA;CACF,CAAA;AAUD,wBAAgB,2BAA2B,CAAC,OAAO,CAAC,EAAE,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAsB7E;AAED,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAAA"}
@@ -0,0 +1,28 @@
1
+ import { ApiHttpError, parseJsonBody } from "@voyantjs/hono";
2
+ import { Hono } from "hono";
3
+ import { createStorefrontService, } from "./service.js";
4
+ import { storefrontSettingsPatchSchema } from "./validation.js";
5
+ function getRequestContext(c) {
6
+ return {
7
+ db: c.get("db"),
8
+ env: c.env,
9
+ context: c,
10
+ };
11
+ }
12
+ export function createStorefrontAdminRoutes(options) {
13
+ const storefrontService = createStorefrontService(options);
14
+ return new Hono()
15
+ .get("/settings", async (c) => {
16
+ return c.json({ data: await storefrontService.resolveSettings(getRequestContext(c)) });
17
+ })
18
+ .patch("/settings", async (c) => {
19
+ const updated = await storefrontService.updateSettings(await parseJsonBody(c, storefrontSettingsPatchSchema), getRequestContext(c));
20
+ if (!updated) {
21
+ throw new ApiHttpError("Storefront settings updates are not configured", {
22
+ status: 409,
23
+ code: "storefront_settings_update_not_configured",
24
+ });
25
+ }
26
+ return c.json({ data: updated });
27
+ });
28
+ }