@voyantjs/storefront 0.49.0 → 0.50.1

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, StorefrontBankTransferAccount, StorefrontBankTransferAccountInput, StorefrontBankTransferInput, StorefrontBookingSessionBootstrap, StorefrontBookingSessionBootstrapInput, StorefrontCurrencyDisplay, StorefrontDepartureListQuery, StorefrontDeparturePricePreview, StorefrontFormField, StorefrontFormFieldInput, StorefrontIntakeConsent, StorefrontIntakeResponse, StorefrontLeadContact, StorefrontLeadIntakeInput, StorefrontNewsletterSubscribeInput, StorefrontNewsletterSubscribeResponse, StorefrontOfferApplyInput, StorefrontOfferMutationResult, StorefrontOfferRedeemInput, StorefrontPaymentDueCondition, StorefrontPaymentMethod, StorefrontPaymentMethodCode, StorefrontPaymentMethodInput, StorefrontPaymentSchedule, StorefrontPaymentScheduleEntry, StorefrontPaymentScheduleEntryInput, StorefrontPaymentScheduleInput, StorefrontPaymentStructure, StorefrontProductAvailabilitySummaryQuery, StorefrontPromotionalOffer, StorefrontSettings, StorefrontSettingsInput, StorefrontSettingsPatchInput, StorefrontSupportLink, StorefrontSupportLinkInput, } from "./validation.js";
15
+ export { storefrontAppliedOfferSchema, storefrontBankTransferAccountInputSchema, storefrontBankTransferAccountSchema, 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, storefrontPaymentDueConditionSchema, storefrontPaymentMethodCodeSchema, storefrontPaymentMethodInputSchema, storefrontPaymentMethodSchema, storefrontPaymentScheduleEntryInputSchema, storefrontPaymentScheduleEntrySchema, storefrontPaymentScheduleInputSchema, storefrontPaymentScheduleSchema, storefrontPaymentStructureSchema, 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,uBA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9B,2BAA2B,EAC3B,+BAA+B,EAC/B,wCAAwC,EACxC,2CAA2C,EAC3C,+BAA+B,EAC/B,6BAA6B,EAC7B,6BAA6B,EAC7B,mCAAmC,EACnC,qCAAqC,EACrC,mCAAmC,EACnC,mCAAmC,EACnC,gCAAgC,EAChC,mCAAmC,EACnC,iCAAiC,EACjC,kCAAkC,EAClC,6BAA6B,EAC7B,yCAAyC,EACzC,oCAAoC,EACpC,oCAAoC,EACpC,+BAA+B,EAC/B,gCAAgC,EAChC,uCAAuC,EACvC,wCAAwC,EACxC,+CAA+C,EAC/C,kDAAkD,EAClD,0CAA0C,EAC1C,sCAAsC,EACtC,yCAAyC,EACzC,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, storefrontBankTransferAccountInputSchema, storefrontBankTransferAccountSchema, 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, storefrontPaymentDueConditionSchema, storefrontPaymentMethodCodeSchema, storefrontPaymentMethodInputSchema, storefrontPaymentMethodSchema, storefrontPaymentScheduleEntryInputSchema, storefrontPaymentScheduleEntrySchema, storefrontPaymentScheduleInputSchema, storefrontPaymentScheduleSchema, storefrontPaymentStructureSchema, 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,220 @@
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
+ structure: "split" | "full";
80
+ schedule: {
81
+ percent: number;
82
+ dueInDays: number;
83
+ dueCondition: "after_booking" | "before_departure";
84
+ }[];
85
+ defaultSchedule: {
86
+ depositPercent: number | null;
87
+ balanceDueDaysBeforeDeparture: number | null;
88
+ } | null;
89
+ bankTransfer: {
90
+ dueDays: number | null;
91
+ account: {
92
+ provider: string | null;
93
+ currency: string | null;
94
+ iban: string;
95
+ beneficiary: string;
96
+ bank: string;
97
+ } | null;
98
+ accountHolder: string | null;
99
+ bankName: string | null;
100
+ iban: string | null;
101
+ bic: string | null;
102
+ paymentReference: string | null;
103
+ instructions: string | null;
104
+ } | null;
105
+ };
106
+ };
107
+ };
108
+ outputFormat: "json";
109
+ status: import("hono/utils/http-status").ContentfulStatusCode;
110
+ };
111
+ };
112
+ } & {
113
+ "/settings": {
114
+ $patch: {
115
+ input: {};
116
+ output: {
117
+ data: {
118
+ branding: {
119
+ logoUrl: string | null;
120
+ faviconUrl: string | null;
121
+ brandMarkUrl: string | null;
122
+ primaryColor: string | null;
123
+ accentColor: string | null;
124
+ supportedLanguages: string[];
125
+ };
126
+ support: {
127
+ email: string | null;
128
+ phone: string | null;
129
+ links: {
130
+ label: string;
131
+ url: string;
132
+ }[];
133
+ };
134
+ legal: {
135
+ termsUrl: string | null;
136
+ privacyUrl: string | null;
137
+ cancellationUrl: string | null;
138
+ defaultContractTemplateId: string | null;
139
+ };
140
+ localization: {
141
+ defaultLocale: string | null;
142
+ currencyDisplay: "symbol" | "name" | "code";
143
+ };
144
+ forms: {
145
+ billing: {
146
+ fields: {
147
+ key: string;
148
+ label: string;
149
+ type: "text" | "date" | "select" | "email" | "country" | "tel" | "textarea" | "checkbox";
150
+ required: boolean;
151
+ placeholder: string | null;
152
+ description: string | null;
153
+ autocomplete: string | null;
154
+ options: {
155
+ value: string;
156
+ label: string;
157
+ }[];
158
+ }[];
159
+ };
160
+ travelers: {
161
+ fields: {
162
+ key: string;
163
+ label: string;
164
+ type: "text" | "date" | "select" | "email" | "country" | "tel" | "textarea" | "checkbox";
165
+ required: boolean;
166
+ placeholder: string | null;
167
+ description: string | null;
168
+ autocomplete: string | null;
169
+ options: {
170
+ value: string;
171
+ label: string;
172
+ }[];
173
+ }[];
174
+ };
175
+ };
176
+ payment: {
177
+ defaultMethod: "voucher" | "bank_transfer" | "cash" | "invoice" | "card" | null;
178
+ methods: {
179
+ code: "voucher" | "bank_transfer" | "cash" | "invoice" | "card";
180
+ label: string;
181
+ description: string | null;
182
+ enabled: boolean;
183
+ }[];
184
+ structure: "split" | "full";
185
+ schedule: {
186
+ percent: number;
187
+ dueInDays: number;
188
+ dueCondition: "after_booking" | "before_departure";
189
+ }[];
190
+ defaultSchedule: {
191
+ depositPercent: number | null;
192
+ balanceDueDaysBeforeDeparture: number | null;
193
+ } | null;
194
+ bankTransfer: {
195
+ dueDays: number | null;
196
+ account: {
197
+ provider: string | null;
198
+ currency: string | null;
199
+ iban: string;
200
+ beneficiary: string;
201
+ bank: string;
202
+ } | null;
203
+ accountHolder: string | null;
204
+ bankName: string | null;
205
+ iban: string | null;
206
+ bic: string | null;
207
+ paymentReference: string | null;
208
+ instructions: string | null;
209
+ } | null;
210
+ };
211
+ };
212
+ };
213
+ outputFormat: "json";
214
+ status: import("hono/utils/http-status").ContentfulStatusCode;
215
+ };
216
+ };
217
+ }, "/", "/settings">;
218
+ export type StorefrontAdminRoutes = ReturnType<typeof createStorefrontAdminRoutes>;
219
+ export {};
220
+ //# 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
+ }