@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 +36 -0
- package/dist/index.d.ts +6 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/routes-admin.d.ts +192 -0
- package/dist/routes-admin.d.ts.map +1 -0
- package/dist/routes-admin.js +28 -0
- package/dist/routes-public.d.ts +550 -15
- package/dist/routes-public.d.ts.map +1 -1
- package/dist/routes-public.js +68 -3
- package/dist/service-booking-session-bootstrap.d.ts +227 -0
- package/dist/service-booking-session-bootstrap.d.ts.map +1 -0
- package/dist/service-booking-session-bootstrap.js +297 -0
- package/dist/service-departures.d.ts +301 -2
- package/dist/service-departures.d.ts.map +1 -1
- package/dist/service-departures.js +406 -42
- package/dist/service.d.ts +600 -9
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +113 -2
- package/dist/validation-settings.d.ts +489 -0
- package/dist/validation-settings.d.ts.map +1 -0
- package/dist/validation-settings.js +205 -0
- package/dist/validation.d.ts +1260 -380
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +173 -126
- package/package.json +17 -10
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const languageTagSchema = z
|
|
3
|
+
.string()
|
|
4
|
+
.trim()
|
|
5
|
+
.regex(/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/);
|
|
6
|
+
const httpUrlSchema = z.url().refine((value) => {
|
|
7
|
+
try {
|
|
8
|
+
const protocol = new URL(value).protocol;
|
|
9
|
+
return protocol === "http:" || protocol === "https:";
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
}, { message: "URL must use http or https" });
|
|
15
|
+
const urlOrNullSchema = httpUrlSchema.nullable();
|
|
16
|
+
const colorTokenSchema = z
|
|
17
|
+
.string()
|
|
18
|
+
.trim()
|
|
19
|
+
.regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/);
|
|
20
|
+
const textOrNullSchema = z.string().trim().min(1).nullable();
|
|
21
|
+
export const storefrontPaymentMethodCodeSchema = z.enum([
|
|
22
|
+
"card",
|
|
23
|
+
"bank_transfer",
|
|
24
|
+
"cash",
|
|
25
|
+
"voucher",
|
|
26
|
+
"invoice",
|
|
27
|
+
]);
|
|
28
|
+
export const storefrontFormFieldTypeSchema = z.enum([
|
|
29
|
+
"text",
|
|
30
|
+
"email",
|
|
31
|
+
"tel",
|
|
32
|
+
"textarea",
|
|
33
|
+
"select",
|
|
34
|
+
"checkbox",
|
|
35
|
+
"date",
|
|
36
|
+
"country",
|
|
37
|
+
]);
|
|
38
|
+
export const storefrontFormFieldOptionSchema = z.object({
|
|
39
|
+
value: z.string().trim().min(1),
|
|
40
|
+
label: z.string().trim().min(1),
|
|
41
|
+
});
|
|
42
|
+
export const storefrontFormFieldInputSchema = z.object({
|
|
43
|
+
key: z.string().trim().min(1),
|
|
44
|
+
label: z.string().trim().min(1),
|
|
45
|
+
type: storefrontFormFieldTypeSchema.default("text"),
|
|
46
|
+
required: z.boolean().default(false),
|
|
47
|
+
placeholder: z.string().trim().min(1).optional().nullable(),
|
|
48
|
+
description: z.string().trim().min(1).optional().nullable(),
|
|
49
|
+
autocomplete: z.string().trim().min(1).optional().nullable(),
|
|
50
|
+
options: z.array(storefrontFormFieldOptionSchema).default([]),
|
|
51
|
+
});
|
|
52
|
+
export const storefrontFormFieldSchema = z.object({
|
|
53
|
+
key: z.string().trim().min(1),
|
|
54
|
+
label: z.string().trim().min(1),
|
|
55
|
+
type: storefrontFormFieldTypeSchema,
|
|
56
|
+
required: z.boolean(),
|
|
57
|
+
placeholder: z.string().trim().min(1).nullable(),
|
|
58
|
+
description: z.string().trim().min(1).nullable(),
|
|
59
|
+
autocomplete: z.string().trim().min(1).nullable(),
|
|
60
|
+
options: z.array(storefrontFormFieldOptionSchema),
|
|
61
|
+
});
|
|
62
|
+
export const storefrontPaymentMethodInputSchema = z.object({
|
|
63
|
+
code: storefrontPaymentMethodCodeSchema,
|
|
64
|
+
label: z.string().trim().min(1).optional(),
|
|
65
|
+
description: z.string().trim().min(1).optional().nullable(),
|
|
66
|
+
enabled: z.boolean().default(true),
|
|
67
|
+
});
|
|
68
|
+
export const storefrontPaymentMethodSchema = z.object({
|
|
69
|
+
code: storefrontPaymentMethodCodeSchema,
|
|
70
|
+
label: z.string().trim().min(1),
|
|
71
|
+
description: z.string().trim().min(1).nullable(),
|
|
72
|
+
enabled: z.boolean(),
|
|
73
|
+
});
|
|
74
|
+
export const storefrontSupportLinkInputSchema = z.object({
|
|
75
|
+
label: z.string().trim().min(1),
|
|
76
|
+
url: httpUrlSchema,
|
|
77
|
+
});
|
|
78
|
+
export const storefrontSupportLinkSchema = storefrontSupportLinkInputSchema;
|
|
79
|
+
export const storefrontBankTransferInputSchema = z.object({
|
|
80
|
+
accountHolder: z.string().trim().min(1).optional().nullable(),
|
|
81
|
+
bankName: z.string().trim().min(1).optional().nullable(),
|
|
82
|
+
iban: z.string().trim().min(1).optional().nullable(),
|
|
83
|
+
bic: z.string().trim().min(1).optional().nullable(),
|
|
84
|
+
paymentReference: z.string().trim().min(1).optional().nullable(),
|
|
85
|
+
instructions: z.string().trim().min(1).optional().nullable(),
|
|
86
|
+
});
|
|
87
|
+
export const storefrontBankTransferSchema = z.object({
|
|
88
|
+
accountHolder: textOrNullSchema,
|
|
89
|
+
bankName: textOrNullSchema,
|
|
90
|
+
iban: textOrNullSchema,
|
|
91
|
+
bic: textOrNullSchema,
|
|
92
|
+
paymentReference: textOrNullSchema,
|
|
93
|
+
instructions: textOrNullSchema,
|
|
94
|
+
});
|
|
95
|
+
export const storefrontPaymentScheduleInputSchema = z.object({
|
|
96
|
+
depositPercent: z.number().min(0).max(100).optional().nullable(),
|
|
97
|
+
balanceDueDaysBeforeDeparture: z.number().int().min(0).optional().nullable(),
|
|
98
|
+
});
|
|
99
|
+
export const storefrontPaymentScheduleSchema = z.object({
|
|
100
|
+
depositPercent: z.number().min(0).max(100).nullable(),
|
|
101
|
+
balanceDueDaysBeforeDeparture: z.number().int().min(0).nullable(),
|
|
102
|
+
});
|
|
103
|
+
export const storefrontCurrencyDisplaySchema = z.enum(["code", "symbol", "name"]);
|
|
104
|
+
export const storefrontSettingsInputSchema = z.object({
|
|
105
|
+
branding: z
|
|
106
|
+
.object({
|
|
107
|
+
logoUrl: httpUrlSchema.optional().nullable(),
|
|
108
|
+
faviconUrl: httpUrlSchema.optional().nullable(),
|
|
109
|
+
brandMarkUrl: httpUrlSchema.optional().nullable(),
|
|
110
|
+
primaryColor: colorTokenSchema.optional().nullable(),
|
|
111
|
+
accentColor: colorTokenSchema.optional().nullable(),
|
|
112
|
+
supportedLanguages: z.array(languageTagSchema).optional(),
|
|
113
|
+
})
|
|
114
|
+
.optional(),
|
|
115
|
+
support: z
|
|
116
|
+
.object({
|
|
117
|
+
email: z.email().optional().nullable(),
|
|
118
|
+
phone: z.string().trim().min(1).optional().nullable(),
|
|
119
|
+
links: z.array(storefrontSupportLinkInputSchema).optional(),
|
|
120
|
+
})
|
|
121
|
+
.optional(),
|
|
122
|
+
legal: z
|
|
123
|
+
.object({
|
|
124
|
+
termsUrl: httpUrlSchema.optional().nullable(),
|
|
125
|
+
privacyUrl: httpUrlSchema.optional().nullable(),
|
|
126
|
+
cancellationUrl: httpUrlSchema.optional().nullable(),
|
|
127
|
+
defaultContractTemplateId: z.string().trim().min(1).optional().nullable(),
|
|
128
|
+
})
|
|
129
|
+
.optional(),
|
|
130
|
+
localization: z
|
|
131
|
+
.object({
|
|
132
|
+
defaultLocale: languageTagSchema.optional().nullable(),
|
|
133
|
+
currencyDisplay: storefrontCurrencyDisplaySchema.optional(),
|
|
134
|
+
})
|
|
135
|
+
.optional(),
|
|
136
|
+
forms: z
|
|
137
|
+
.object({
|
|
138
|
+
billing: z
|
|
139
|
+
.object({
|
|
140
|
+
fields: z.array(storefrontFormFieldInputSchema).default([]),
|
|
141
|
+
})
|
|
142
|
+
.optional(),
|
|
143
|
+
travelers: z
|
|
144
|
+
.object({
|
|
145
|
+
fields: z.array(storefrontFormFieldInputSchema).default([]),
|
|
146
|
+
})
|
|
147
|
+
.optional(),
|
|
148
|
+
})
|
|
149
|
+
.optional(),
|
|
150
|
+
payment: z
|
|
151
|
+
.object({
|
|
152
|
+
defaultMethod: storefrontPaymentMethodCodeSchema.optional().nullable(),
|
|
153
|
+
methods: z.array(storefrontPaymentMethodInputSchema).optional(),
|
|
154
|
+
defaultSchedule: storefrontPaymentScheduleInputSchema.optional().nullable(),
|
|
155
|
+
bankTransfer: storefrontBankTransferInputSchema.optional().nullable(),
|
|
156
|
+
})
|
|
157
|
+
.optional(),
|
|
158
|
+
});
|
|
159
|
+
export const storefrontSettingsSchema = z.object({
|
|
160
|
+
branding: z.object({
|
|
161
|
+
logoUrl: urlOrNullSchema,
|
|
162
|
+
faviconUrl: urlOrNullSchema,
|
|
163
|
+
brandMarkUrl: urlOrNullSchema,
|
|
164
|
+
primaryColor: colorTokenSchema.nullable(),
|
|
165
|
+
accentColor: colorTokenSchema.nullable(),
|
|
166
|
+
supportedLanguages: z.array(languageTagSchema),
|
|
167
|
+
}),
|
|
168
|
+
support: z.object({
|
|
169
|
+
email: z.email().nullable(),
|
|
170
|
+
phone: z.string().trim().min(1).nullable(),
|
|
171
|
+
links: z.array(storefrontSupportLinkSchema),
|
|
172
|
+
}),
|
|
173
|
+
legal: z.object({
|
|
174
|
+
termsUrl: urlOrNullSchema,
|
|
175
|
+
privacyUrl: urlOrNullSchema,
|
|
176
|
+
cancellationUrl: urlOrNullSchema,
|
|
177
|
+
defaultContractTemplateId: z.string().trim().min(1).nullable(),
|
|
178
|
+
}),
|
|
179
|
+
localization: z.object({
|
|
180
|
+
defaultLocale: languageTagSchema.nullable(),
|
|
181
|
+
currencyDisplay: storefrontCurrencyDisplaySchema,
|
|
182
|
+
}),
|
|
183
|
+
forms: z.object({
|
|
184
|
+
billing: z.object({
|
|
185
|
+
fields: z.array(storefrontFormFieldSchema),
|
|
186
|
+
}),
|
|
187
|
+
travelers: z.object({
|
|
188
|
+
fields: z.array(storefrontFormFieldSchema),
|
|
189
|
+
}),
|
|
190
|
+
}),
|
|
191
|
+
payment: z.object({
|
|
192
|
+
defaultMethod: storefrontPaymentMethodCodeSchema.nullable(),
|
|
193
|
+
methods: z.array(storefrontPaymentMethodSchema),
|
|
194
|
+
defaultSchedule: storefrontPaymentScheduleSchema.nullable(),
|
|
195
|
+
bankTransfer: storefrontBankTransferSchema.nullable(),
|
|
196
|
+
}),
|
|
197
|
+
});
|
|
198
|
+
export const storefrontSettingsPatchSchema = z.object({
|
|
199
|
+
branding: storefrontSettingsInputSchema.shape.branding,
|
|
200
|
+
support: storefrontSettingsInputSchema.shape.support,
|
|
201
|
+
legal: storefrontSettingsInputSchema.shape.legal,
|
|
202
|
+
localization: storefrontSettingsInputSchema.shape.localization,
|
|
203
|
+
forms: storefrontSettingsInputSchema.shape.forms,
|
|
204
|
+
payment: storefrontSettingsInputSchema.shape.payment,
|
|
205
|
+
});
|